- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey all!
I made a handy iLogic rule the other day.
Sub Main() 'Determines if there is a flat pattern Dim oDoc As PartDocument oDoc = ThisDoc.Document 'ensure this part has a flat pattern Dim oSMDef As SheetMetalComponentDefinition oSMDef = oDoc.ComponentDefinition If oSMDef.FlatPattern Is Nothing Then 'Warns the user there is no flat pattern 'MessageBox.Show("This file has no flat pattern", "iLogic") Else Extents End If End Sub Sub Extents() extents_length = SheetMetal.FlatExtentsLength extents_width = SheetMetal.FlatExtentsWidth LengthFrac = Round(SheetMetal.FlatExtentsLength, 0) WidthFrac = Round(SheetMetal.FlatExtentsWidth, 0) Dim oValue As String Dim param As Parameter If extents_width > extents_length Then oValue = (WidthFrac & "x" & LengthFrac) iProperties.Value("Custom", "DIMENSIONS") = oValue Else oValue = (LengthFrac & "x" & WidthFrac) iProperties.Value("Custom", "DIMENSIONS") = oValue End If End Sub
We use this to put the extents of flat patterns in the partslists on drawings. I attach the rule to the .ipt trigger 'before save' and 'when geometry changes'
I want to attach this iLogic to the template .ipt however.
The rule as it is now isn't suited for this yet however. When you run this rule on a non-sheet metal .ipt it will crash.
Thats why I want to change it so the iLogic rule doesn't do anything except when the following conditions are true:
part.ipt is a sheet metal part.
&
part.ipt has a flat pattern
also if part.ipt breaks and no longer has a flat pattern the DIMENSIONS value should be empty.
First off I need to know how I can differentiate between a normal part and a sheet metal part.
Can anyone give me a hand here?
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
___________________________Solved! Go to Solution.