Direction of Pushpull Is ?
-
ents = Sketchup.active_model.entities f = ents.add_face ... f.pushpull xWhich way does that pushpull?
-
Always in the direction of the face normal. Modify your question a little.
-
Except if the face is lying flat on the ground. In that case, it is always pushpulled in the positive Z direction (upwards), regardless of its normal's direction.
-
So [usually] if it faces up it pulls 'up' and if it faces down it pushes down...
If you always want it to be pulled 'up' thenface.reverse! if face.normal.z<0; face.pushpull(dist)
but if you want it pushpulled in the direction of the face's normal then plain
face.pushpull(dist)will work exceptif face normal==[0,0,1] and face.bounds.min.z==0in which case adjust accordingly... -
I didn't want to spoil it - Martin seems like the kind of guy who enjoys figuring things out.
I think it was trick question.
-
@jim said:
I think it was trick question.
No quite. I knew, before I asked, that the answer was "positive distance is often toward the outside of the face" and that a fresh rectangle in the rg plane was an exception. What I didn't know was if the latter was THE exception or one member of a class of exceptions.
-
Yes, but I am not seeing any exception.
Using this code, I get the following model - one face pushed up, the other down.
model = Sketchup.active_model entities = model.entities selection = model.selection selection.each {|e| if e.is_a? Sketchup;;Face e.pushpull(10) end }
-
Well that's odd. I could have sworn that a face on the ground plane will always head upwards.
Chris
-
@chris fullmer said:
Well that's odd. I could have sworn that a face on the ground plane will always head upwards.
Me too. I just rectangled twice on the ground plane, reversed one of the faces.
This, from memory, was what I typed into the Ruby Console:
ents = Sketchup.active_model.entities f = [] ents.each { |e| f.push(e) if e.is_a? Sketchup;;Face } f.each { |f| f.pushpull(10) }Result: two rectangular parallelepipeds (that's pretentious for "box"), both with their blue dimensions ranging from 0 to 10.
So now we've really screwed this one down: always toward the outside face, except on the ground plane, but the exception doesn't apply to Jim.
Anyone happy with this?
-
@martinrinehart said:
Result: two rectangular parallelepipeds (that's pretentious for "box"), both with their blue dimensions ranging from 0 to 10.
Totally wrong! Went back and did it again, carefully, being sure to orbit around and under. Jim is right. Sorry, Jim.
-
Maybe version 6 behaved differently? I can check...
No, 2 faces on the RG plane with opposite normals, +Z and -Z, each pushpulled +10, each extruded in the direction of the normal - so one went up, the other went down.
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