Message 1 of 4
change the thickness
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I have been trying to change the thickness of the .ipt that are inside a sub assembly in the main assembly but as much as I try with this code it doesn't send ethickness the .ipt, I don't know if someone could guide me in my code or if you have managed to do it in another way.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
' Prompt the user to input a new thickness
Dim newThickness As String
newThickness = InputBox("Enter new thickness (in mm):", "Sheet Metal Thickness", "2.0")
If newThickness = "" Then Exit Sub
' Iterate through occurrences to change the thickness of sheet metal parts
For Each oOcc As ComponentOccurrence In oAsmCompDef.Occurrences.AllLeafOccurrences
If Not oOcc.Name.Contains("_I") Then Continue For
If Not oOcc.Definition.Document.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Continue For
If Not oOcc.Definition.Document.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Continue For
Dim oDoc As PartDocument = oOcc.Definition.Document
' Check if the part is a sheet metal part
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
If oCompDef.Document.SubType = "{7BA0531A-93FA-11D4-8FA8-0010B541CD80}" Then ' Sheet Metal SubType
' Access the thickness parameter and set the new value
Dim oThicknessParam As Parameter = oCompDef.Parameters.Item("Sheet Metal Thickness")
oThicknessParam.Value = ThisApplication.UnitsOfMeasure.ConvertUnits(newThickness, UnitsTypeEnum.kMillimeterLengthUnits, oThicknessParam.Units)
End If
Next
iLogicVb.UpdateWhenDone = True