[Inventor] 使用iLogic在装配体中增加零部件

JUMU实名认证 发表于 2021-06-17 22:06 | 显示全部楼层 | 复制链接分享      上一主题  翻页  下一主题
  1. Dim sExcelFileName As String = "Pippo.xlsx"
  2. Dim oPath As String
  3. Dim Row2 As String '= Row
  4. Dim Rowchange2 As String '= Rowchange
  5. Dim text2 As String = x1
  6. Dim text3 As String = x1
  7. 'file path to use
  8. oPath = ThisDoc.Path & ""
  9. 'file to use
  10. oFile = "40050457.ipt"
  11. ' set a reference to the assembly component definintion.
  12. ' This assumes an assembly document is open.
  13. Dim oAsmCompDef As AssemblyComponentDefinition
  14. oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
  15. ' These four lines create a matrix, which has default values scale 1 and pos 0,0,0
  16. Dim oTG As TransientGeometry
  17. oTG = ThisApplication.TransientGeometry
  18. Dim oMatrix As Matrix
  19. oMatrix = oTG.CreateMatrix
  20. 'Iterate through all of the occurrences
  21. Dim oOccurrence As ComponentOccurrence

  22. Dim i As Integer
  23. For i = 2 To 6
  24.    ' Form the cell address
  25.    text2="C" + String.Format(i,"#")
  26.        oFile = GoExcel.CellValue(sExcelFileName, "Sheet1",text2)
  27.   'place an instance of the component
  28.   'in this case at 0,0,0
  29.   oOccurrence = oAsmCompDef.Occurrences.Add(oPath & oFile, oMatrix)
  30.   oOccurrence.Grounded = False
  31. Next
复制代码


  距米网  

找到您想要的设计

工程师、学生在线交流学习平台
关注我们

手机版- 距米网 |苏公网安备32041102000587号

© 2017-2024 常州居居米智能技术有限公司 苏ICP备18040927号-1