# [DesignModeler] Find face normals to selected faces

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

 July 24, 2017, 14:16 Find face normals to selected faces #1 New Member   Join Date: Jul 2017 Posts: 2 Rep Power: 0 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); for(i=0;i

 July 26, 2017, 11:04 #2 New Member   Join Date: Jul 2017 Posts: 2 Rep Power: 0 Hi everybody, Can you help me with this please.

 Tags face direction, face normals, facesplits, plane orientation