Jump to content
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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

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.

×
×
  • Create New...