Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Step translator to dwg translator

0 REPLIES 0
Reply
Message 1 of 1
cgoethalsFU8PY
73 Views, 0 Replies

Step translator to dwg translator

Dear community,

 

Can someone help me with turning the code below (bulk exporter for step-files) into a bulk exporter for dwg files?

 

Best regards,

Cor

Sub main()
    Dim oSTEPTranslator As TranslatorAddIn
    Dim oContext As TranslationContext
    Dim oOptions As NameValueMap
    Dim oDataMedium As DataMedium

    Call ConfigureoSTEPTranslatorSettings(oSTEPTranslator, oContext, oOptions, oDataMedium)

    Dim oFileDlg As Inventor.FileDialog = Nothing
    InventorVb.Application.CreateFileDialog(oFileDlg)
    'oFileDlg.Filter = "Inventor Files (*.iam)|*.iam"
    oFileDlg.DialogTitle = "Delete Ilogic Rule in drawing"
    oFileDlg.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.FullFileName ' ThisDoc.Path
    oFileDlg.MultiSelectEnabled = True
    'oFileDlg.FilterIndex = 1
    oFileDlg.CancelError = True
    On Error Resume Next
    oFileDlg.ShowOpen()
    If Err.Number <> 0 Then
        MessageBox.Show("File not chosen.", "Dialog Cancellation")
    ElseIf oFileDlg.FileName <> "" Then
        For Each wrd In oFileDlg.FileName.Split("|") 'Words
            Dim odoc As Document = ThisApplication.Documents.Open(wrd, True)
			Dim oPath As String = System.IO.Path.GetDirectoryName(odoc.FullFileName)
            Dim sSubject As String = odoc.PropertySets.Item(1).Item("Subject").Value
			Dim sRevisionNumber As String = odoc.PropertySets.Item(1).Item("Revision Number").Value
			Dim sFileNameWOExt As String = System.IO.Path.GetFileNameWithoutExtension(odoc.FullFileName)
            oDataMedium.FileName = oPath & "\" & sSubject & " - " & sFileNameWOExt & "_" & sRevisionNumber & ".stp"
            Call oSTEPTranslator.SaveCopyAs(odoc, oContext, oOptions, oDataMedium)
            odoc.Close
        Next
    End If
    MessageBox.Show("STEP-Export geslaagd.")
End Sub

Sub ConfigureoSTEPTranslatorSettings(ByRef oSTEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)
    oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")
    oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
    oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
    oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
End Sub

 

 

Best regards 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report