Hi,
I wish to create a macro for to export my parts and assemblies in STEP files.
I tried to restart of the macro "PDF" (see attached file), but without success.
Where can I find the "key" of the ItemByID("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx}")
Like this :
Set PDFAddin = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Thanks by advance
Solved! Go to Solution.
Solved by VdVeek. Go to Solution.
Hi,
this is a simple Ilogic rule that list all available addins
List = "" For Each addin In ThisApplication.ApplicationAddIns If TypeOf addin Is TranslatorAddIn Then List &= addin.DisplayName & addin.ClassIdString & vbCr End If Next MsgBox(List)
Bregs
Rossano Praderi
Hi,
Did Rossano code help you with your problem?
It seems to feedback the information you was requesting.
Jon.
There is an example in the API Programming Help under TranslatorAddIn Interface. See Example 5 Export to STEP.
Rob.
I want to export with the filename of the part, but it's doesn't work.
Below my macro VBA, stopped at "FileName = oDocument.FullFileName"
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 ' Set application protocol. ' 2 = AP 203 - Configuration Controlled Design ' 3 = AP 214 - Automotive Design oOptions.Value("ApplicationProtocolType") = 3 ' Other options... 'oOptions.Value("Author") = "" 'oOptions.Value("Authorization") = "" 'oOptions.Value("Description") = "" 'oOptions.Value("Organization") = "" oContext.Type = kFileBrowseIOMechanism 'Set filename as original document filename. Dim FileName As String FileName = oDocument.FullFileName Dim Temp() As String Temp = Split(FileName, "\") FileName = Left(Temp(UBound(Temp)), Len(Temp(UBound(Temp))) - 4) 'Set the destination to save files. Dim oDocRevision As Property Dim Revision As String Set oDocRevision = oDocument.PropertySets.Item("Inventor Summary Information").Item("Revision Number") If oDocRevision.Value = "" Then oDataMedium.FileName = "C:\Users\amn\Desktop\" & FileName & ".stp" Else Revision = "_" + CStr(oDocRevision.Value) oDataMedium.FileName = "C:\Users\amn\Desktop\" & FileName & Revision & ".stp" End If Dim oData As DataMedium Set oData = ThisApplication.TransientObjects.CreateDataMedium 'Publish document. Call oSTEPTranslator.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) End If End Sub
In the line where the error occurred, you are referring to oDocument but you didn't create the oDocument in your code.
If you create the oDocument and Set it to the active document than the code should work.
'Set filename as original document filename. Dim oDocument As PartDocument Set oDocument = ThisApplication.ActiveDocument Dim FileName As String FileName = oDocument.FullFileName
Rob.
Dear all,
I need a macro to export a specific representation view to STP, not the whole model.
How can I do that with the macro ?
Kind regards
Rolf
Hah. Don't think you can. Probably have to make a new .iam that only contains those components that match that view rep and export that.