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

[DesignModeler] Design Modeler scripting

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 2, 2018, 08:34
Default Design Modeler scripting
  #1
New Member
 
Join Date: Oct 2017
Posts: 4
Rep Power: 9
winchler is on a distinguished road
Hi all,
I need to automatically create a set of spheres, depending on a list of point coming from an external file. I tried using a .js macro and until now I produce the following:

Code:
//Import the points
var fp1 = agb.FPoint(agc.FPointConstruction, agc.FPointCoordinateFile);
fp1.Name = "coordinatePoints";
fp1.CoordinateFile = "PATH\\file.txt";
agb.Regen();

//Generate spheres according to the sets of points from fp1 above
var i = 1;
while (fp1.GetPoint(i, 1)) {
    var SP = ag.gui.CreatePrimitive(1);	
	SP.SphereRadius = "1";
	i = i + 1;
}
agb.Regen();
Points are correctly imported, but I am not able to do the following things:
  • Import points in a different unit systems
  • Create a sphere for each point (for the moment only one is generated)
  • Modify the center of the sphere using the previously read points

Can please someone help me or tell me where can I find a list of example and tutorials?
Thank you

Lorenzo
winchler is offline   Reply With Quote

Old   May 2, 2018, 10:53
Default Solved
  #2
New Member
 
Join Date: Oct 2017
Posts: 4
Rep Power: 9
winchler is on a distinguished road
Sorry, I just solved it:

Code:
//Import the points
var fp1 = agb.FPoint(agc.FPointConstruction, agc.FPointCoordinateFile);
fp1.Name = "coordinatePoints";
fp1.CoordinateFile = "PATH\\FILE.txt";
agb.Regen();

//Generate spheres according to the sets of points from fp1 above
var i = 1;
while (fp1.GetPoint(1, i)) {
    var SP = ag.gui.CreatePrimitive(1);	
	//
    SP.SphereRadius = "0.00125";
    //
    ag.listview.ActivateItem("Sphere");
    ag.listview.ItemValue = "SPHERE_" + i;
    ag.listview.ActivateItem("Operation");
    ag.listview.ItemValue = "Add Frozen";
    ag.listview.ActivateItem("Origin Definition");
    ag.listview.ItemValue = "Coordinates";
    ag.listview.ActivateItem("FD3, Origin X Coordinate");
    ag.listview.ItemValue = agb.GetPointX(fp1.GetPoint(1, i));
    ag.listview.ActivateItem("FD4, Origin Y Coordinate");
    ag.listview.ItemValue = agb.GetPointY(fp1.GetPoint(1, i));
    ag.listview.ActivateItem("FD5, Origin Z Coordinate");
    ag.listview.ItemValue = agb.GetPointZ(fp1.GetPoint(1, i));
    agb.Regen();
    //
    i = i + 1;
}
winchler is offline   Reply With Quote

Old   May 19, 2018, 07:21
Default
  #3
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Hi Lorenzo,


I'm dealing with the same problem, gotta generate a plate with random holes in it and mesh it, all automaticaly using script,
would you mind sharing your text file containing the points you used in your script? I wanna generate the points using a code, but not sure yet how I should arrange them inside the text file
amin.z is offline   Reply With Quote

Old   May 21, 2018, 06:01
Default
  #4
New Member
 
Join Date: Oct 2017
Posts: 4
Rep Power: 9
winchler is on a distinguished road
Hi, you can refer to this topic for the format!


Importing Points in Design Modeler
winchler is offline   Reply With Quote

Old   May 22, 2018, 05:33
Default
  #5
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 15
amin.z is on a distinguished road
Quote:
Originally Posted by winchler View Post
Hi, you can refer to this topic for the format!


Importing Points in Design Modeler



got it, thanks
amin.z is offline   Reply With Quote

Reply

Tags
design modeler, javascript, scripting


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
[Other] Connecting 3D bodies in Ansys Design Modeler chipper ANSYS Meshing & Geometry 4 January 25, 2018 10:45
parametric study with design modeler and icepak aminem ANSYS 3 May 21, 2014 06:11
Scripting API Design Modeler - Spline mieszko1st ANSYS Meshing & Geometry 3 March 3, 2014 06:09
Design Modeler not working tan v ANSYS 0 July 7, 2011 03:43
Info: Short Course On Thermal Design of Electronic Equipment Arnold Free Main CFD Forum 0 August 10, 1999 11:18


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