PROBLEM WITH PUSHPULL VECTOR
-
hi,
with this code (the FAKTOR is only fpr inch/cm recaltulation )
model = Sketchup.active_model
entities = model.active_entities
rl1 = [-50/faktor/100,0/faktor/100,20/faktor/100]
rl2 = [-50/faktor/100,10/faktor/100,30/faktor/100]group40 = entities.add_group entities2 = group40.entities new_line = entities2.add_line rl1, rl2 length = new_line.length centerpoint = rl2 # Create a circle perpendicular to the normal or Z axis vector = rl1 vector2 = vector.normalize! edges = entities2.add_circle centerpoint, vector2, 3 kreis = entities2.add_face edges kreis.pushpull length
i normally (and even in the beginning of this ruby-script (other cylinder)
can pushpull along the line without any problem.BUT
at the end of the script the same code lets the circle turn to an undefined angle.
absolutely crazy.
any idea how to fix it? >> screenshot
thanx.
stan
-
Use
vector2 = new_line.line[1]
### i.e. its vector
Do NOT use the point-arrayrl1
as a vector !
Also be aware that:
if vector2==Z_AXIS && rl1.z==0
The face will be made facing downwards even if thevector2
says 'up' !
This occurs in manual SketchUp... try drawing a flat circle on the ground and in the air - the face at z=0 faces downwards...
If the face orientation is important use something like:
kreis.reverse if vector2==Z_AXIS && rl1.z==0
-
hi tig,
you are the greatest, as always.
it works.
it's funny, that "my" wrong syntax works at the beginning of the ruby...god knows....will correct all of them.again a step nearer to my first ruby (for everyone then, of course)
regards and thax
stan
Advertisement