Extracting information of imported lines from a .stp file

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

Hello Everybody!

 

I could really use some help with a problem I encountered:

1) Situation:
I receive a *.stp file, containing a closed and open contours (All of them 2D lines). Its basically a 2D drawing exported to stp, which I now import into a SolidEdge Part environment.

 

So when I open this stp in Solid Edge in a Part environment, it gets imported just fine (As SolidEdgePart.ConstructionModel items contained in SolidEdgePart.Constructions), either as one big PartCopy containing all line elements (Import options -> Group curves in a single Part Copy: ON), or as one PartCopy element for each imported line/arc/curve.

 

2) Issue:

Now what i need to do, is get the type (Is the element an arc, or a line, maybe a curve?) the start, and end coordinates of their keypoints of the 2D line elements. Thats all.

 

Bad Solution:

If i create a sketch, and use the "Project to Sketch" command to project those imported curves. This way i have nicely sorted arcs, lines curves with all their keypoints to use.

 

How do i get those infos, wihtout having the user first make a Project to Sketch?

 

Please let me know if you have any ideas/suggestions. 

 

Regards

 

Thomas

1 REPLY

Re: Extracting information of imported lines from a .stp file

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

Alright,

 

I got the answer form the Solid Edge devs, in form of an example Code. Just in case somebody is going to need a method for the above question, here is the solution example-code:

 

Sub Main()
   Dim objApp As SolidEdgeFramework.Application
   Dim objDoc As SolidEdgePart.PartDocument
   Dim objCopyConstructions As SolidEdgePart.CopyConstructions
   Dim objEdges As SolidEdgeGeometry.Edges
   Dim objCopyConstruction As SolidEdgePart.CopyConstruction
   Dim objEdge As SolidEdgeGeometry.Edge
   Dim edgeType As SolidEdgeGeometry.GNTTypePropertyConstants
   Dim startPoint(3) As Double
   Dim endPoint(3) As Double
   Dim bEdge As Boolean

   objApp = GetObject(, "SolidEdge.Application")
   If (objApp Is Nothing) Then Exit Sub

   objDoc = objApp.ActiveDocument
   If (objDoc Is Nothing) Then Exit Sub

   objCopyConstructions = objDoc.Constructions.CopyConstructions
   If (objCopyConstructions Is Nothing) Then Exit Sub

   objCopyConstruction = objCopyConstructions.Item(1)
   If (objCopyConstruction Is Nothing) Then Exit Sub

   objEdges =       objCopyConstruction.Edges(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll)
   If (objEdges Is Nothing) Then Exit Sub

   objEdge = objEdges.Item(1)
   If (objEdge Is Nothing) Then Exit Sub

   edgeType = objEdge.Type

   If (edgeType = SolidEdgeGeometry.GNTTypePropertyConstants.igEdge) Then
      bEdge = True
   End If

   objEdge.GetEndPoints(startPoint, endPoint)

End Sub

 

Thomas