Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi every one.
I would very appreciate if some one can help me small things.
I would like to get quantity of bend number in the sheet metal part. But that need to be automatically update from the total 3D assembly file. I have many rule, after i finish 3D drawing i just need to click Regenerate all rule => The bending quantity of all part will come inside each part.
i have code work with only single part. If i Regenerate from asssembly, that will not work. MANY THANK
'If ThisApplication.ActiveDocumentType() <> kAssemblyDocumentObject 'MsgBox("You would have better luck if you ran this from an assembly document.") 'Dim oAsmCompDef As AssemblyComponentDefinition 'oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then 'MsgBox("A Part Document must be active for this rule to work. Exiting.",vbCritical, "WRONG DOCUMENT TYPE") 'Exit Sub 'End If Dim oPDoc As PartDocument = ThisApplication.ActiveDocument 'If Not TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then 'MsgBox("This Part is not a Sheet Metal Part. Exiting rule.",,"") 'Exit Sub 'End If Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition Dim oBends As Integer = oSMDef.Bends.Count 'MsgBox("This Sheet Metal Part has: " & oBends & " 'Bends'.", vbInformation, "bend_number") Dim oUParams As UserParameters = oSMDef.Parameters.UserParameters Dim oUParam As UserParameter 'Try oUParam = oUParams.Item("bend_number") oUParam.Value = oBends iLogicVb.UpdateWhenDone = True InventorVb.DocumentUpdate() MultiValue.UpdateAfterChange = True Parameter.UpdateAfterChange = True 'Catch 'oUParam = oUParams.AddByValue("bend_number", oBends, UnitsTypeEnum.kUnitlessUnits) 'End Try
Solved! Go to Solution.