Exporting only solid bodies as STEP file using API

Exporting only solid bodies as STEP file using API

darryl.menezes
Contributor Contributor
343 Views
0 Replies
Message 1 of 1

Exporting only solid bodies as STEP file using API

darryl.menezes
Contributor
Contributor

Hello,

 I am trying to export only solid bodies from a part file into a STEP file using API. But as my file consists of sketches and surfaces along with solids, even the sketches and surfaces are exported along with the solid bodies. Is there anyway to export only the solid, and filter any sketches or surfaces? Thank you.

 

This is the code that I am using, which is directly copied from the samples.

 

Public Sub ExportToSTEP()
    ' Get the STEP translator Add-In.
    Dim oSTEPTranslator As TranslatorAddIn
    Set oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

    If oSTEPTranslator Is Nothing Then
        MsgBox "Could not access STEP translator."
        Exit Sub
    End If

    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
        
        oOptions.Value("ApplicationProtocolType") = 2

        

        oContext.Type = kFileBrowseIOMechanism

        Dim oData As DataMedium
        Set oData = ThisApplication.TransientObjects.CreateDataMedium
        oData.FileName = "C:\temptest.stp"

        Call oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData)
    End If
End Sub
0 Likes
344 Views
0 Replies
Replies (0)