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: 

iLogic: Check if Component is there before using IsActive?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
gmetcalfe
1946 Views, 2 Replies

iLogic: Check if Component is there before using IsActive?

Is it possible to either catch the error on using Component.IsActive or check for a components existence before using Component.IsActive. I have tried to catch the error when a component does not exist but have had no success. What I am trying to achive is catch/detect the error when a user has deleted a component.

 

thanks

 

Gavin

2 REPLIES 2
Message 2 of 3
thomaskennedy
in reply to: gmetcalfe

The Try Catch statement sounds like what you are after.

 

Here is an example

 

Try
'try to set the component state
Component.IsActive("non existent part") = True
Catch
'catch error and assume the part does not exist
MsgBox("this part does not exist")
End Try

 

Hope this helps

 

Tom

Message 3 of 3
gmetcalfe
in reply to: thomaskennedy

[Slaps forehead] Feel really daft now. Smiley Happy

 

For some reason I did not think you could use try catch blocks in iLogic, didn't even try it. Was messing about with the old vb style "on error" instead.

 

thanks, thats great. Smiley Happy

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

Post to forums  

Autodesk Design & Make Report