Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: raymaster

Hi @raymaster.  What I was suggesting was also all code automation, to add to your existing code, to accomplish the added functionality you were looking for.  You said you already have some iLogic code in which you created a drawing sheet for a model with ModelStates, and want to duplicate that sheet for other ModelState versions of that model, and many other models.  I believe that one way you could accomplish that is by creating/using SheetFormats, but by code.  The links I included were for the Inventor API objects and methods involved in creating a new SheetFormat API object, and how to use that SheetFormat to create the next sheet in your drawing.  That method includes supplying a new name for the new sheet, and supplying either a Document object or (FullFileName or FullDocumentName) for 'the model' you want to be represented in the views of the new sheet, and other settings.  However, when reviewing the available settings for the method that creates a new sheet based on a SheetFormat, I did not see a specific setting for specifying ModelState.  If the supplied Document object was already set to the ModelState you want, that might work...or, you could also ensure that the FullDocumentName you supply includes that name of the ModelState at its end (FullDocumentName = FullFileName & "<ModelStateName>").  If you do not, or can not specify the ModelState in one of those two ways, then I mentioned a way that you can change which ModelState an individual DrawingView is set to by code.  This is all just one possible code process plan at this point.  If you think this sounds like a direction you would like to go with your project, then maybe we could help you further develop your existing code in this direction.  The alternative code process would be a bit more granular, creating each new sheet using the regular Sheets.Add() method, then creating each individual view on the new sheet using one of the available DrawingViews.Add type methods.  Using the SheetFormat route just seems a bit simpler, because the SheetFormat already knows the sheet size, orientation, Border, TitleBlock, certain settings, and already includes the views, which the reference model for can easily be changed right when creating the sheet.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)