perspective match - save vanishing lines

Hello

if somebody use perspective match tool, I have a question :
I want to store some all vanishing lines of a view, and to be able to use them later.
When I make two scripts (ms) it works
When I make two macroscripts I get "no get fonction for undefined" at first line.
If somebody can help. Thanks.

to save :
---------------------
global xLine1s
global xLine1e
global yLine1s
global yLine1e
global zLine1s
global zLine1e
global xLine2s
global xLine2e
global yLine2s
global yLine2e
global zLine2s
global zLine2e
xLine1s = Perspective_Match.GetLineStart #xLine1
xLine1e = Perspective_Match.GetLineEnd #xLine1
xLine2s = Perspective_Match.GetLineStart #xLine2
xLine2e = Perspective_Match.GetLineEnd #xLine2
yLine1s = Perspective_Match.GetLineStart #yLine1
yLine1e = Perspective_Match.GetLineEnd #yLine1
yLine2s = Perspective_Match.GetLineStart #yLine2
yLine2e = Perspective_Match.GetLineEnd #yLine2
zLine1s = Perspective_Match.GetLineStart #zLine1
zLine1e = Perspective_Match.GetLineEnd #zLine1
zLine2s = Perspective_Match.GetLineStart #zLine2
zLine2e = Perspective_Match.GetLineEnd #zLine2
--------
to apply :

Perspective_Match.setLineStart #xLine1 [xLine1s[1],xLine1s[2]]
Perspective_Match.setLineEnd #xLine1 [xLine1e[1],xLine1e[2]]
Perspective_Match.setLineStart #yLine1 [yLine1s[1],yLine1s[2]]
Perspective_Match.setLineEnd #yLine1 [yLine1e[1],yLine1e[2]]
Perspective_Match.setLineStart #zLine1 [zLine1s[1],zLine1s[2]]
Perspective_Match.setLineEnd #zLine1 [zLine1e[1],zLine1e[2]]
Perspective_Match.setLineStart #xLine2 [xLine2s[1],xLine2s[2]]
Perspective_Match.setLineEnd #xLine2 [xLine2e[1],xLine2e[2]]
Perspective_Match.setLineStart #yLine2 [yLine2s[1],yLine2s[2]]
Perspective_Match.setLineEnd #yLine2 [yLine2e[1],yLine2e[2]]
Perspective_Match.setLineStart #zLine2 [zLine2s[1],zLine2s[2]]
Perspective_Match.setLineEnd #zLine2 [zLine2e[1],zLine2e[2]]
---------

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

get and set anchor points positions

global PML = undefined
struct perspMatchLinesPos
(
	pmLinesPos = #(), pmLineName, cnt = 1,
	fn lineName num n =
	(
		case of
		(
			(num == 1 or num == 7): ("xLine"+ n as string) as name
			(num == 3 or num == 9): ("yLine"+ n as string) as name
			(num == 5 or num == 11): ("zLine"+ n as string) as name
		)		
	),
	fn getLinesAnchorsPos =
	(
		this.pmLinesPos = #()
		for i = 1 to 12 do
		( 
			if mod i 2 != 0 then
			(
				this.pmLineName = this.lineName i this.cnt
				append this.pmLinesPos (Perspective_Match.GetLineStart this.pmLineName)
			)
			else
			(
				append this.pmLinesPos (Perspective_Match.GetLineEnd this.pmLineName)
				if i == 6 then this.cnt = 2 else if i == 12 do this.cnt = 1
			)
		)
	),
	fn setLinesAnchorsPos arr = if arr.count != 0 do
	(
		for i = 1 to 12 do
		(
			if mod i 2 != 0 then
			(
				this.pmLineName = this.lineName i this.cnt
				Perspective_Match.setLineStart this.pmLineName arr[i]
			)
			else
			(
				Perspective_Match.setLineEnd this.pmLineName arr[i]
				if i == 6 then this.cnt = 2 else if i == 12 do this.cnt = 1
			)
		)
	)
)
PML = perspMatchLinesPos()
 
--to get all anchor positions use next line
PML.getLinesAnchorsPos()
--to set all anchor positions use next line
PML.setLinesAnchorsPos PML.pmLinesPos

barigazy

titane357's picture

Thanks barigazy, it works

Thanks barigazy, it works !

If I want to save a PML for each camera

global ("PLM"+ $.name) as name = undefined
(...)

is something I can do ?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.