Showing results for 
Search instead for 
Did you mean: 

Save as a flat dxf file

Valued Contributor
Valued Contributor


Hi all

How in the blue blasers can i save a sheetmatal model as a flat pattern in dxf format. I can do this from opening each sheetmatal doc thru egde, I would like to be able to programaticly save several .psm docs into a folder for later use. Something like Object.SaveAsFlatDXF(FileName, Face, Edge, Vertex).


Thanks in anicipation




Posted by: Nev Ward
Post date: 11/9/2008 7:20:56 PM


RE: Save as a flat dxf file

Valued Contributor
Valued Contributor


I am developing a program which have a save as flat. The code i paste below.

For your program you have to make some changes, for questions you can send me an email




Dim objAppSolFLATTEN AsObject = Nothing

 Dim objDocsSolFLATTEN AsObject = Nothing

 Dim objectsolidedgeFLATTEN AsObject








 Dim objBodyFLATTEN As SolidEdgeGeometry.BodyDim objFaces As SolidEdgeGeometry.FacesDim objFace As SolidEdgeGeometry.FaceDim BiggestFace As SolidEdgeGeometry.FaceDim SelectedFace As SolidEdgeGeometry.FaceDim FirstEdge As SolidEdgeGeometry.EdgeDim objStartVertex As SolidEdgeGeometry.VertexDim objprop AsObject

 Dim objsummaryinfopropset AsObject

 Dim objsubjectproperty AsObject


 Dim igQueryAll As SolidEdgeConstants.FeatureTopologyQueryTypeConstants = 1Dim bestandsnaam AsString = filelocation & "\" & newfilename & ".dxf"

 Dim objDocSol AsString

 Dim strfname AsString = filelocation & "\" & newfilename & ".PSM"

 Dim MaxOpp AsDouble

objAppSolFLATTEN = GetObject(,

 "SolidEdge.Application")If objAppSolFLATTEN IsNothingThen

 'Start Solid Edge.

objAppSolFLATTEN = CreateObject(

objDocSol = objAppSolFLATTEN.Documents.Open(strfname)


 'documenten solid edge

objDocsSolFLATTEN = objAppSolFLATTEN.Documents

 If objDocsSolFLATTEN.Count = 0 Then

 'wanneer er geen part open is, open deze

objectsolidedgeFLATTEN = objAppSolFLATTEN.Documents.Open(strfname)


objectsolidedgeFLATTEN = objAppSolFLATTEN.ActiveDocument



objBodyFLATTEN = PlaatBestand.Models.Item(1).Body

 Dim PlaatBestand AsObject = objectsolidedgeFLATTEN'Grootste face bepalen

MaxOpp = 0


objFace = objBodyFLATTEN.Faces(FaceType:=igQueryAll).Item(t)

 For t = 1 To objBodyFLATTEN.Faces(FaceType:=igQueryAll).CountIf objFace.Area > MaxOpp Then

MaxOpp = objFace.Area

BiggestFace = objFace




FirstEdge = BiggestFace.Edges.Item(t)



objStartVertex = FirstEdge.StartVertex

objAppSolFLATTEN.DisplayAlerts = Next tFor t = 1 To BiggestFace.Edges.CountNext tFalse

PlaatBestand.Models.SaveAsFlatDXF(bestandsnaam, BiggestFace, FirstEdge, objStartVertex)

objAppSolFLATTEN.DisplayAlerts = True

objprop = objectsolidedgeFLATTEN.Properties

 'Access the SummaryInformation properties collection

objsummaryinfopropset = objprop(

 "extendedSummaryInformation")'Retrieve the Subject property.

objsubjectproperty = objsummaryinfopropset(

 "status")'Show the value of the property.

objsubjectproperty.VALUE = selectedstatus.Text


objStartVertex = Nothing

FirstEdge = Nothing

BiggestFace = Nothing

objFace = Nothing

objFaces = Nothing

objBodyFLATTEN = Nothing


Posted by: Matthijs Stege
Post date: 11/11/2008 10:12:51 PM

RE: Save as a flat dxf file

Valued Contributor
Valued Contributor

Thanks heaps. I'll let you know How I get On.


Posted by: Nev Ward
Post date: 11/12/2008 6:55:48 AM

RE: Save as a flat dxf file

Valued Contributor
Valued Contributor

Hi Matthijs,


Sounds like this works well for you. Would it be possible to add notes in the DXF like bend radius, thickness, sheet cut size in X an Y, Bend angles.... How would I start to investigate that?


The copy-paste of your code seems a little off in some places. Can you email me or post the file.




Posted by: Martin B
Post date: 3/31/2010 3:33:10 PM

RE: Save as a flat dxf file

Valued Contributor
Valued Contributor



I've written similar code, but I've got one problem. When a surface is completelyround, there is an edge, but there is no Vertex on the face.

Consequently the .dxf can not be made since objVertex = nothing.

Is there a posibility to Add a vertex? Has anyone got experience with this problem?

Thanks is Advance,



Public Sub SaveAsFlat()

'On Error Resume Next


    Dim objApp As SolidEdgeFramework.Application

    Dim objDoc As SolidEdgePart.SheetMetalDocument

    Dim MaxSurf As Double

    Dim objModels As SolidEdgePart.Models

    Dim objModel As SolidEdgePart.Model

    Dim objBody As SolidEdgeGeometry.Body

    Dim objShells As SolidEdgeGeometry.Shells

    Dim objShell As SolidEdgeGeometry.Shell

    Dim objFaces As SolidEdgeGeometry.Faces

    Dim objFace As SolidEdgeGeometry.Face

    Dim objEdges As SolidEdgeGeometry.Edges

    Dim objEdge As SolidEdgeGeometry.Edge

    Dim objBiggestFace As SolidEdgeGeometry.Face

    Dim objVertex As SolidEdgeGeometry.Vertex

    Dim strPrompt As String

    Dim ExitLoop As Boolean

    Dim strFilenameDXF As String


    Set objApp = GetObject(, "SolidEdge.Application")

    Set objDoc = objApp.ActiveDocument

    Set objModels = objDoc.Models


    strFilenameDXF = "C:/Temp/Test.dxf"

    MaxSurf = 0


'Get references

    For Each objModel In objModels

        If objModel.Name = "Design Model" Then

            Set objBody = objModel.Body

            Set objShells = objBody.Shells

            Set objShell = objShells.Item(0)

            Set objFaces = objShell.Faces

            For Each objFace In objFaces

                If objFace.Area > MaxSurf Then

                    MaxSurf = objFace.Area

                    Set objBiggestFace = objFace

                End If


            Set objEdges = objBiggestFace.Edges


            Set objVertex = Nothing

            For Each objEdge In objEdges

                Set objVertex = objEdge.StartVertex

                If objVertex Is Nothing Then

                    ExitLoop = False


                    ExitLoop = True

                    Exit For

                    ExitLoop = True

                End If



            Set objEdge = objEdges.Item(0) 'Take the first Edge (most stable for me)

        End If


'Save As Flat

    If objVertex Is Nothing Then

        MsgBox "No vertex found!"


        Call objModels.SaveAsFlatDXF(strFilenameDXF, objBiggestFace, objEdge, objVertex)

    End If

End Sub


Posted by: Wouter Sloof
Post date: 4/6/2010 2:54:55 AM