CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ANSYS Meshing & Geometry (https://www.cfd-online.com/Forums/ansys-meshing/)
-   -   [DesignModeler] DesignModeler Scripting: Direction vector in extrude command (https://www.cfd-online.com/Forums/ansys-meshing/154740-designmodeler-scripting-direction-vector-extrude-command.html)

Tobias_H June 19, 2015 04:56

DesignModeler Scripting: Direction vector in extrude command
 
1 Attachment(s)
I want to extrude a surface body in global x direction by Designmodeler scripting. Unfortunately, the direction vector cannot be specified in the API-command:

Designmodeler Users' Guide:
Extrude(Operation, BaseObject, Direction, Extent, Depth, Extent2, Depth2, Walled, Thin1, Thin2)

However, in Designmodeler's GUI it's very easy to specify the direction vector:
Attachment 40241

Does anyone know how to solve this problem?

Best regards

Tobias

Kapi June 23, 2015 19:25

Hi Tobias,

I have never used it but you can give this a try.
After defining Extrude and before Regenration you mite have to add the below code.
But before you could do use that, you have to named select the 2D edge ("EDGE1") you want to use to call it in script.

Code:

ag.listview.ActivateItem("Direction Vector");
agb.ClearSelections();
ag.edgePick;
agb.AddSelect(agc.TypeEdge3d, EDGE1);
ag.listview.ItemValue = "Apply";

So basically your code should look like this:

Code:


//Define Extrude
var Extrude1 = agb.Extrude(agc.Cut, ps5.Sk5, agc.DirSymmetric,
agc.ExtentThruAll, 0.0, agc.ExtentFixed, 0.0, agc.No, 0.0, 0.0);

//Define Direction Vector
ag.listview.ActivateItem("Direction Vector");
agb.ClearSelections();
ag.edgePick;
agb.AddSelect(agc.TypeEdge3d, EDGE1);
ag.listview.ItemValue = "Apply";

//Regenerate
agb.Regen();

You can try the below mentioned code to do Named selection:

Code:

var EDGE1 = ag.m.ModelEdges(1); //you have to find out what number edge you want as your 2D edge
agb.AddSelect(agc.TypeEdge3d, Edge1);

if you want to change Direction vector you need to call that particular Edge which you want to specify in Direction Vector.

Hope it helps

Cheers
KAPI

Tobias_H July 27, 2015 07:49

Dear Kapi,

thank you for this solution. I found out that it's also possible to set the direction vector by the command
extrude_obj.SetDirection(x,y,z).

#### Code example #####
var ext1 = agb.Extrude(agc.Add, ps1.Sk1, agc.DirNormal, agc.ExtentFixed, 3.5,
agc.ExtentFixed, 0.0, agc.No, 0.0, 0.0);
ext1.SetDirection(0.5,0.5,0.5);
agb.Regen(); //To insure model validity
######################


Best regards

Tobias

Kapi July 27, 2015 18:36

Thanks Tobias_H,

we learn new things everyday!

Cheers
KAPI


All times are GMT -4. The time now is 04:18.