Mirror & GUID for Vector


#1

Hello guys ,

i have 2 question :
1 - is it possible to mirror a Vector in python script !? if so how can i do it !?

2 - in general how can i create a GUID for an object (( line , point ,…)) ? and is it possible to create a GUID for a Vector in python !?


#2

Yes, for example you can create a mirror transform with rhinoscriptsyntax.XFormMirror(), and then transform the vector with rhinoscriptsyntax.VectorTransform(vector, transform).

GUIDs are only applicable to objects that are in the document. They are automatically created and returned when you add objects to the document with methods like
rhinoscriptsyntax.AddPoint(), ...AddLine(), etc.

Vectors are not Rhino objects like points or lines, thus they cannot have GUIDs.

–Mitch


(Steve Baer) #3

Why would you want a Guid for a vector?


#4

@Helvetosaur , thank you very much Mitch , its very nice to have you here in this forums.


#5

@stevebaer , i wanted to mirror a vector , so i tried to do it with rs.mirrorObject() (( didnt know about the way that Mitch just showed me in his comment here )) but that methods input for object to mirror is GUID , so i looked for a method to create a vector with GUID (( something like rs.addPoint , but for vectors)) , thats pretty much it .
sometimes before i was working on a script and i ran to a problem which i couldnt use lines that i created , so i asked one of my friends about it and he write this code for me :

for k in range(0,Iteration):
connectivity,Lines = ghcomp.DelaunayEdges(Pts)
for Line in Lines:
Line_List.append( scriptcontext.doc.Objects.AddLine(Line))
scriptcontext.doc.Views.Redraw()

he told me the problem was about lines GUID , i didnt get what he did in this code at all so i wanted to find out about this and creatung GUID for object .


(Dale Fugier) #6

Create a mirror transformation - Rhino.Geometry.Transform.Mirror. Then transform your vector - Rhino.Geometry.Vector3d.Transform.

Does this help?


#7

@dale , yes it helps but i prefer to work with rhinoscriptsyntax :slight_smile:
thanks


(Dale Fugier) #8

Check the Python help file for XformMirror and VectorTransform.