Message 1 of 7

Not applicable
04-21-2019
04:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi to community.
I need to get sheet metals flat pattern extents width and length expressions in mm format, and assign them to description property of document as parametric values. By this code I can get them in cm unit and can not control precision of values.
Sub AssignFlatPatternDimensionsToDescription(partDoc As PartDocument) 'If partDoc.DocumentType = kPartDocumentObject Then 'If IsSheetMetal(partDoc) Then On Error GoTo exitSubPartToSheetMetal Dim oCompDef As SheetMetalComponentDefinition Set oCompDef = partDoc.ComponentDefinition If oCompDef.HasFlatPattern = False Then Dim oPartDoc As Document Set oPartDoc = ThisApplication.Documents.Open(partDoc.FullFileName, True) oCompDef.Unfold oPartDoc.Close End If Dim oPropsets As PropertySets Set oPropsets = partDoc.PropertySets Dim designTrackPropSet As PropertySet Set designTrackPropSet = partDoc.PropertySets.item("Design Tracking Properties") ' Get the Description property. Dim oPropDescription As Property Set oPropDescription = oPropsets.item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDescriptionDesignTrackingProperties) ' Add flat pattern expressions to the property. oPropDescription.Expression = "=<Flat Pattern Width> x <Flat Pattern Length>" 'End If exitSubPartToSheetMetal: If Err.Number <> 0 Then Err.Clear End If 'End If End Sub
For a drawing view I can set the label by this code (as parametric) in mm;
'' FLAT PATTERN WIDTH x LENGTH Msg = "<StyleOverride FontSize='0.3'><SheetMetalProperty SheetMetalPropertyID='78850' Precision='1'>FLAT PATTERN EXTENTS WIDTH</SheetMetalProperty></StyleOverride>" Msg = Msg & "<StyleOverride FontSize='0.3'> x </StyleOverride>" Msg = Msg & "<StyleOverride FontSize='0.3'><SheetMetalProperty SheetMetalPropertyID='78849' Precision='1'>FLAT PATTERN EXTENTS LENGTH</SheetMetalProperty></StyleOverride>" drawView.Label.FormattedText = Msg
And I can expose thickness parameter as property and use the value as parametric in mm. But can't find a way to get flat pattern extents values in mm & and can't control precision..
May someone tell me; if it is possible in VBA; how to do it?
Thanks in advance.
Solved! Go to Solution.