CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ANSYS Meshing & Geometry

[DesignModeler] Script create Named Selection and Suppress

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 7, 2016, 03:25
Default Script create Named Selection and Suppress
  #1
New Member
 
Join Date: Jul 2016
Posts: 3
Rep Power: 3
arpeedesign is on a distinguished road
Hi all,

I am new at the forum and in the ansys scripting.
I'm scripting an epicycloid gear in 2D. I can already draw everything, what I wanted, but I don't know how to suppress the Line body and how to create named selections from the spline, the circles and the faces.
Can anybody help me in these problems?

Here is the script:

ag.gui.NewFile();
ag.m.ClearAllErrors();
ag.m.NewSession (true);
ag.gui.setUnits(ag.c.UnitMillimeter, ag.c.UnitDegree, ag.c.No);
ag.m.ModelPrefs.ModelToleranceType = ag.c.ModelTightTol;

function planeSketchesOnly (p)
{
//Plane
p.Plane = agb.GetXYPlane();
p.Origin = p.Plane.GetOrigin();
p.XAxis = p.Plane.GetXAxis();
p.YAxis = p.Plane.GetYAxis();

//Units
ag.c.UnitMillimeter = ag.m.constant("UNIT_MILLIMETER");

//Sketch
p.Sk1 = p.Plane.NewSketch();
p.Sk1.Name = "Gear";

//Edges
with (p.Sk1)
{
p.Sp9 = SplineBegin();
with(p.Sp9)
{
SplineXYW(-1.68907000, 43.91513000, 1.00000000);
SplineXYW(-1.08655201, 43.65346971, 1.00000000);
[...]
SplineKnot(1.00000000);
SplineCtrlPtEnd(0.00000000, 1.00000000, 4, 1, 0, 0);
}
p.Cr10 = Circle(0.00000000, 0.00000000, 12.50000000);
}
//Units
ag.c.UnitMillimeter = ag.m.constant("UNIT_MILLIMETER");

//Sketch
p.Sk2 = p.Plane.NewSketch();
p.Sk2.Name = "Excenter";

//Edges
with (p.Sk2)
{
p.Cr11 = Circle(0.00000000, 0.00000000, 12.50000000);
p.Cr12 = Circle(0.00000000, -0.60000000, 5.00000000);
}

//Units
ag.c.UnitMillimeter = ag.m.constant("UNIT_MILLIMETER");

//Sketch
p.Sk3 = p.Plane.NewSketch();
p.Sk3.Name = "Pin";

//Edges
with (p.Sk3)
{
p.Cr13 = Circle(0.00000000, 44.40000000, 1.50000000);
p.Cr14 = Circle(0.00000000, 44.40000000, 1.00000000);
}

// Select sketch before CreateSurfSk feature
ag.selectedFeature = ag.gui.TreeviewFeature(p.Sk3.Name, 1);
var SSk1=ag.gui.CreateSurfSk(); // IAnsFSurfSk
SSk1.Name="Pin_1";
SSk1.Operation=ag.c.Frozen;
SSk1.WithPlaneNormal=ag.c.Yes;
var PF1 = ag.gui.CreateSpot();

ag.listview.ActivateItem("Type");
ag.listview.ItemValue = "Construction Point";
ag.listview.ActivateItem("Definition");
ag.listview.ItemValue = "Manual Input";
ag.listview.ActivateItem("FD8, X Coordinate");
ag.listview.ItemValue = "0";
ag.listview.ActivateItem("FD9, Y Coordinate");
ag.listview.ItemValue = "-0,6";
ag.listview.ActivateItem("FD10, Z Coordinate");
ag.listview.ItemValue = "0";
agb.Regen();

var PF2 = ag.gui.CreateSpot();
ag.listview.ActivateItem("Type");
ag.listview.ItemValue = "Construction Point";
ag.listview.ActivateItem("Definition");
ag.listview.ItemValue = "Manual Input";
ag.listview.ActivateItem("FD8, X Coordinate");
ag.listview.ItemValue = "0";
ag.listview.ActivateItem("FD9, Y Coordinate");
ag.listview.ItemValue = "-0,6";
ag.listview.ActivateItem("FD10, Z Coordinate");
ag.listview.ItemValue = "1";
agb.Regen();

var LF1 = agb.LinePt();
LF1.AddSegment(PF1.GetPoint(1, 0),PF2.GetPoint(1, 0));
agb.Regen();

var Pat = ag.gui.CreatePattern();
ag.listview.ActivateItem("Pattern Type");
ag.listview.ItemValue = "Circular";
ag.listview.ActivateItem("Geometry");
ag.bodyPick;
ag.gui.SelectAll();
ag.listview.ItemValue = "Apply";
ag.listview.ActivateItem("Axis");
ag.edgePick;
ag.gui.SelectAll();
ag.listview.ItemValue = "Apply";
ag.listview.ActivateItem("FD2, Angle");
ag.listview.ItemValue = "0";
ag.listview.ActivateItem("FD3, Copies (>=0)");
ag.listview.ItemValue = "59";
agb.Regen();

ag.gui.ClearSelect();
ag.selectedFeature = ag.gui.TreeviewFeature(p.Sk1.Name, 1);
var SSk1=ag.gui.CreateSurfSk(); // IAnsFSurfSk
SSk1.Name="Gear_Srf";
SSk1.Operation=ag.c.Frozen;
SSk1.WithPlaneNormal=ag.c.Yes;

ag.gui.ClearSelect();
ag.selectedFeature = ag.gui.TreeviewFeature(p.Sk2.Name, 1);
var SSk1=ag.gui.CreateSurfSk(); // IAnsFSurfSk
SSk1.Name="Excenter_Srf";
SSk1.Operation=ag.c.Frozen;
SSk1.WithPlaneNormal=ag.c.Yes;

agb.Regen();

p.Plane.EvalDimCons(); //Final evaluate of all dimensions and constraints in plane

return p;
} //End Plane JScript function: planeSketchesOnly

//Call Plane JScript function
var ps1 = planeSketchesOnly (new Object());

//Finish
agb.Regen(); //To insure model validity
//End DM JScript
arpeedesign is offline   Reply With Quote

Reply

Tags
line, namedselection, script, scripting, suppress

Thread Tools
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 On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:20.