# arc to polyline how to?

Hi,

I am searching for a simple solution to convert a arc to a polyline for segment discretization. The point-on-arc commands are basic and needs a loop with math computation. Is there a single command for it?

BR

Hi millim

What task you are trying to solve? I ask because "segment discretization" makes me think about meshing while it seems you are asking about GEOM functionality.

St.Michael

Right,

It could be treated that way too. Now, I need a python code doing more or less the same that the export to "mesh-format" does. Getting all Vertices and Edge Verteces IDs in a list. What is a proper treatment of the smesh objects for this?

Thx.

Thx. That's It.

How about grouping of arcs? Usually partitioning and grouping is used to preserve group information in the mesh. Is there a simpler way to retrieve the node/edge mesh information belongs to which individual arc?

BR

# get an arc of node/segment

arcID = mesh.GetShapeID( n )

arcID = mesh.GetShapeIDForElem( seg )

arc = geompy.GetSubShape( mesh.GetShape(), [arcID] )

# get all node/segments of an arc:

nodes = mesh.GetSubMeshNodesId( arc, all=True )

segs = mesh.GetSubMeshElementsId( arc )

# make groups of nodes/segments of an arc:

import SMESH

nodeGroup = mesh.GroupOnGeom( arc, "ng", SMESH.NODE )

segGroup = mesh.GroupOnGeom( arc, "sg", SMESH.EDGE )

St.Michael

I think I did not describe my problem well. Let say I have combined two arcs to a wire which forms object A and another two different arcs combined to a wire which forms object B.

1. How do I have to combine them to form one single mesh problem

2. How do I differentiate between those two objects (A,B) in terms of nodes and segments afterwards

BR

AB = geompy.MakeCompound( [ A, B ])

A, B = geompy.SubShapeAll( AB, geompy.ShapeType["SHAPE"])

mesh = smesh.Mesh( AB )

hyp = mesh.Segment().NumberOfSegments(10,0.1)

mesh.Compute()

import SMESH

nodeGroupA = mesh.GroupOnGeom( A, "nA", SMESH.NODE )

nodesA = nodeGroupA.GetIDs()

segGroupB = mesh.GroupOnGeom( B, "sB", SMESH.EDGE )

segsB = segGroupB.GetIDs()

St.Michael

St.Michael,

one final thing: if object A or B is a is a wire, how do I get the two end-nodes of each?

BR

This is not so trivial.

segGroup = mesh.GroupOnGeom( A, "sA", SMESH.EDGE )

endNodes = []

for vertex in geompy.SubShapeAll( A, geompy.ShapeType["VERTEX"]):

vNodes = mesh.GetSubMeshNodesId( vertex, all=False )

segs = mesh.GetNodeInverseElements( vNodes[0] )

if len( segs ) == 1 or \

(segGroup.Contains( segs[0] ) and not segGroup.Contains( segs[1] )):

endNodes.append( vNodes[0] )

St.Michael