Calling a rule containing feature suppress/unsuppress in a part from an assembly

Calling a rule containing feature suppress/unsuppress in a part from an assembly

iman.qx
Participant Participant
371 Views
1 Reply
Message 1 of 2

Calling a rule containing feature suppress/unsuppress in a part from an assembly

iman.qx
Participant
Participant

Hi Guys

I create a code that makes a copy from an existing part in my assembly and place it in to the same assembly with the new parameters that user has put into the interface form. based on those parameter the part has be to updated meaning there is a rule in this part which suppress and unsuppress some features. when I call this rule in my code which is written in the subassembly right after the copy and place is done, I am facing an error! here I pasted the text of the error:

 

Error in rule: Suppress, in document: PP001_TT_Connection_Nozzle017.ipt

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

looks like inventor cannot copy and update feature suppression at the same time. I don't know if that is because the file is not open by inventor yet or not!

but if after copying I open the part manually and run the rule, everything works fine. I need to find a way to automate this procedure. that will be kind of you if you have any idea how to proceed with that.

I appreciate any help in advance

 

0 Likes
Accepted solutions (1)
372 Views
1 Reply
Reply (1)
Message 2 of 2

iman.qx
Participant
Participant
Accepted solution

I have found a solution. Changing 

oPartDoc = ThisApplication.ActiveDocument

To

oPartDoc = ThisDoc.Document

in the rule supposed to run inside the part will solve the problem.

0 Likes