Personal tools
You are here: Home Forum Use arc to polyline how to?

arc to polyline how to?

Up to Use

arc to polyline how to?

Posted by millim at September 19. 2013

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

Re: arc to polyline how to?

Posted by Saint Michael at September 19. 2013

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

Re: arc to polyline how to?

Posted by millim at September 23. 2013

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.

Re: arc to polyline how to?

Posted by Saint Michael at September 23. 2013

Enjoy!

St.Michael

Attachments

Re: arc to polyline how to?

Posted by millim at September 23. 2013

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 

Re: arc to polyline how to?

Posted by Saint Michael at September 23. 2013

# 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

Re: arc to polyline how to?

Posted by millim at September 23. 2013

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

 

 

 

 

Re: arc to polyline how to?

Posted by Saint Michael at September 23. 2013

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

Re: arc to polyline how to?

Posted by millim at September 23. 2013

Great Thx! Sir St.Michael!

Re: arc to polyline how to?

Posted by millim at September 23. 2013

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

Re: arc to polyline how to?

Posted by Saint Michael at September 24. 2013

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

Re: arc to polyline how to?

Posted by millim at September 24. 2013

Thx!

you are really a envoy of the kings. Worked like a charm.

BR

 

Powered by Ploneboard
Document Actions