Inventor General Discussion

Inventor General Discussion

Reply
Distinguished Contributor
zdhrichard
Posts: 124
Registered: ‎05-03-2011
Message 1 of 20 (874 Views)
Accepted Solution

How to delete suppressed components by iLogic Rule

874 Views, 19 Replies
01-24-2013 06:21 AM

I have an assembly which includes lot of parts (*.ipt) or sub-assembly (*.iam).

I have some ilogic rules to control to suppress or unsuppress them.

Now for the released assembly, I want delete all suppressed components by ilogic rule.

Could anybody help me the ilogic code to get this function?

Rich

Autodesk Inventor Professional 2013 (64 Bit) SP2
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
*Expert Elite*
mrattray
Posts: 2,481
Registered: ‎09-13-2011
Message 2 of 20 (865 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 07:26 AM in reply to: zdhrichard
Dim oComp As ComponentOccurrence
Dim oComps As ComponentOccurrences

oComps = ThisDoc.Document.ComponentDefinition.Occurrences

For Each oComp In oComps
	If Component.IsActive(oComp.Name) = False Then oComp.Delete
Next

 

Mike (not Matt) Rattray

Distinguished Contributor
waynehelley
Posts: 130
Registered: ‎09-10-2012
Message 3 of 20 (861 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 07:44 AM in reply to: mrattray

Hi Mike, by any chance do you know how to do the same but for deleting suppressed features in the part environment?

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2013
Windows 7 Enterprise, 64-bit
*Expert Elite*
mrattray
Posts: 2,481
Registered: ‎09-13-2011
Message 4 of 20 (858 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 07:58 AM in reply to: waynehelley
Dim oFeature As PartFeature
Dim oFeatures As PartFeatures

oFeatures = ThisDoc.Document.ComponentDefinition.Features

For Each oFeature In oFeatures
	If Feature.IsActive(oFeature.Name) = False Then oFeature.Delete
Next

 

Mike (not Matt) Rattray

Distinguished Contributor
zdhrichard
Posts: 124
Registered: ‎05-03-2011
Message 5 of 20 (845 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 10:48 AM in reply to: mrattray

Thanks lot, Mike.

Rich

Autodesk Inventor Professional 2013 (64 Bit) SP2
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Distinguished Contributor
zdhrichard
Posts: 124
Registered: ‎05-03-2011
Message 6 of 20 (843 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 10:54 AM in reply to: mrattray

Hello MIke,

 

For deleting features, do you know how to delete the relative sketches?

 

I tested the codes, it could delete features, but the sketches are still in the tree.

Rich

Autodesk Inventor Professional 2013 (64 Bit) SP2
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
*Expert Elite*
mrattray
Posts: 2,481
Registered: ‎09-13-2011
Message 7 of 20 (837 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 11:00 AM in reply to: zdhrichard

When I tested it the code deleted the consumed sketches as well as the feature. Can you attach the model?

Mike (not Matt) Rattray

Distinguished Contributor
zdhrichard
Posts: 124
Registered: ‎05-03-2011
Message 8 of 20 (833 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 11:23 AM in reply to: mrattray

Here is a simplified model.

Rich

Autodesk Inventor Professional 2013 (64 Bit) SP2
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
*Expert Elite*
mrattray
Posts: 2,481
Registered: ‎09-13-2011
Message 9 of 20 (829 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 11:31 AM in reply to: zdhrichard

Did you already run your delete features sub on this part? The code doesn't do anything at all for me.

Mike (not Matt) Rattray

Distinguished Contributor
zdhrichard
Posts: 124
Registered: ‎05-03-2011
Message 10 of 20 (824 Views)

Re: How to delete suppressed components by iLogic Rule

01-24-2013 11:43 AM in reply to: mrattray

Yes, I did. This is the result after runing the code.

Rich

Autodesk Inventor Professional 2013 (64 Bit) SP2
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.