Personal tools
You are here: Home Forum Use Looking for a Python command

Looking for a Python command

Up to Use

Looking for a Python command

Posted by Nigirim at October 26. 2012

Hi all,

to keep it short Im looking for a command in Python that is able to search along an edge

for intersectionpoints.

So if I have an edge or line with intersections like this:

_____I______I__

Note: I do NOT know the coordinates of the intersections because they come form an .stp file.

So Im looking for a command that walks along the line and finds all points and writes them out so I can use it later on.

I hope there is a command or a small script

 

If there is something that is hard to understand just ask me, my englisch isnt the best :D

 

Greets

Nigirim

Re: Looking for a Python command

Posted by Saint Michael at October 26. 2012

Hi Nigirim

In terms of SALOME, If a curve has been intersected, it is represented as a Wire composed of Edges, where each Edge is bound by intersection points (Vertices) and end points of the curve.
Thus a task is to get all Vertices from the Wire and find out their coordinates. Here is code doing this.

vertices = geompy.SubShapeAllSorted( Wire, geompy.ShapeType["VERTEX"]) # get all vertices from the Wire
for v in vertices[1:-1]: # loop on all but first and last vertices
  print geompy.PointCoordinates( v )

St.Michael

 

Re: Looking for a Python command

Posted by Nigirim at October 26. 2012

Previously Saint Michael wrote:

Hi Nigirim

In terms of SALOME, If a curve has been intersected, it is represented as a Wire composed of Edges, where each Edge is bound by intersection points (Vertices) and end points of the curve.
Thus a task is to get all Vertices from the Wire and find out their coordinates. Here is code doing this.

vertices = geompy.SubShapeAllSorted( Wire, geompy.ShapeType["VERTEX"]) # get all vertices from the Wire
for v in vertices[1:-1]: # loop on all but first and last vertices
  print geompy.PointCoordinates( v )

St.Michael

 

Hi St.Micheal

Thanks for your fast answer to my question.

 

Greets

 Nigirim

Powered by Ploneboard
Document Actions