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

Design Modeler - Create->Body Transformation->Rotate with JS code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 6, 2020, 11:49
Unhappy Design Modeler - Create->Body Transformation->Rotate with JS code
  #1
New Member
 
Tim Crimson
Join Date: Jan 2020
Posts: 4
Rep Power: 6
Tim Crimson is on a distinguished road
Hello

Does anyone know how to rotate a body in Design Modeler through JS code

If you know, and you can post an example that works, that would make me super happy.

Here is my code

///////////////////////////////START////////////////////////////////////////////

ag.gui.NewFile()
ag.m.ClearAllErrors()
//ag.m.NewSession (true)
ag.gui.setUnits(ag.c.UnitMillimeter, ag.c.UnitDegree, ag.c.No)
//================================================== ==================================================

_elev = -12600.0
_D = 8000.0

// Cable Hole(s)
_elev = -12600 //mm
_diam = 380 //mm
_vert_angle = 45 //deg

p=new Object()
p.Plane = agb.GetActivePlane()
p.Origin = p.Plane.GetOrigin()
p.XAxis = p.Plane.GetXAxis()
p.YAxis = p.Plane.GetYAxis()

p.Sk2 = p.Plane.newSketch()
p.Sk2.Name = "Sketch2"
//Edges
with (p.Sk2)
{
with (p.Plane)

_vert_angle_rad=Math.PI*_vert_angle/180
p.Cr = Circle(0, _elev, _diam/2)

}
//
p.Plane.EvalDimCons() //Final evaluate of all dimensions and constraints in plane
agb.Regen() //To insure model validity

var Ext1 = agb.Extrude(agc.Add, p.Sk2, agc.DirNormal, agc.ExtentFixed, _D, agc.ExtentFixed, 0.0, agc.No, 0.0, 0.0)
agb.Regen() //To insure model validity

p=new Object()
p.Plane = agb.GetActivePlane()
p.Origin = p.Plane.GetOrigin()
p.XAxis = p.Plane.GetXAxis()
p.YAxis = p.Plane.GetYAxis()

p.Sk3 = p.Plane.newSketch()
p.Sk3.Name = "Sketch3"
//Edges
with (p.Sk3)
{
with (p.Plane)

// Sketch rotation line # I want to rotate the newly created extruded body with respect to this line #
p.Ln = Line(0, _elev, -_D, _elev)
}

////////////////////////////////END/////////////////////////////////////////////

So, I would like to rotate the newly created extruded body with respect to the line that I create at the end, 45 deg

Any idea?
Tim Crimson is offline   Reply With Quote

Reply

Tags
body transformation, design modeler, jscript, rotate, rotate body


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
[DesignModeler] Design Modeler GUI action script Enginetix ANSYS Meshing & Geometry 0 September 28, 2018 16:12
[DesignModeler] how to use design modeler api to create 3D path for extrude sweep? efirvida ANSYS Meshing & Geometry 9 May 20, 2015 20:25
define a parameter in cfx pre and use it in design modeler OmidOmid CFX 3 December 3, 2014 10:09
Design Modeler not working tan v ANSYS 0 July 7, 2011 03:43
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 16:56


All times are GMT -4. The time now is 13:54.