Jscript to create surface from point
Hi all,
I have geometry defined by point ( coordinates x,y & z) So i try to use jscript to build this geometry in designbuilder. I found some function in ANSYS Workbench documentation that can help me i think: //Points var PF1 = agb.FPoint(agc.FPointConstruction, agc.FPointCoordinateFile); PF1.CoordinateFile = "D:\\Users\\adrien.gros\\Documents\\fluent_project \\new 1.txt"; agb.Regen(); //To insure model validity //Bottom var LF1 = agb.LinePt(); LF1.AddSegment(PF1.GetPoint(1, 1), PF1.GetPoint(1, 2)); LF1.AddSegment(PF1.GetPoint(1, 2), PF1.GetPoint(1, 3)); LF1.AddSegment(PF1.GetPoint(1, 3), PF1.GetPoint(1, 4), 1); //Note setting ID=1 LF1.AddSegment(PF1.GetPoint(1, 4), PF1.GetPoint(1, 1)); agb.Regen(); var LF2 = agb.LinePt(); //Note these also set IDs LF2.AddSegment(PF1.GetPoint(1, 3), PF1.GetPoint(2, 1), 2); LF2.AddSegment(PF1.GetPoint(2, 1), PF1.GetPoint(2, 2), 3); LF2.AddSegment(PF1.GetPoint(2, 2), PF1.GetPoint(1, 4), 4); var i; var edge; var numb1 = LF1.GetNumEdges(); if(numb1 == 4) { agb.ClearSelections(); for(i=1; i<5; i++) { edge = LF1.GetEdge(i); agb.AddSelect(agc.TypeEdge3d, edge); } var surf1 = agb.SurfFromLines(); agb.regen(); } //Now select using IDs agb.ClearSelections(); agb.AddSelectEdgeID(1); agb.AddSelectEdgeID(2); agb.AddSelectEdgeID(3); agb.AddSelectEdgeID(4); var surf2 = agb.SurfFromLines(); agb.Regen(); Where the used txtfile new 1.txt is : # Group 1 1 1 0.000 0.00 0.0 1 2 10.000 0.00 0.0 1 3 10.000 20.000 0.0 1 4 0.000 20.000 0.0 # Group 2 2 1 -10.000 -10.00 0.0 2 2 20.000 -10.00 0.0 2 3 20.000 30.000 0.0 2 4 -10.000 30.000 0.0 But when i run this script in designmodeler, it does't work and this error message appear: 'Error: Line-Body operation failed Context: Geometry Engine, while generating Feature Line10 Error: Empty selection Context: Geometry Engine, while generating Feature Line10 ' Somebody may help me to understand what i did wrong? Thank you |
you can just create lines and then revolve it as "thin surface"
Example: Code:
function planeSketchesOnly5 (p) Hope it helps Cheers KAPI |
thank you for your help.
But i would like a jscript to build surface from 3d coordinate points without using symetry functions ( as revolve, extrude...). Here i presented very simple exemple to understand my probleme. But in reality i have a lot of point and they are not in the same plan ( z is different for each point) Do you know if it is possible to write a jscripte that allow to build polyhedra, only by knowing coordinate of the edges? thank you |
Hiya Adrien,
I have never done it before, so I cant really help with 3d coordinate system! |
All times are GMT -4. The time now is 08:00. |