Push pull problems/face orientation wobbly
-
Hi
Im creating 3d geometry using the method in the 'Creating Geometry' tutorial at https://developers.google.com/sketchup/docs/tutorial_geometry
ie specify point then add a face then use push pull to add third dimension.
Problem is sometimes the push pull is going in the wrong direction. Ive read somewhere thats to do with face orientation. I think whats happening is that when the geometry is being drawn next to existing geometry it is triggering some sort of new face or face orientation linked to the existing geometry that is different to what I would expect if I was drawing in isolation.
Workarounds Ive thought of are
- draw the new geometry outside the models bounding box and bring it into place.
- use another way than pushpull to create the extra dimension
- build in context awareness to the code so that the face orientation cant be messed up by existing geometry.
- find a way to force the face orientation in every case regardless of context.
Anyway I thought Id put the problem to the group because I imagine this could be quite a nooby way of creating geometry and Id be keen to hear of better ways. Im keen to hear of any better ways to do things/think.
Thanks for your help.
Paul
-
@unknownuser said:
](https://developers.google.com/sketchup/docs/ourdoc/face#pushpull)":181okd10]The distance is measured in the direction that the face normal is pointing.
So use
face.normal()
to get the directional vector of the front of your face. Compare it to the direction you wish to pushpull, and if it's opposite, then callface.reverse!
before you pushpull it. -
Thanks Dan. Will do.
[edit]
In the end I set up a vector in the direction I wanted the face to go and used "samedirection" to check and used reverse liked you suggested. Initially I tried 'parrallel?' not thinking that that wouldnt catch vectors in the exact opposite direction.if not(face.normal.samedirection? correctV3d ) then face.reverse! end
This worked.
Advertisement