Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

The normal vector of an area 1

Status
Not open for further replies.

ankushaggarwal2

Aerospace
May 22, 2007
26
I want to get the normal vector of an area selected. In the *get command, three vectors are given, Principal orientation X,Y and Z vectors. But I think that those are related to inertia. So, please tell me how to get the normal vector of an area (plane ofcourse), defined previosly.
Thank you very much.
 
Replies continue below

Recommended for you

You must know three non linear key points of that area, say k1, k2 and k3.

Then you get the three coordinates of a unit normal vector by:

x=normkx(k1,k2,k3)
y=normky(k1,k2,k3)
z=normkz(k1,k2,k3)

Regards
Alex
 
Yes, that is how to calculate the normal vector. But, it will be a bit lengthy to do(first find three points and then do the calculation). Isn't there any direct method, by which ansys gives the normal vector. Thanks!!
 
I don't think so... At least I don't know a more direct method. Otherwise I would have first written it...

On the other hand, It's not so complicated to write a small macro to just that what you want. The following code should give you an example:

Code:
! arg1 = Area Number

/nopr
! Remember previously selected geometry
cm,prevarea,area
cm,prevline,line
cm,prevkpts,area
! Select KP's on area arg1
asel,s,,,arg1
lsla 
ksll 
! Search for 3 non linear KP's
*get,kcount,kp,,count
k1=kpnext(0)
k2=kpnext(k1)
k3=kpnext(k2)
testang=nint(anglek(k1,k2,k3))
*do,jj,1,kcount-3
  *if,testang,eq,180,or,testang,eq,0,then
     k3=kpnext(k3)
  *else
     *exit
  *endif
*enddo
! output of the Normal Vector of area arg1
/go
normx=normkx(k1,k2,k3)
normy=normky(k1,k2,k3)
normz=normkz(k1,k2,k3)
/nopr
! Restore previously selected geometry
ksel,s,,,prevkpts
lsel,s,,,prevline
asel,s,,,prevarea
/go

You can copy this code into a file areanormal.mac and call it by

areanormal,<areanumber>

Regards,
Alex


 
Thank you so much for the help. Just some more questions :p
The functions you used like nint, anglek, mormkx etc. are not given in the manual. Where to know about them?

And if I want to know the normal out of the volume (I mean, if I am interested in the sign of the normal, it should be out of the volume), is there any way to ensure that?

Thanks once again.
 
The functions are very well described in the manual. See

Appendix B. GET Function Summary

This functions are just abbreviations of the more general command *get.

To the second question: I would first check if the normal of an area of a volume is already pointing outwards of the volume.
 
Sorry, I did not get answer to the second question. How to check that?

Sorry to bother you so much. I really appreciate your help.
 
You can model a block for example. Then run the areanormal.mac macro for each of the areas of the block and check how the normals of each area are pointing: outward or inward.

If the each area normal is pointing outward then there is a big probability that this is the case for all volumes in ansys.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor