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

[DesignModeler] DM script js with agb.revolve

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 8, 2015, 11:49
Default DM script js with agb.revolve
  #1
New Member
 
Aureliano Sancho
Join Date: May 2013
Posts: 6
Rep Power: 5
SanchoBuendia is on a distinguished road
I want to write a script to create a sphere but can not correctly run the agb.revolver command. Please can anyone help?


Follows the script:

agb.Regen ();

//.................................................. ..............

function planeXYSketchesOnly (p)

{

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


//.......................Primeiro Retangulo......................................... ...

p.Sk1 = p.Plane.newSketch();
p.Sk1.Name = "Sketch1";

with (p.Sk1)
{

p.Cr1 = ArcCtrEdge(0, 0, 2.0, 0, -2.0, 0);

}


p.Plane.EvalDimCons();
return p;
}

var XYPlane = agb.GetXYPlane();
agb.SetActivePlane (XYPlane );
var ps1 = planeXYSketchesOnly (new Object());

var rev1 = agb.Revolve(agc.add, ps1.Sketch1, ps1.XAxis, agc.DirNormal, 360.0, agc.No);
agb.Regen();
SanchoBuendia is offline   Reply With Quote

Old   December 9, 2015, 20:30
Default
  #2
Senior Member
 
Join Date: Apr 2014
Location: Not Sure
Posts: 508
Rep Power: 6
Kapi is on a distinguished road
two ways to do it.

1) Go to Create>Primitives>Sphere and generate it

2) create sketch you have created and choose "YZ" plane as axis when you revolve, so the last few lines of code will be like
Code:
var ps1 = planeSketchesOnly1 (new Object());
agb.Regen();
var Rev1 = agb.Revolve(agc.Add, ps1.Sk1, ps1.XAxis, agc.DirNormal,360.0, 0.0, agc.No, 0.0, 0.0);
agb.Regen();
I think the problem in your code is when you are choosing sketch in Revolve as well "ps1.Sketch1" should be replaced by "ps1.Sk1" as you have defined it above

Hope it helps

Cheers
KAPI
Kapi is offline   Reply With Quote

Old   December 11, 2015, 11:03
Default Thank you so much - another problem
  #3
New Member
 
Aureliano Sancho
Join Date: May 2013
Posts: 6
Rep Power: 5
SanchoBuendia is on a distinguished road
Kapi,

Thank you so much, it helped a lot, but it appeared another problem. When I create a cylinder with ball in half and send cut the material, it does not. The agc.Cut command is not working. Can you help me?
I want to stay that way

1.png


but when I run the code looks like this

2.png

--------------------------------------------------------------

agb.Regen ();

//.................................................. ..............

function planeXYSketchesOnly (p)

{

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


//.......................Primeiro Retangulo......................................... ...

p.Sk1 = p.Plane.newSketch();
p.Sk1.Name = "Sk1";

with (p.Sk1)
{

p.Cr25 = Circle(0.0, 0.0, 4.0)

}

p.Sk2 = p.Plane.newSketch();
p.Sk2.Name = "Sk2";

with (p.Sk2)
{

p.Cr1 = ArcCtrEdge(0, 0, 2.0, 0, -2.0, 0);

}

p.Plane.EvalDimCons();
return p;
}

var XYPlane = agb.GetXYPlane();
agb.SetActivePlane (XYPlane );
var ps1 = planeXYSketchesOnly (new Object());
agb.Regen();


var ext1 = agb.Extrude(agc.Add, ps1.Sk1, agc.DirSymmetric, agc.ExtendFixed, 1.5, agc.ExtendFixed, 0.0, agc.No, 0.0, 0.0)
agb.Regen();
var Rev1 = agb.Revolve(agc.Cut, ps1.Sk2, ps1.XAxis, agc.DirNormal,360.0, 0.0, agc.NO, 0.0, 0.0);
agb.Regen();
SanchoBuendia is offline   Reply With Quote

Old   December 13, 2015, 18:55
Default
  #4
Senior Member
 
Join Date: Apr 2014
Location: Not Sure
Posts: 508
Rep Power: 6
Kapi is on a distinguished road
just code it as you would do manually.

You can just suppress the body from parts and you will have the result.

I strongly suggest you to do example from the help section so you will have answers to all these basic questions

Cheers
KAPI
Kapi is offline   Reply With Quote

Reply

Tags
abg.revolver, design modeler, scripting

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Workbench] Run ICEM Script in Workbench Script MIZOR ANSYS Meshing & Geometry 3 October 7, 2016 02:16
Grid Check Script pdp.aero SU2 2 April 23, 2015 01:54
[ICEM] Problem with ICEM Script Meshing asal ANSYS Meshing & Geometry 2 March 23, 2013 20:11
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 09:36
Perl script for intialisation pratik mehta CFX 2 September 10, 2008 03:09


All times are GMT -4. The time now is 19:07.