D.S

adndevblog.typepad.com

Looping through all sheets and excluding flat patterns - Manufacturing DevBlog

Looping through all sheets and excluding flat patterns - Manufacturing DevBlog Manufacturing DevBlog The resource for software developers working with Design, Lifecycle and Simulation technologies from Autodesk. Home Subscribe Follow Useful Links Autodesk About this Blog « Get AutoCAD Mechanical Assembly Properties values | Main | Copying a Body from One Part into Another Part » 09/24/2013 Looping through all sheets and excluding flat patterns By Xiaodong Liang Question: I have an iLogic rule that automatically adds centerlines to cylindrical elements and holes. It runs on save. Is there a way to A) Make that rule loop through each sheet in the drawing file? Right now it loops through each view on the active sheet and I'm not sure how to get the total sheet count to make another loop for that. B) Is there a way I can conditionally check if the view is a flat pattern or not? I'd like to use an IF statement to exclude applying the center marks to the flat. Solution: For question ( A ) iLogic is based on VB.NET. The Sheets or Views is a kind of collection you will have two ways to iterate: either get the collection count and define an index variable, e.g. ' assume this is a collection Dim oObj_Array   'iterate by index Dim i For i = 0 To 10    'get each object in the collection    oEachObj  =  oObj_Array(i) Next   or enumerate the element of the collection   'enumerate the element of the collection For oEachObj In oObj_Array    '可直接访问每个对象 Next   For question ( B ): The property DrawingView.IsFlatPatternView tells you if this drawing view is of a sheet metal flat pattern. So the iLogic code could be: doc = ThisDoc.Document For Each oSheet In doc.Sheets   For Each oView In oSheet.DrawingViews     If oView.IsFlatPatternView  Then         MessageBox.Show("[Sheet Name] "+ oSheet.Name + "[View Name] " +                  oView.Name + " This is a view from flatpattern", "Title")     End If   Next Next Posted at 03:03 AM in iLogic , Inventor , Xiaodong Liang | Permalink | | | Comments Looping through all sheets and excluding flat patterns By Xiaodong Liang Question: I have an iLogic rule that automatically adds centerlines to cylindrical elements and holes. It runs on save. Is there a way to A) Make that rule loop through each sheet in the drawing file? Right now it loops through each view on the active sheet and I'm not sure how to get the total sheet count to make another loop for that. B) Is there a way I can conditionally check if the view is a flat pattern or not? I'd like to use an IF statement to exclude applying the center marks to the flat. Solution: For question ( A ) iLogic is based on VB.NET. The Sheets or Views is a kind of collection you will have two ways to iterate: either get the collection count and define an index variable, e.g. ' assume this is a collection Dim oObj_Array   'iterate by index Dim i For i = 0 To 10    'get each object in the collection    oEachObj  =  oObj_Array(i) Next   or enumerate the element of the collection   'enumerate the element of the collection For oEachObj In oObj_Array    '可直接访问每个对象 Next   For question ( B ): The property DrawingView.IsFlatPatternView tells you if this drawing view is of a sheet metal flat pattern. So the iLogic code could be: doc = ThisDoc.Document For Each oSheet In doc.Sheets   For Each oView In oSheet.DrawingViews     If oView.IsFlatPatternView  Then         MessageBox.Show("[Sheet Name] "+ oSheet.Name + "[View Name] " +                  oView.Name + " This is a view from flatpattern", "Title")     End If   Next Next View the entire comment thread. Please enable JavaScript if you would like to comment on this blog. Search Submit Mfg DevBloggers Adam Nagy Augusto Goncalves Balaji Ramamoorthy Daniel Du Philippe Leefsma Sajith Subramanian Vladimir Ananyev Wayne Brill Xiaodong Liang February 2017 Sun Mon Tue Wed Thu Fri Sat       1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28         Autodesk Blogs ADN DevBlog - AEC Our DevBlog for Revit, Navisworks, AEC and BIM technology APIs. ADN DevBlog - AutoCAD Our DevBlog for AutoCAD and other platform technology APIs. Forge Developer Blog Our DevBlog for Cloud and Mobile technologies with a strong emphasis on the Autodesk Forge APIs. ADN DevBlog - Infrastructure Modeling Our DevBlog for Infrastructure Modeling technology APIs. ADN DevBlog - Manufacturing Our DevBlog for Design, Lifecycle and Simulation technologies. Around the Corner Cyrille Fauvel's Maya platform developer blog - Autodesk Media and Entertainment technology. Civilized Development Isaac Rodriguez's AutoCAD Civil 3D developer blog Dances with Elephants Jim Quanci's blog on partnering with large companies. It's All Just Ones and Zeros Doug Redmond's Vault developer blog Mod the Machine Brian Ekins' and Adam Nagy's Inventor developer blog The 360 View Mikako Harada's BIM 360 developer blog The 3D Web Coder Jeremy Tammik's web and mobile programming blog The Building Coder Jeremy Tammik's Revit developer blog Through the In