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
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
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
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
Curtis_Waguespack написано:
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 ifI have this code does not work in ilogic
Hi niksasa,
If you are using Inventor 2014, then this might be related to this problem:
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Can't find what you're looking for? Ask the community or share your knowledge.