Inventor General

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

How to delete suppressed components by iLogic Rule

767 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,456
Registered: ‎09-13-2011
Message 2 of 20 (758 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

Valued Contributor
waynehelley
Posts: 102
Registered: ‎09-10-2012
Message 3 of 20 (754 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,456
Registered: ‎09-13-2011
Message 4 of 20 (751 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: 120
Registered: ‎05-03-2011
Message 5 of 20 (738 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: 120
Registered: ‎05-03-2011
Message 6 of 20 (736 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,456
Registered: ‎09-13-2011
Message 7 of 20 (730 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: 120
Registered: ‎05-03-2011
Message 8 of 20 (726 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,456
Registered: ‎09-13-2011
Message 9 of 20 (722 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: 120
Registered: ‎05-03-2011
Message 10 of 20 (717 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

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 to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube