Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need help deleting suppressed features...

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
jestclair
438 Views, 4 Replies

Need help deleting suppressed features...

In the browser there are suppressed features with sketches, those delete just fine... however there are shared sketches, and features without sketches that disrupt the flow of my rule. With each disruption an error message pops up. I click OK, make no changes to the rule and just click OK all the way through it. If I cycle through the error messages clicking OK all the way through, everything suppressed eventually gets deleted. The rule would work perfectly if no error messages would pop up.

Could someone take a look at my rule, share your thoughts?

*Inventor 2013, Windows 7*

'-------------------------------------------------------------------iLogic Rule Start-------------------------------------------------------------------------------------------

Dim oDoc As Document
Dim oFeature As PartFeature
Dim oFeatures As PartFeatures
Dim oSketch As PlanarSketch
Dim oSketches As PlanarSketches 
oDoc = ThisApplication.ActiveDocument
oFeatures = ThisDoc.Document.ComponentDefinition.Features
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 = 1 Then oSketch.Delete
Next

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

'-------------------------------------------------------------------iLogic Rule End-------------------------------------------------------------------------------------------

4 REPLIES 4
Message 2 of 5
wayne.brill
in reply to: jestclair

Hi,

 

Could you attach an ipt file that I can use with your rule to research this?

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
Anonymous
in reply to: jestclair

Try Thisapplication.silentoperation =true

at the end of your code, you use Thisapplication.silentoperation =false

Don't forget in the errorhandler to write also there Thisapplication.silentoperation =false

Otherwise working in inventor without messages is a pita!

this code hides any errormessages, or messages to save, etc...

Message 4 of 5
jestclair
in reply to: Anonymous

Thanks for the input, but it did not work.
Message 5 of 5
jestclair
in reply to: wayne.brill

Thanks for responding, but that won't be necessary. I've already found the solution... 'On Error Resume Next' before and after the code eliminated the error messages.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report