去评论
距米网-精简版

使用Inventor iLogic自动将三维图转换成stp格式的文件

JUMU
2022/05/05 22:03:06
使用Inventor iLogic自动将三维图转换成stp格式的文件,代码如下:
  1. ' Get the STEP translator Add-In.
  2. Dim oSTEPTranslator As TranslatorAddIn
  3. oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")
  4. Dim oContext As TranslationContext
  5. oContext = ThisApplication.TransientObjects.CreateTranslationContext
  6. Dim oOptions As NameValueMap
  7. oOptions = ThisApplication.TransientObjects.CreateNameValueMap

  8. If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
  9.     ' Set application protocol.
  10.     ' 2 = AP 203 - Configuration Controlled Design
  11.     ' 3 = AP 214 - Automotive Design
  12.     oOptions.Value("ApplicationProtocolType") = 3
  13.     ' Other options...
  14.     'oOptions.Value("Author") = ""
  15.     'oOptions.Value("Authorization") = ""
  16.     'oOptions.Value("Description") = ""
  17.     'oOptions.Value("Organization") = ""
  18.     oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
  19.     Dim oData As DataMedium
  20.     oData = ThisApplication.TransientObjects.CreateDataMedium
  21.     oData.FileName = ThisDoc.PathAndFileName(False) & ".stp"
  22. oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData)
  23. End If