Inventor iLogic - Expose Thickness
Hình ảnh kết quả
Một số member trong nhóm Zalo của mình có đề cập việc tạo giá trị Thickness để xuất ra BOM, nhưng chưa biết làm sao. Nay mình chia sẻ một đoạn code iLogic giúp giải quyết vấn đề này.
- Chạy rule từ Assembly để xử lý hàng loạt các file được tham chiếu.
- Xuất giá trị Thickness từ Parameter sang Custom iProperties.
- Dùng giá trị này để Export BOM hoặc tạo Parts List bên Drawing.
iLogic Rule - Expose Thickness
Copy đoạn code dưới đây vào một iLogic Rule và chạy từ Assembly.
' <FireOthersImmediately>False</FireOthersImmediately>
Dim oAsm As AssemblyDocument = ThisDoc.Document
For Each oRefDoc As Document In oAsm.AllReferencedDocuments
If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Or oRefDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject AndAlso _
oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc).Count > 0
On Error Resume Next
If oRefDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
'MessageBox.Show(oRefDoc.DisplayName, "Assembly name")
Else
'MessageBox.Show(oRefDoc.DisplayName, "Part name")
Dim oPartDoc As PartDocument = oRefDoc
oPartDoc.ComponentDefinition.Parameters.Item("Thickness").ExposedAsProperty = True
End If
End If
Next
MessageBox.Show("Hoàn tất quá trình thêm thuộc tính!!!", "iLogic - Make by Dai Tech (0911477755)")