Virtual Topology [Split Edge at +]
Akane Ito
Member Posts: 38
**
Please tell me how to "Split Edge at +" .
And, can it be done at an arbitrary point (coordinate) instead of at +?
Tagged:
0
Answers
-
edgeID = 18 split_ratio = 0.25 selection=ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids = [edgeID] try: virtual_topology = ExtAPI.DataModel.Project.Model.AddVirtualTopology() except: virtual_topology = ExtAPI.DataModel.GetObjectsByType(Ansys.ACT.Automation.Mechanical.VirtualTopology)[0] virtual_topology.VirtualSplitEdge(selection,split_ratio)
0 -
@Landon Mitchell Kanner
Thank you!
Can it be done with a point, not ratio?"0 -
I don't see any direct method. I think you would have to write your own code to calculate the ratio. There are some functions in the attached SolidMechanics.py file that can help. Here is something crude (assumes straight edge and units are consistent; have not thoroughly tested):
edgeID = 18 cut_point = (1.5,2,4) with open(r'D:\Temp\SolidMechanics.py') as f: cmds = f.read() exec(cmds) edge = ExtAPI.DataModel.GeoData.GeoEntityById(edgeID) selection=ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) selection.Ids = [edgeID] line_start= [edge.StartVertex.X,edge.StartVertex.Y,edge.StartVertex.Z] line_end= [edge.EndVertex.X,edge.EndVertex.Y,edge.EndVertex.Z] ratio,projection = project_pt2line(cut_point,line_start,line_end) if ratio > 0 and ratio < 1: virtual_topology.VirtualSplitEdge(selection,ratio) else: print "Cut point is not within the edge"
1