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: 

iLogic - create rule to save copy as parasolid (x_t) file with 24 version

1 REPLY 1
Reply
Message 1 of 2
milton.rocha
1256 Views, 1 Reply

iLogic - create rule to save copy as parasolid (x_t) file with 24 version

     With Inventor 2013 the default x_t files were saved in version 24, but now, with Inventor 2014, the default x_t file is saved in version 25. I am trying to make a rule to save it with version 24 because I need to send it to CAM software that works only with this version.

     My problem is to reach/know what is the syntax that I need to use to set the version. The rule is on this way:

'

'Save Text Parasolid - _xt version 24
path_and_namext = ThisDoc.PathAndFileName(False)
xtAddIn = ThisApplication.ApplicationAddIns.ItemById("{A8F8F8E5-BBAB-4f74-8B1B-AC011251F8AC}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
If xtAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
oOptions.Value("X_TVersion") = 24
End If
'Set the destination file name
oDataMedium.FileName = path_and_namext & ".x_t"
'Publish document.
Call xtAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Exit Sub

'

It works, but does not set the version - I don't know what is the syntax to set the red line above.

What is the correct syntax that I can use to define 24 version (or other...)?
Is there something wrong with the rule?
...I need some help...
Thanks.

1 REPLY 1
Message 2 of 2

Try

 

oOptions.Value("Version") = 24

 

You can retrieve translator save option by running VBA code and looking the results in immediate window:

 

'Translator: DWF:{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}
'Translator: PDF:{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}
'Translator: DWFx:{0AC6FD97-2F4D-42CE-8BE0-8AEA580399E4}
'Translator: SolidWorks:{402BE503-725D-41CB-B746-D557AB83BAF1}
'Translator: Pro/ENGINEER:{46D96B7A-CF8A-49C9-8703-2F40CFBDF547}
'Translator: STL:{533E9A98-FC3B-11D4-8E7E-0010B541CD80}
'Translator: Pro/ENGINEER Granite:{66CB2667-73AD-401C-A531-64EC701825A1}
'Translator: SAT:{89162634-02B6-11D5-8E80-0010B541CD80}
'Translator: Pro/ENGINEER Neutral:{8CEC09E3-D638-4E8F-A6E1-0D1E1A5FC8E3}
'Translator: Parasolid Text:{8F9D3571-3CB8-42F7-8AFF-2DB2779C8465}
'Translator: STEP:{90AF7F40-0C01-11D5-8E83-0010B541CD80}
'Translator: IGES:{90AF7F44-0C01-11D5-8E83-0010B541CD80}
'Translator: UGS NX:{93D506C4-8355-4E28-9C4E-C2B5F1EDC6AE}
'Translator: Parasolid Binary:{A8F8F8E5-BBAB-4F74-8B1B-AC011251F8AC}
'Translator: DWG:{C24E3AC2-122E-11D5-8E91-0010B541CD80}
'Translator: DXF:{C24E3AC4-122E-11D5-8E91-0010B541CD80}
'Translator: JT:{16625A0E-F58C-4488-A969-E7EC4F99CACD}

Public Sub GetTranslatorSaveAsOptions()

    Dim clsId As String
    clsId = "{8F9D3571-3CB8-42F7-8AFF-2DB2779C8465}"

    Dim oTranslator As TranslatorAddIn
    Set oTranslator = ThisApplication.ApplicationAddIns.ItemById(clsId)
    
    Dim Context As TranslationContext
    Set Context = ThisApplication.TransientObjects.CreateTranslationContext
    Context.Type = kFileBrowseIOMechanism
    
    Dim options As NameValueMap
    Set options = ThisApplication.TransientObjects.CreateNameValueMap
    
    Dim sourceObject As Object
    Set sourceObject = ThisApplication.ActiveDocument

    Dim index As Integer
    If oTranslator.HasSaveCopyAsOptions(sourceObject, Context, options) Then
    
        For index = 1 To options.count
            Debug.Print options.name(index) & " = " & options.value(options.name(index))
        Next
        
    End If

End Sub

 Outputs this:

 

IncludeSketches = True

Version = 25

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report