Jump to content
Developer Wiki and Function Reference Links Read more... ×
WhoCanDo

"Mirror" script returns point error

Recommended Posts

hTmp := Mirror (hTmp, True, P1x, P1y, P2x, P2y);

 

Can someone suggest why VS returns the error "Expected a point" at the first comma after the P1x please?

 

I have var P1x, P1y, P2x, P2y : real;

Share this post


Link to post

Is Mirror a function in Vectorscript? It's not on the Developer site...

Share this post


Link to post

Ahh, You are correct.

 

However, it is in the ScriptFunctionReference.html

 

 Mirror

VectorScript Declaration:

FUNCTION   Mirror
(         h    :HANDLE;
          dup    :BOOLEAN;
     VAR     p1X    :REAL;
     VAR     p1Y    :REAL;
     VAR     p2X    :REAL;
     VAR     p2Y    :REAL
) :HANDLE ;

Python:

def  vs.Mirror(h, dup, p1, p2):
   return HANDLE

Description:
Reflect an object across an axis.

For a 2D reflection, the axis is a line containing arbitrary point p and extending along vector v.

Parameters:

h    The object to reflect
dup    If false, transform the original object to the new position. If true, create a new object
p1    An arbitrary point on the mirror axis
p2    A second arbitrary point on the mirror axis

Result:

The reflected object (this will be the same as the input object if dup is false).
 

Share this post


Link to post

@Julian Carr That was the first think I checked also. As @WhoCanDo says, it is in the VW2019 downloadable reference.

 

But it appears the reference is wrong. The function does not take 4 reals for the x/y coordinate, rather it takes two Points.

 

The following works.

 

Procedure Test;
Var	H1:Handle;
	PT1,PT2:Point;
Begin
	PT1.x:=0;
	PT1.y:=4;
	PT2.x:=0;
	PT2.y:=0;
	H1:=Mirror(FSActLayer,True,PT1,PT2);
End;

Run(Test);

 

 

 

  • Like 1

Share this post


Link to post

I've never seen "Point" before. How is that different from "Vector"

Share this post


Link to post

Points and 2D Vectors are the same. 3D Points and 3D Vectors are the same.

 

My understanding is the have been given both names so as to not confuse people who are using them for different purposes. Someone who is trying to specify a point in space would think about using points. Someone who is trying to descriptor the motion of an object through space would use a vector. They both are just a combination of real values along the X/Y/Z axis.

Share this post


Link to post

Thanks Pat,

 

Since I didn't know about "Point", I tried defining the variable as "Vector", but it didn't work (note for anyone else reading this).

 

😉

Share this post


Link to post

It appears that Vectors are 3D as are Point3D. I think those are interchangeable.  Point only has X and Y and is what is required in this case.

 

Check out the Vectorscript Language Guide for more information.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×