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: 

API to export a Parasolid file

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
946 Views, 4 Replies

API to export a Parasolid file

i have been using WriteDataToFile to export an ACIS SAT file but, unfortunately, this function does not support Parasolid. Is there an alternate way for me to export a Parasolid file in lieu of using WriteDataToFile?

 

thanks

 

4 REPLIES 4
Message 2 of 5
arsenii_yavtushenko
in reply to: Anonymous

Hello,

 

I don't know if you still need this, but you can use an Inventor Translation AddIn to export a Parasolid file.

Hope it will help you out!

Public Sub CreateX_T()

  'This TranslatorAddIn will export a *.X_T file, you can try searching in the VBA object browser for other AddIns
 Dim X_TAddIn As TranslatorAddIn
 Set X_TAddIn = ThisApplication.ApplicationAddIns.ItemById("{8F9D3571-3CB8-42F7-8AFF-2DB2779C8465}")
    
  'Set a reference to the active document (the document to be published).
 Dim oDoc As Document
 Set oDoc = ThisApplication.ActiveDocument
Dim oContext As TranslationContext Set oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = kFileBrowseIOMechanism 'Create a NameValueMap object Dim oOptions As NameValueMap Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap 'Create a DataMedium object Dim oDataMedium As DataMedium Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium 'FullFileName of exported file oDataMedium.FileName = "c:\temptest.x_t" 'Publish document. Call X_TAddIn.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium) End Sub

 

Message 3 of 5

With some changes, the code works great. Is it possible to add the option to define the version? Inventor 2020 will choose version 31. Some clients, such as those using previous versions of SolidWorks cannot open a version 31 file, so a previous version must be selected.

 

TIA

Message 4 of 5

Hello,

 

It seems like I was able to find a solution to your problem: just add a highlighted code to your program. You can replace number 11 with the version that works for you. Inventor 2016 supports versions from 9 to 27.

 

Public Sub CreateX_T()

  'This TranslatorAddIn will export a *.X_T file, you can try searching in the VBA object browser for other AddIns
 Dim X_TAddIn As TranslatorAddIn
 Set X_TAddIn = ThisApplication.ApplicationAddIns.ItemById("{8F9D3571-3CB8-42F7-8AFF-2DB2779C8465}")
    
  'Set a reference to the active document (the document to be published).
 Dim oDoc As Document
 Set oDoc = ThisApplication.ActiveDocument

 Dim oContext As TranslationContext
 Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
 oContext.Type = kFileBrowseIOMechanism
  
  'Create a NameValueMap object
 Dim oOptions As NameValueMap
 Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
  
  'Create a DataMedium object
 Dim oDataMedium As DataMedium
 Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
  
 ' Check whether the translator has 'SaveCopyAs' options
 If X_TAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
' Options for files... oOptions.Value("Version") = 11 ' Export file version: from 9 to 27
End If 'FullFileName of exported file oDataMedium.FileName = "c:\temptest.x_t" 'Publish document. Call X_TAddIn.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium) End Sub

Hope this helps!

Message 5 of 5

Thank you!

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report