• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Member
    Posts: 5
    Registered: ‎05-05-2010

    ILogic rule for modeling/sheet metal state

    570 Views, 3 Replies
    10-06-2011 12:41 AM

    Hellow,

    Deos anyone know how what is the iLogic rule for identifying if a part is in a "modeling" state or "sheet metal" state?

     

    Regards,

    Shai

    Please use plain text.
    *Expert Elite*
    Curtis_Waguespack
    Posts: 1,933
    Registered: ‎03-08-2006

    Re: ILogic rule for modeling/sheet metal state

    10-06-2011 09:42 AM in reply to: shaiadle

     

    Hi shaiadle,

     

    You can use a conditional such as this to check for the existence of a flat pattern:

    If oSMDef.FlatPattern Is Nothing Then 

     

    Here's a quick example:

     

    Dim oDoc As PartDocument
    oDoc = ThisApplication.ActiveDocument
       
    'ensure this part has a flat pattern
    Dim oSMDef As SheetMetalComponentDefinition
    oSMDef = oDoc.ComponentDefinition
    If oSMDef.FlatPattern Is Nothing Then
    'tell the user there is no flat pattern
    MessageBox.Show("This file has no flat pattern", "iLogic")
    Else
    'tell the user there is a flat pattern
    MessageBox.Show("This file does have a flat pattern", "iLogic")
    end if

     

    but to answer your question more directly, you can use the FlatPattern.ExitEdit method to return to the folded model, if the model is in the Flat Pattern environment:

     

    Dim oDoc As PartDocument
    oDoc = ThisApplication.ActiveDocument

    Dim oSMDef As SheetMetalComponentDefinition
    oSMDef = oDoc.ComponentDefinition
    oSMDef.FlatPattern.ExitEdit
    

     

    and conversly you can use the FlatPattern.Edit method to return to the flat pattern, if the model is in the folded environment:

     

    Dim oDoc As PartDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oSMDef As SheetMetalComponentDefinition
    oSMDef = oDoc.ComponentDefinition
    oSMDef.FlatPattern.Edit

     

    I hope this helps.
    Best of luck to you in all of your Inventor pursuits,
    Curtis
    http://inventortrenches.blogspot.com

     

     

     



      solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.

    Please use plain text.
    Distinguished Contributor
    Posts: 132
    Registered: ‎04-14-2005

    Re: ILogic rule for modeling/sheet metal state

    10-06-2011 10:45 AM in reply to: shaiadle

    If you're just trying to determine if the active document is a sheet metal part versus standard part this code may help.

     

    Dim curDoc = ThisApplication.ActiveDocument
    If curDoc.DocumentType = kPartDocumentObject Then
    	'This is a Part Drawing
    	If curDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
    		'This is a SheetMetal Part
    		MessageBox.Show("This is a sheet metal part.", "SMCheck")
    	Else
    		MessageBox.Show("This is a standard part.", "SMCheck")
    	End If
    End If

     

    Rodney Thomas
    Design Engineer / Programmer
    A & A Manufacturing

    Support a Q & A For CAD Users: Stack Exchange Proposal
    Please use plain text.
    Active Contributor
    Posts: 26
    Registered: ‎07-17-2012

    Re: ILogic rule for modeling/sheet metal state

    09-10-2012 02:24 PM in reply to: rjay75

    Thanks Rodney,

    Is there a help resource where I can find the "text" for all the Sub-Types of files.

     

    I am trying to output them on the immediate window, but it seems to give me a troubles (or maybe I dont know how to get imformation on the Immediate window yet)

     

     

    Regards,

     

    Wajih

     

     

    Please use plain text.