Reply
Solved! Go to solution

On which side are holes

Hello everybody

I need to know on which side are the holes on the model. I can get all faces of ExtrudedProtrusion and can get info about holes with method GetInputFeatures on UserDefinedPattern. How I determine on whitch side/face these holes sit. Am i looking on right direction? I cant find common elements of faces and Holes/UserDefinedPatterns. Any glue? I'm satisfied with principled direction to go. Thank you.

9 REPLIES

Re: On which side are holes

Hello ymerameha,

Can you post an image. Perhaps it would be possible to work out a specific solution instead of a general.

Re: On which side are holes

Hello Tushar

 

Let's say I have detail like in the image. I need to know information like in the image. Let first UserDefinedPattern is 2x (Ø5 h12), then 2x (Ø8 h12) is in the same side on the detail and UserDefinedPattern 2x (Ø6 h12) is not in the same side (even better, UserDefinedPattern 2x (Ø6 h12) is in opposite side). Is my desire understandable now?

 

Thank you

Solution
Solution
Accepted by topic author ymerameha
‎08-26-2015 04:32 AM

Re: On which side are holes

Hello ymerameha,

try to get the normal vector from the used refence plane that you can get from the Profile(s) of the features.

This if it points in the same direction, then the features are on the same side.

That does not mean the they are all on the same face of the main body .

 

When you use the GetNormal method of the RefPlane object you get an array with 3 double values that build a unit vector. The 3 values are the x, y and z values.
The values are in the range from -1.0 to 1.0. You must use some tolerace when comparing this values (0.0 may be 0.00000000xx, which depends on the límited number of decimal places of the floating numbers)

 

ragards JB

regards

JB
VS2015, SE ST10

Re: On which side are holes

The solution proposed by JB appears to be a clean and elegant one since it talks in terms of vector normal and ref planes of the holes.

The one I had in mind when asking for the image is more of 'quick and dirty' type fix. I will post it only if the proposed solution does not apply to your case. It worked for me since, in my case the holes were only on one side of the plate.

 

Re: On which side are holes

Hi JB

Thank you for the good hint. I have now little time to deal with this task. Everything looks fine and I can get the sides where holes reside. One thing needs explanation. You say: The values are in the range from -1.0 to 1.0., but I get valuses 6.###### and -6.###### too. They are usually values of y.  Can you explain it to me.

Thank you anyway.

Re: On which side are holes

Hello ymerameha,
which object are you using to get the Normal?
I tried the RefPlane from a hole feature in the user defined pattern collection and get a normal like (0,1,0) which points in the y direction.
The normal vector is usually normalised, what means that the length of it is 1. So the value of x+y+z is 1.
If the returned vector us not normalised, you can easily do it yourself.
Calculate the length of of the vector and devide each component (x y z ) by this length. The length is the square root of the sum of all squares of the components. Be sure to get a positive length value (absolutely value).
regards

JB
VS2015, SE ST10

Re: On which side are holes

[ Edited ]

Hello JB

I tried two variants: Hole.Profile.Plane and UserDefinedPattern.PatternPlane. The result is the same. If model base plane is Right (yz), then y value isn't 'normal'. In other cases (Top and Front base plane) the x, y, z valuse are ok. If you are interested I can post my testing code (C#) and models (ST6).

Lets see if I understand calculation correctly:
the length of the vector (lv) = √(x^2+y^2+z^2 ). Then x/lv+y/lv+z/lv = 1. I can't get 1.

 

EDIT: It seems to me on the basis of tests that I can ignore the value of y when y <-1 or y> 1 and the base plane is Right plane. What do you think?

EDIT2: More files and experimentation. Now I can get all the x, y, z values less than -1 and greater than 1. Still think I can ignore them.

Re: On which side are holes

Thanks JB for helping!
I got my app work nicely.

Re: On which side are holes

When a vector is NORMALIZED, then the square root of the squared sum of its normal direction components is 1 and NOT the simple sum of the vector components:

vec_length = sqrt(x^2 + y^2 + z^2) = 1    (if normalized!!)


ymerameha wrote:


Lets see if I understand calculation correctly:
the length of the vector (lv) = √(x^2+y^2+z^2 ). Then x/lv+y/lv+z/lv = 1. I can't get 1.