0% found this document useful (0 votes)
5 views

DesignModeler Example

This document provides a script example for creating surfaces from lines in ANSYS DesignModeler using JScript. It details the steps to read point sequence data, create line bodies, and generate surface bodies, including edge ID specifications. Additionally, it discusses potential issues with face orientation and the limitations of setting edge IDs through the GUI.

Uploaded by

Tuan Hoang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

DesignModeler Example

This document provides a script example for creating surfaces from lines in ANSYS DesignModeler using JScript. It details the steps to read point sequence data, create line bodies, and generate surface bodies, including edge ID specifications. Additionally, it discusses potential issues with face orientation and the limitations of setting edge IDs through the GUI.

Uploaded by

Tuan Hoang
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

____________________________________________________________________________________

Script Example in ANSYS DesignModeler


(Creating Surface from Line)
Description:
Here is an example of how to use scripts in DesignModeler.

Solution:
The script file is written in JScript (extension *.js)

// Two slashes indicate a comment

// Reading of point sequence data


var PF1 = agb.FPoint(agc.FPointConstruction, agc.FPointCoordinateFile);
PF1.Name = "TablePoints"; //Change feature name
PF1.CoordinateFile = "C:\\Users\\hmachida\\Desktop\\dmpoint.txt";
agb.Regen(); //Run Generate

// Create line body(LinesFromPoints)


var LF1 = agb.LinePt();
LF1.AddSegment(PF1.GetPoint(1, 1), PF1.GetPoint(1, 2)); // Connect
ID1 of Group 1 and ID2 of Group 1
LF1.AddSegment(PF1.GetPoint(1, 2), PF1.GetPoint(1, 3));
LF1.AddSegment(PF1.GetPoint(1, 3), PF1.GetPoint(1, 4),1); // When
connecting, set the edge ID of that edge to No. 1
LF1.AddSegment(PF1.GetPoint(1, 4), PF1.GetPoint(1, 1));
agb.Regen();

// Create line body


var LF2 = agb.LinePt();
LF2.AddSegment(PF1.GetPoint(1, 3), PF1.GetPoint(2, 1), 2);
LF2.AddSegment(PF1.GetPoint(2, 1), PF1.GetPoint(2, 2), 3);
LF2.AddSegment(PF1.GetPoint(2, 2), PF1.GetPoint(1, 4), 4);
agb.Regen();

// Create a surface body 1


var i;
var edge;
var edgeNum = LF1.GetNumEdges(); // Get number of edges from first line body
if(edgeNum > 0)
{
agb.ClearSelections();
for(i=1 ; i < edgeNum+1 ; i++)
{
edge = LF1.GetEdge(i);
agb.AddSelect(agc.TypeEdge3d, edge); // Select Edge }
var surf1 = agb.SurfFromLines();
agb.regen();
}

© 2016 ANSYS, Inc. All rights reserved.


// Create surface body 2
agb.ClearSelections();
agb.AddSelectEdgeID(1); // Select edge with edge ID = 1
agb.AddSelectEdgeID(2);
agb.AddSelectEdgeID(3);
agb.AddSelectEdgeID(4);
var surf2 = agb.SurfFromLines();
agb.Regen();

Results
Point sequence data (dmpoint.txt) used in script: text format

# Group 1
1 1 0.0 0.0 0.0
1 2 0.0 1.0 0.0
1 3 1.0 1.0 0.0
1 4 1.0 0.0 0.0

#Group 2
2 1 2.0 1.0 0.0
2 2 2.0 0.0 0.0

Reading point sequence data: a total of six points are read in two groups. It is not necessary to group the
point sequence data.

Figure 1: Points and their IDs

Create a line body of hollow squares consisting of four lines from the four points of group 1.
Here, specify edge ID = 1 only for certain edges.

© 2016 ANSYS, Inc. All rights reserved.


Figure 2: Creating first line body

Similarly, a second line body that is "U-shaped" is created from two points of group 1 and two points of
group 2. Here, edge ID = 2, 3, 4 is specified for the three edges respectively.

Figure 3: Creating second line body

In this step, all edges constituting a line body are selected to create a surface body.
Therefore, the line body must be closed.

© 2016 ANSYS, Inc. All rights reserved.


Figure 4: First surface body

The second surface body will be created using a different method. In this method, the edge is selected
using the ID of the edge specified at the time of line body creation. The ID of the edge can be specified
irrespective of the line body and it may be shared/reused.

Figure 5: Second surface body created with ID

Additional Notes

The main problem with creating a surface body is getting the wrong side of the face. In 2D analysis, it
may be a big issue in ANSYS Meshing if the face is not properly oriented. With the second method, you
can rotate the face clockwise, but in the first method, DesignModeler will choose an orientation based on
the table. If you end up with the opposite face, simply turn it over using Surface Flip.

Also, the edge ID used in the second method can only be set in the script; it cannot be set from normal
GUI operations.

© 2016 ANSYS, Inc. All rights reserved.

You might also like