09-27-2021
06:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-27-2021
06:18 AM
Yes, thanks Chris. I noticed that later and corrected it, then it worked great. I also added a Try - Catch in there because I needed it to try to create a flat pattern in case a sheet metal body was built but flat pattern wasn't made yet.
Dim opart As PartDocument = ThisDoc.Document Dim smCompDef As SheetMetalComponentDefinition = opart.ComponentDefinition Dim smlength As Double Dim smwidth As Double Dim oSMthk As Double = Parameter("Thickness") If smCompDef.HasFlatPattern Then smlength = (smCompDef.FlatPattern.Length + oSMthk) / 2.54 smwidth = (smCompDef.FlatPattern.Width + oSMthk) / 2.54 Else Try smCompDef.Unfold() smlength = (smCompDef.FlatPattern.Length + oSMthk) / 2.54 smwidth = (smCompDef.FlatPattern.Width + oSMthk) / 2.54 Catch End Try End If Dim AreaPronest As Double = smlength * smwidth / 144 If Parameter("Thickness") >= 0.1875 Then getstock ="Plate, " & Format(oSMthk, "0.000") & " thk x " & Format(AreaPronest, "0.00") & " ft^2" Else getstock ="Sheet Metal, " & Format(oSMthk, "0.000") & " thk x " & Format(AreaPronest, "0.00") & " ft^2" End If