@johnwmcc said:
Thanks for the suggestion. Unfortunately, it reports just the same normal as face.normal - off at an angle from the face, but along one axis to which the face is NOT normal geometrically!
I shall look again at the sequence of inserting and transforming the face into the component definition - I'm now pretty sure that the problem lies in the create_geometry method, where I draw the face, insert it into a component definition, then transform it to the required position. Doing that is somehow seriously distorting where the component thinks its face normals point - not normal to the physical face!
If you are picking a face in a component or group, the normal will need to be transformed.
@ip1.pick view, x, y
if( @ip1.valid? )
... other code...
## Detect if pick point is on a face, and if so, orient long axis normal to it
# unless axis is locked
if @ip.face
f = @ip.face
puts "Face picked; normal is \n"
#######
n = @ip.face.normal; t = @ip.transformation; n.transform! t
#######
puts f.normal.inspect; n.inspect
if @@axis_lock == NO_LOCK # axis not locked
@long_axis = f.normal
puts "@long_axis = " + @long_axis.inspect