• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Valued Contributor
    zdhrichard
    Posts: 100
    Registered: ‎05-03-2011
    Accepted Solution

    How to delete suppressed components by iLogic Rule

    231 Views, 16 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?

    Richard Z.

    Autodesk Inventor Professional 2013 (64 Bit) SP1.1
    Windows 7 Professional Service Pack 1
    Intel(R) Xeon(R) CPU E5645
    12.0 GB Memory
    Please use plain text.
    *Expert Elite*
    mrattray
    Posts: 1,485
    Registered: ‎09-13-2011

    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

    Please use plain text.
    Valued Contributor
    Posts: 94
    Registered: ‎09-10-2012

    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 2011
    Windows 7 Enterprise, 64-bit
    Please use plain text.
    *Expert Elite*
    mrattray
    Posts: 1,485
    Registered: ‎09-13-2011

    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

    Please use plain text.
    Valued Contributor
    zdhrichard
    Posts: 100
    Registered: ‎05-03-2011

    Re: How to delete suppressed components by iLogic Rule

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

    Thanks lot, Mike.

    Richard Z.

    Autodesk Inventor Professional 2013 (64 Bit) SP1.1
    Windows 7 Professional Service Pack 1
    Intel(R) Xeon(R) CPU E5645
    12.0 GB Memory
    Please use plain text.
    Valued Contributor
    zdhrichard
    Posts: 100
    Registered: ‎05-03-2011

    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.

    Richard Z.

    Autodesk Inventor Professional 2013 (64 Bit) SP1.1
    Windows 7 Professional Service Pack 1
    Intel(R) Xeon(R) CPU E5645
    12.0 GB Memory
    Please use plain text.
    *Expert Elite*
    mrattray
    Posts: 1,485
    Registered: ‎09-13-2011

    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

    Please use plain text.
    Valued Contributor
    zdhrichard
    Posts: 100
    Registered: ‎05-03-2011

    Re: How to delete suppressed components by iLogic Rule

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

    Here is a simplified model.

    Richard Z.

    Autodesk Inventor Professional 2013 (64 Bit) SP1.1
    Windows 7 Professional Service Pack 1
    Intel(R) Xeon(R) CPU E5645
    12.0 GB Memory
    Please use plain text.
    *Expert Elite*
    mrattray
    Posts: 1,485
    Registered: ‎09-13-2011

    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

    Please use plain text.
    Valued Contributor
    zdhrichard
    Posts: 100
    Registered: ‎05-03-2011

    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.

    Richard Z.

    Autodesk Inventor Professional 2013 (64 Bit) SP1.1
    Windows 7 Professional Service Pack 1
    Intel(R) Xeon(R) CPU E5645
    12.0 GB Memory
    Please use plain text.