Sheet Metal Style Display
Description
This sample illustrates getting information about sheet metal styles.
Code Samples
Public Sub SheetMetalStyleDisplay()
' Set a reference to the sheet metal document.
' This assumes a part document is active.
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
' Make sure the document is a sheet metal document.
If oPartDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
MsgBox "A sheet metal document must be open."
Exit Sub
End If
' Get the sheet metal component definition. Because this is a part document whose
' sub type is sheet metal, the document will return a SheetMetalComponentDefinition
' instead of a PartComponentDefinition.
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
Set oSheetMetalCompDef = oPartDoc.ComponentDefinition
' Display then name of the active style.
Debug.Print "Active Sheet Metal Style: " & oSheetMetalCompDef.ActiveSheetMetalStyle.Name
' Iterate through the sheet metal styles.
Debug.Print ""
Debug.Print "Sheet Metal Styles"
Dim oStyle As SheetMetalStyle
On Error Resume Next
For Each oStyle In oSheetMetalCompDef.SheetMetalStyles
Debug.Print " " & oStyle.Name
Debug.Print " In Use: " & oStyle.InUse
Debug.Print " Up to Date: " & oStyle.UpToDate
Select Case oStyle.StyleLocation
Case kBothStyleLocation
Debug.Print " Style Location: Both Local and in Library"
Case kLibraryStyleLocation
Debug.Print " Style Location: Library"
Case kLocalStyleLocation
Debug.Print " Style Location: Local"
End Select
Debug.Print " Bend Radius: " & oStyle.BendRadius
Debug.Print " Bend Relief Depth: " & oStyle.BendReliefDepth
Debug.Print " Bend Relief Width: " & oStyle.BendReliefWidth
Select Case oStyle.BendReliefShape
Case kRoundBendReliefShape
Debug.Print " Bend Relief Shape: Round"
Case kStraightBendReliefShape
Debug.Print " Bend Relief Shape: Straight"
End Select
Select Case oStyle.BendTransition
Case kArcBendTransition
Debug.Print " Bend Transition: Arc"
Case kDefaultBendTransition
Debug.Print " Bend Transition: Default"
Case kIntersectionBendTransition
Debug.Print " Bend Transition: Intersection"
Case kNoBendTransition
Debug.Print " Bend Transition: None"
Case kStraightLineBendTransition
Debug.Print " Bend Transition: Straight Line"
Case kTrimToBendBendTransition
Debug.Print " Bend Transition: Trim to Bend"
End Select
Debug.Print " Bend Transition Arc Radius: " & oStyle.BendTransitionArcRadius
Debug.Print " Corner Relief Size: " & oStyle.CornerReliefSize
Select Case oStyle.CornerReliefShape
Case kArcWeldCornerReliefShape
Debug.Print " Corner Relief Shape: Arc Weld"
Case kDefaultCornerReliefShape
Debug.Print " Corner Relief Shape: Default"
Case kFullRoundCornerReliefShape
Debug.Print " Corner Relief Shape: Full Round"
Case kIntersectionCornerReliefShape
Debug.Print " Corner Relief Shape: Intersection"
Case kLinearWeldReliefShape
Debug.Print " Corner Relief Shape: Linear Weld"
Case kNoReplacementCornerReliefShape
Debug.Print " Corner Relief Shape: No Replacement"
Case kRoundCornerReliefShape
Debug.Print " Corner Relief Shape: Round"
Case kRoundWithRadiusCornerReliefShape
Debug.Print " Corner Relief Shape: Round with Radius"
Case kSquareCornerReliefShape
Debug.Print " Corner Relief Shape: Square"
Case kTearCornerReliefShape
Debug.Print " Corner Relief Shape: Tear"
Case kTrimToBendReliefShape
Debug.Print " Corner Relief Shape: Trim"
End Select
Debug.Print " Corner Relief Size: " & oStyle.ThreeBendCornerReliefSize
Select Case oStyle.ThreeBendCornerReliefShape
Case kArcWeldCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Arc Weld"
Case kDefaultCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Default"
Case kFullRoundCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Full Round"
Case kIntersectionCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Intersection"
Case kLinearWeldReliefShape
Debug.Print " Three Bend Corner Relief Shape: Linear Weld"
Case kNoReplacementCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: No Replacement"
Case kRoundCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Round"
Case kRoundWithRadiusCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Round with Radius"
Case kSquareCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Square"
Case kTearCornerReliefShape
Debug.Print " Three Bend Corner Relief Shape: Tear"
Case kTrimToBendReliefShape
Debug.Print " Three Bend Corner Relief Shape: Trim"
End Select
Debug.Print " Material: " & oStyle.Material.Name
Debug.Print " Minimum Remnant: " & oStyle.MinimumRemnant
Debug.Print " Thickness: " & oStyle.Thickness
Select Case oStyle.PunchRepresentationType
Case k2DSketchAndCenterMarkPunchRepresentation
Debug.Print " Punch Representation Type: 2D Sketch and Center Mark"
Case k2DSketchPunchRepresentation
Debug.Print " Punch Representation Type: 2D Sketch"
Case kCentermarkPunchRepresentation
Debug.Print " Punch Representation Type: Center Mark"
Case kDefaultPunchRepresentation
Debug.Print " Punch Representation Type: Default"
Case kFormedFeaturePunchRepresentation
Debug.Print " Punch Representation Type: Formed Feature"
End Select
Debug.Print " Unfold Method: " & oStyle.UnfoldMethod.Name
Next
' Display information about the unfold methods.
Debug.Print ""
Debug.Print "Unfold Methods"
Dim oUnfoldMethod As UnfoldMethod
For Each oUnfoldMethod In oSheetMetalCompDef.UnfoldMethods
Debug.Print " " & oUnfoldMethod.Name
Debug.Print " In Use: " & oUnfoldMethod.InUse
Debug.Print " Up to Date: " & oUnfoldMethod.UpToDate
Select Case oUnfoldMethod.StyleLocation
Case kBothStyleLocation
Debug.Print " Location: Both Local and in Library"
Case kLibraryStyleLocation
Debug.Print " Location: Library"
Case kLocalStyleLocation
Debug.Print " Location: Local"
End Select
Select Case oUnfoldMethod.UnfoldMethodType
Case kBendTableUnfoldMethod
Debug.Print " Unfold Method Type: Bend Table"
Case kLinearUnfoldMethod
Debug.Print " Unfold Method Type: Linear"
End Select
Debug.Print " kFactor: " & oUnfoldMethod.kFactor
Next
End Sub
' Set a reference to the sheet metal document.
' This assumes a part document is active.
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument
' Make sure the document is a sheet metal document.
If oPartDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
MsgBox("A sheet metal document must be open.")
Exit Sub
End If
' Get the sheet metal component definition. Because this is a part document whose
' sub type is sheet metal, the document will return a SheetMetalComponentDefinition
' instead of a PartComponentDefinition.
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
oSheetMetalCompDef = oPartDoc.ComponentDefinition
' Display then name of the active style.
Logger.Info("Active Sheet Metal Style: " & oSheetMetalCompDef.ActiveSheetMetalStyle.Name)
' Iterate through the sheet metal styles.
Logger.Info("")
Logger.Info("Sheet Metal Styles")
Dim oStyle As SheetMetalStyle
On Error Resume Next
For Each oStyle In oSheetMetalCompDef.SheetMetalStyles
Logger.Info(" " & oStyle.Name)
Logger.Info(" In Use: " & oStyle.InUse)
Logger.Info(" Up to Date: " & oStyle.UpToDate)
Select Case oStyle.StyleLocation
Case kBothStyleLocation
Logger.Info(" Style Location: Both Local and in Library")
Case kLibraryStyleLocation
Logger.Info(" Style Location: Library")
Case kLocalStyleLocation
Logger.Info(" Style Location: Local")
End Select
Logger.Info(" Bend Radius: " & oStyle.BendRadius)
Logger.Info(" Bend Relief Depth: " & oStyle.BendReliefDepth)
Logger.Info(" Bend Relief Width: " & oStyle.BendReliefWidth)
Select Case oStyle.BendReliefShape
Case kRoundBendReliefShape
Logger.Info(" Bend Relief Shape: Round")
Case kStraightBendReliefShape
Logger.Info(" Bend Relief Shape: Straight")
End Select
Select Case oStyle.BendTransition
Case kArcBendTransition
Logger.Info(" Bend Transition: Arc")
Case kDefaultBendTransition
Logger.Info(" Bend Transition: Default")
Case kIntersectionBendTransition
Logger.Info(" Bend Transition: Intersection")
Case kNoBendTransition
Logger.Info(" Bend Transition: None")
Case kStraightLineBendTransition
Logger.Info(" Bend Transition: Straight Line")
Case kTrimToBendBendTransition
Logger.Info(" Bend Transition: Trim to Bend")
End Select
Logger.Info(" Bend Transition Arc Radius: " & oStyle.BendTransitionArcRadius)
Logger.Info(" Corner Relief Size: " & oStyle.CornerReliefSize)
Select Case oStyle.CornerReliefShape
Case kArcWeldCornerReliefShape
Logger.Info(" Corner Relief Shape: Arc Weld")
Case kDefaultCornerReliefShape
Logger.Info(" Corner Relief Shape: Default")
Case kFullRoundCornerReliefShape
Logger.Info(" Corner Relief Shape: Full Round")
Case kIntersectionCornerReliefShape
Logger.Info(" Corner Relief Shape: Intersection")
Case kLinearWeldReliefShape
Logger.Info(" Corner Relief Shape: Linear Weld")
Case kNoReplacementCornerReliefShape
Logger.Info(" Corner Relief Shape: No Replacement")
Case kRoundCornerReliefShape
Logger.Info(" Corner Relief Shape: Round")
Case kRoundWithRadiusCornerReliefShape
Logger.Info(" Corner Relief Shape: Round with Radius")
Case kSquareCornerReliefShape
Logger.Info(" Corner Relief Shape: Square")
Case kTearCornerReliefShape
Logger.Info(" Corner Relief Shape: Tear")
Case kTrimToBendReliefShape
Logger.Info(" Corner Relief Shape: Trim")
End Select
Logger.Info(" Corner Relief Size: " & oStyle.ThreeBendCornerReliefSize)
Select Case oStyle.ThreeBendCornerReliefShape
Case kArcWeldCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Arc Weld")
Case kDefaultCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Default")
Case kFullRoundCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Full Round")
Case kIntersectionCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Intersection")
Case kLinearWeldReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Linear Weld")
Case kNoReplacementCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: No Replacement")
Case kRoundCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Round")
Case kRoundWithRadiusCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Round with Radius")
Case kSquareCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Square")
Case kTearCornerReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Tear")
Case kTrimToBendReliefShape
Logger.Info(" Three Bend Corner Relief Shape: Trim")
End Select
Logger.Info(" Material: " & oStyle.Material.Name)
Logger.Info(" Minimum Remnant: " & oStyle.MinimumRemnant)
Logger.Info(" Thickness: " & oStyle.Thickness)
Select Case oStyle.PunchRepresentationType
Case k2DSketchAndCenterMarkPunchRepresentation
Logger.Info(" Punch Representation Type: 2D Sketch and Center Mark")
Case k2DSketchPunchRepresentation
Logger.Info(" Punch Representation Type: 2D Sketch")
Case kCentermarkPunchRepresentation
Logger.Info(" Punch Representation Type: Center Mark")
Case kDefaultPunchRepresentation
Logger.Info(" Punch Representation Type: Default")
Case kFormedFeaturePunchRepresentation
Logger.Info(" Punch Representation Type: Formed Feature")
End Select
Logger.Info(" Unfold Method: " & oStyle.UnfoldMethod.Name)
Next
' Display information about the unfold methods.
Logger.Info("")
Logger.Info("Unfold Methods")
Dim oUnfoldMethod As UnfoldMethod
For Each oUnfoldMethod In oSheetMetalCompDef.UnfoldMethods
Logger.Info(" " & oUnfoldMethod.Name)
Logger.Info(" In Use: " & oUnfoldMethod.InUse)
Logger.Info(" Up to Date: " & oUnfoldMethod.UpToDate)
Select Case oUnfoldMethod.StyleLocation
Case kBothStyleLocation
Logger.Info(" Location: Both Local and in Library")
Case kLibraryStyleLocation
Logger.Info(" Location: Library")
Case kLocalStyleLocation
Logger.Info(" Location: Local")
End Select
Select Case oUnfoldMethod.UnfoldMethodType
Case kBendTableUnfoldMethod
Logger.Info(" Unfold Method Type: Bend Table")
Case kLinearUnfoldMethod
Logger.Info(" Unfold Method Type: Linear")
End Select
Logger.Info(" kFactor: " & oUnfoldMethod.kFactor)
Next