Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: How to delete suppressed components by iLogic Rule
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Can you post a version without the code having been ran?
Re: How to delete suppressed components by iLogic Rule
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This is the ipt which I took the rule off.
I hope it is what you want.
Autodesk Inventor Professional 2013 (64 Bit) SP1.1
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Re: How to delete suppressed components by iLogic Rule
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Try adding this to the end of your DeleteFeatures sub:
Dim oSketch As PlanarSketch Dim oSketches As PlanarSketches oSketches = oDoc.ComponentDefinition.Sketches For Each oSketch In oSketches If oSketch.Dependents.Count = 0 Then oSketch.Delete Next For Each oSketch In oSketches If oSketch.Dependents.Count = 0 Then oSketch.Delete Next
The reason the first code doesn't clean up all of the sketches is because it only deletes those sketches that are being consumed by the features that are being deleted.
Note that we have to run though all of your skecthes twice. This is because you have interdependencies between sketches and you cannot delete a sketch that has something else dependent on it. I'm playing around with a more elegant way to do this, but this way does work.
Re: How to delete suppressed components by iLogic Rule
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Great.
It is nice and clean now.
Thanks lot, Mike.
Autodesk Inventor Professional 2013 (64 Bit) SP1.1
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory
Re: How to delete suppressed components by iLogic Rule
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks Mike,
If you come up with a tidier way of doing it can you post it on here please.
The code seems to do it's job for me but gives an error message. Does this happen for you too? I will attach my code
Error in rule: DeleteSuppressedFeatures, in document: DeleteSuppressedFeatures.iLogicVb
Object variable or With block variable not set.
System.NullReferenceException: Object variable or With block variable not set.
at Microsoft.VisualBasic.CompilerServices.Symbols.Con
at Microsoft.VisualBasic.CompilerServices.NewLateBind
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly
at p.b(String A_0)
I can bypass this by using 'On Error Resume Next' but I would rather have a real fix. I am maybe going to be using this code later to write a rule which will seperate ipart members into standard part files.
Thanks,
Inventor 2013 Certified Professional
Autodesk Inventor Professional 2011
Windows 7 Enterprise, 64-bit
Re: How to delete suppressed components by iLogic Rule
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You have oDoc dimmed as DrawingDocument and you didn't set it equal to anything. If you just replace "oDoc" in my code snippet with "ThisDoc.Document" you should be OK. I'm surprised it still works at all like that.
Are you trying to run this from a drawing?
Re: How to delete suppressed components by iLogic Rule
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for your help Mike,
I just got a bit confussed as I am still getting my head around dimming things (i had coppied that line of code from a program I have that runs in a drawing)
Inventor 2013 Certified Professional
Autodesk Inventor Professional 2011
Windows 7 Enterprise, 64-bit


