[Inventor]
使用iLogic在装配体中增加零部件
- Dim sExcelFileName As String = "Pippo.xlsx"
- Dim oPath As String
- Dim Row2 As String '= Row
- Dim Rowchange2 As String '= Rowchange
- Dim text2 As String = x1
- Dim text3 As String = x1
- 'file path to use
- oPath = ThisDoc.Path & ""
- 'file to use
- oFile = "40050457.ipt"
- ' set a reference to the assembly component definintion.
- ' This assumes an assembly document is open.
- Dim oAsmCompDef As AssemblyComponentDefinition
- oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
- ' These four lines create a matrix, which has default values scale 1 and pos 0,0,0
- Dim oTG As TransientGeometry
- oTG = ThisApplication.TransientGeometry
- Dim oMatrix As Matrix
- oMatrix = oTG.CreateMatrix
- 'Iterate through all of the occurrences
- Dim oOccurrence As ComponentOccurrence
- Dim i As Integer
- For i = 2 To 6
- ' Form the cell address
- text2="C" + String.Format(i,"#")
- oFile = GoExcel.CellValue(sExcelFileName, "Sheet1",text2)
- 'place an instance of the component
- 'in this case at 0,0,0
- oOccurrence = oAsmCompDef.Occurrences.Add(oPath & oFile, oMatrix)
- oOccurrence.Grounded = False
- Next
复制代码
|
|
|
|
|