Showing results for 
Search instead for 
Do you mean 
Reply

Obtaining hole normal

Hello everyone!

 

How can I programmatically obtain the normal direction from the hole face?

AskFaceData does not do the job exactly.

 

normal.png

5 REPLIES

Re: Obtaining hole normal

[ Edited ]

The information shown above is for a cylindrical face. For a cylindrical face, the face normal that is returned will depend on the point that you pick on the face. Using "information -> object" and picking a face, selects a point for you on the face.

 

If you pick a planar face, the .AskFaceData function will return the face normal (in the dir array). If you are not dealing with a planar face, you may want to use the .AskFaceProps function instead.

Re: Obtaining hole normal

The information shown above is for a cylindrical face. For a cylindrical face, the face normal that is returned will depend on the point that you pick on the face. Using "information -> object" and picking a face, selects a point for you on the face.

 

I thought about it too, but it does not seem to be depending on a point I pick on screen.

Re: Obtaining hole normal

Try this.

 

Direction dir = workPart.Directions.CreateDirection(cylFace, Sense.Forward, SmartObject.UpdateOption.WithinModeling );

Re: Obtaining hole normal

[ Edited ]

"I thought about it too, but it does not seem to be depending on a point I pick on screen."

 

The first part of my reply could have been worded more clearly. The normal direction of a cylindrical hole face will always point to the axis of the face. The direction will vary as you query different points around the circumference. However, using "information -> object" and selecting a cylindrical face will only report a single normal direction; but this is not the 'only' or 'definitive' face normal. Which point on the surface the "information" function uses to calculate the reported normal, I do not know.

 

If you use "information -> object" on a planar face, the returned normal direction will be true for any point on the face (by definition).

 

Using the NXOpen functions, you would have to specify a location on the surface for the normal direction calculation.

 

The answer to your question may be easier than you are making it out to be. I've not tested it, but the direction returned by the hole feature might always point from the selected face down the length of the hole (the "drilling" direction, if you will). If this is true, it would make programming a solution to your problem much simpler.

Re: Obtaining hole normal

A cylindrical face doesn't really have any one "face normal". The normal is different at different points of the face. Once you decide which point you're interested in, you can calculate the normal using functions like NXOpen.UF.UFEvalsf.Evaluate or Snap.NX.Face.Normal.
山田
yamada