Virtual Topology [Split Edge at +]

Member Posts: 26
**
edited July 9

Please tell me how to "Split Edge at +" .
And, can it be done at an arbitrary point (coordinate) instead of at +?

Tagged:

• Member, Employee Posts: 287
✭✭✭✭
edited July 9
```edgeID = 18
split_ratio = 0.25

selection=ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
selection.Ids = [edgeID]

except: virtual_topology = ExtAPI.DataModel.GetObjectsByType(Ansys.ACT.Automation.Mechanical.VirtualTopology)[0]

virtual_topology.VirtualSplitEdge(selection,split_ratio)
```
• Member Posts: 26
**

@Landon Mitchell Kanner
Thank you!
Can it be done with a point, not ratio?"

• Member, Employee Posts: 287
✭✭✭✭
edited July 10

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:
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"
```