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-arrayrl1as a vector !
Also be aware that:
if vector2==Z_AXIS && rl1.z==0
The face will be made facing downwards even if thevector2says '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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement