Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ILogic rule for modeling/sheet metal state

5 REPLIES 5
Reply
Message 1 of 6
shaiadle
2459 Views, 5 Replies

ILogic rule for modeling/sheet metal state

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

5 REPLIES 5
Message 2 of 6

 

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

 

 

 

Message 3 of 6
rjay75
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

 

Message 4 of 6
WHassan
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

 

 

Message 5 of 6
niksasa
in reply to: Curtis_Waguespack


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 if

 I have this code does not work in ilogic

 

 

 


 

САПР - это инструмент, но только при условии грамотного подхода.
Message 6 of 6
Curtis_Waguespack
in reply to: niksasa

Hi niksasa,

 

If you are using Inventor 2014, then this might be related to this problem:

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Subtype-Sheet-Metal-file-changed-in-In...

 

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.

Post to forums  

Autodesk Design & Make Report