CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

[DesignModeler] Find face normals to selected faces

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2017, 14:16
Default Find face normals to selected faces
New Member
Join Date: Jul 2017
Posts: 2
Rep Power: 0
Pallati is on a distinguished road
Hi Everbody,
I am writing a script (JScript) in Design Modeler which automatically creates face splits on surfaces. We select a set of bodies on which we require facesplits at the contact surfaces and run the script. The script was written in the following way:
1. Select a set of bodies on which we intend to split faces at the contact surfaces and run the script.
2. Find distance between each body using 'Distance Finder' in Design Modeler and consider only the bodies which have zero distance between them.
3. Consider a single body from set of bodies obtained from step 2. Store the labels of each face of the selected body in a variable, say 'a'.
4. Now consider all the bodies which are at zero distance with the selected body and store labels of all its surfaces in a variable, say 'b'.
5. Consider each surface stored in 'a' and compare with each and every surface stored in 'b' to find the distance using 'Distance Finder'. Take the surfaces in 'b' which have zero distance with surfaces in 'a' and store the labels of edges of those particular surfaces in a separate variable 'c'. Now we have faces to be split in 'a' and the edges with which it should be split in 'c'.
6. Invoke 'Face Split' feature in Design Modeler and feed the surfaces to be split (stored in 'a') to "Target Face" and the edges with which they split (stored in 'c') to "Tool Geometry"and "Generate".
7. Loop over each body until all the bodies are split.
I am facing a problem in Step 5. I am able to successfully filter the surfaces which have zero distance between them but these surfaces also include surfaces which are at an angle and have zero distance. This is because 'Distance Finder' in Design Modeler gives zero distance for inclined surfaces with one edge sitting on the face of another surface. Now I have to reject all those surfaces which are at an angle to each other. I couldn't get a suitable condition to give in 'if(condition)' to reject angled surfaces.

Simply put,
i). I am unable to find normals to each of selected surfaces which gives me condition to reject angled faces (how are face normals to highlighted surfaces stored in variables?, What is the syntax?, agc.DirNormal not working?, agc.DirNormal is used only when Extrude is invoked). In the following script if we could place the syntax for face normals at the commented section, hopefully problem gets solved.

var a = new Array();
var d = new Array();
var count = ag.m.GetBodySelListSize();
WBScript.Out("Number of Bodies = "+count, true);
a[i] = ag.m.GetBodySelListIndex(i).Label;
if(count==0){ WBScript.Out("Select Bodies",true); }
ag.m.FindEntity(0, 0, a[i], 0);
var FC = ag.m.GetFaceSelListSize();
d[n] = ag.m.GetFaceSelListIndex(n).Label;
ag.m.FindEntity(0, 0, d[n], 0);
WBScript.Out("Face Label = " + d[n],true);

//At this line I have to write syntax to find the direction/normal of selected surface which I couldn't (Help Needed)

ii). If I create plane with face and find the normal of that plane, I think I would get a condition to reject angled faces. So finding normal to plane could solve the problem.
iii). Finding the angle between two selected surfaces also solves my problem.

Solution to either i. or ii. or iii. could solve my problem. If you have any other solution please inform me. Your help is appreciated.

The document which helped me a lot is at the following location
" "
The script for auto facesplit is attached which didn't include the 'if(condition)' mentioned above.

Last edited by Pallati; September 15, 2017 at 05:35.
Pallati is offline   Reply With Quote

Old   July 26, 2017, 11:04
New Member
Join Date: Jul 2017
Posts: 2
Rep Power: 0
Pallati is on a distinguished road
Hi everybody,
Can you help me with this please.
Pallati is offline   Reply With Quote


face direction, face normals, facesplits, plane orientation

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Mesh Importing Problem cuteapathy ANSYS Meshing & Geometry 2 June 24, 2017 05:29
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
snappyhexmesh remove blockmesh geometry philipp1 OpenFOAM Running, Solving & CFD 2 December 12, 2014 10:58
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 19:43

All times are GMT -4. The time now is 08:46.