Sheet Metal recognition from Assembly

Sheet Metal recognition from Assembly

donaldleigh
Advocate Advocate
739 Views
5 Replies
Message 1 of 6

Sheet Metal recognition from Assembly

donaldleigh
Advocate
Advocate

Hi all

I have a rule that is run from the top level assembly that transfers details from a form to all sub-assemblies and parts “Project Details”.

I then have an external rule that is set to trigger on an iProperty Change “Details” in every part and assembly. This rule checks to see if the model is an Assembly, Part, Sheet Metal or Drawing and performs certain things.

The issue I’m having it that when I run the “Project Details” from the top level assembly the “Details” rule in each Sheet metal part is only recognizing it as a part and not a sheet metal part. I think it has to do with the line. 

 

If ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then

 

When I run the “Details” rule from the Sheet metal part itself it works correct.

How do I change this please?

I have included a sample of the rule and parts. All rules are set up as External rules. This sample transfers the Project iProperty to each part and then each part sets a custom iProperty based n type.

Donald

Inventor 2014

0 Likes
Accepted solutions (3)
740 Views
5 Replies
Replies (5)
Message 2 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@donaldleigh,

 

Hoping that below iLogic code may be helpful.

 

Dim doc As Document = ThisDoc.Document



ModelType = iProperties.Value("Custom", "Model Type")



If doc.IsModifiable = True Then 'Document can be modified

	If doc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject  Then 'Drawing File

		Return

	Else If doc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject  Then 'Part or Sheet Metal File

		If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then 'Sheet Metal File

			ModelType = "Sheet Metal"

		Else 'Part File

			ModelType = "Part"

		End If	

	Else If doc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject  Then 'Assembly File

		ModelType = "Assembly"

	End If

Else 'Document can not be modified

End If



'Set Model Type iProperty

If iProperties.Value("Custom", "Model Type") <> ModelType Then

	iProperties.Value("Custom", "Model Type") = ModelType

	iLogicVb.UpdateWhenDone = True

End If



iLogicVb.UpdateWhenDone = True

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 6

MjDeck
Autodesk
Autodesk
Accepted solution

@donaldleigh , here is the change that @chandra.shekar.g made:
Original:

If ThisApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then 'Sheet Metal File

Modified:

If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then 'Sheet Metal File

This uses the document in which the rule is running (which is ThisDoc.Document).
On the other hand, ThisApplication.ActiveDocument is the document that is currently active in the window. The document name will be on the window. In this case, it's the top-level assembly.


Mike Deck
Software Developer
Autodesk, Inc.

Message 4 of 6

donaldleigh
Advocate
Advocate
Accepted solution

Thanks Guys

 

I thought it was something in that line not right. 

 

Also as I have

Dim doc As Document = ThisDoc.Document

 at the start it should read "doc" not "oDoc"

 

Again Thanks heaps

Donald

0 Likes
Message 5 of 6

MjDeck
Autodesk
Autodesk

Yes, that's right. Sorry about the typo. We should have tested.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 6 of 6

donaldleigh
Advocate
Advocate

all good. I'm starting to get a handle on ilogic and spotted it straight away.

at least this tells me i'm doing something right.

 

Cheers Again

Donald

0 Likes