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: 

features on and off with iLogic

11 REPLIES 11
Reply
Message 1 of 12
j.vanderheijden
538 Views, 11 Replies

features on and off with iLogic

I want different features on and off with iLogic.

I have a text parameter with a choice menu of 1,2, and 3

This I want some features  on and off.

If I pass the parameter I get a message: No feature found with the name.

Mvg Jos

Your drawings are only as good as the symbols that complete them...
11 REPLIES 11
Message 2 of 12
jdkriek
in reply to: j.vanderheijden

I think you want to supress the parts. There are no features in that Assembly - thus the error.

 

Create a new level of detail, then run this

 

If AantalKoppelingen = 1 Then
	Component.IsActive("KlemHoekstuk") = True
	Component.IsActive("Buis") = False
	Component.IsActive("KlemTStuk") = False
	Component.IsActive("Buis:1") = False
	Component.IsActive("KlemHoekstuk:1") = False
ElseIf AantalKoppelingen = 2 Then
	Component.IsActive("KlemHoekstuk") = True
	Component.IsActive("Buis") = True
	Component.IsActive("KlemTStuk") = True
	Component.IsActive("Buis:1") = False
	Component.IsActive("KlemHoekstuk:1") = False
End If
iLogicVb.UpdateWhenDone = True

 

If you are planning on doing more than 2-3 IF statements you should consider CASE Statements - much faster.

 

Select Case AantalKoppelingen
	Case 1: Component.IsActive("KlemHoekstuk") = True
	Component.IsActive("Buis") = False
	Component.IsActive("KlemTStuk") = False
	Component.IsActive("Buis:1") = False
	Component.IsActive("KlemHoekstuk:1") = False
	
	Case 2: Component.IsActive("KlemHoekstuk") = True
	Component.IsActive("Buis") = True
	Component.IsActive("KlemTStuk") = True
	Component.IsActive("Buis:1") = False
	Component.IsActive("KlemHoekstuk:1") = False
	
	Case 3: Component.IsActive("KlemHoekstuk") = False
	Component.IsActive("Buis") = False
	Component.IsActive("KlemTStuk") = True
	Component.IsActive("Buis:1") = False
	Component.IsActive("KlemHoekstuk:1") = False
	
	Case 4: Component.IsActive("KlemHoekstuk") = True
	Component.IsActive("Buis") = True
	Component.IsActive("KlemTStuk") = True
	Component.IsActive("Buis:1") = True
	Component.IsActive("KlemHoekstuk:1") = False    
End Select
iLogicVb.UpdateWhenDone = True

 

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 12
j.vanderheijden
in reply to: jdkriek

Thanks Jonathan

The Case statement works.

But now i go a step further.

I have more types of couplings on one place and i want to control them to.

The parameter 'TypeAftakking' controls the type and the parameter 'aantalKoppelingen' controls the number of couplings.

The number of couplings go's good but when i change the TypeAftakking i get an error.

I have to make 10 couplings and 9 pipes in between.

In the TypeAftakking wil be at least 20 couplings.

I think that i can't use same case numbers in both rules.

Mvg Jos

Your drawings are only as good as the symbols that complete them...
Message 4 of 12
jdkriek
in reply to: j.vanderheijden

It's a matter of setting both parts to False first, you can do this manually, but also through the code.

 

Component.IsActive("K1-01:1") = False
Component.IsActive("K7-01:1") = False
Select Case TypeAftakking
    Case 1: 
    Component.IsActive("K1-01:1") = True
    Component.IsActive("K7-01:1") = False
    Case 7: 
    Component.IsActive("K1-01:1") = False
    Component.IsActive("K7-01:1") = True
End Select
iLogicVb.UpdateWhenDone = True
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 5 of 12
j.vanderheijden
in reply to: jdkriek

When i want to change TypeAftakking i get an error.

I wondering if i have to make a level of detail because in the code you turn of the components first.

But i put the level of detail to master and then i get the message that there is no level of detail.

 

Mvg Jos

Your drawings are only as good as the symbols that complete them...
Message 6 of 12

Hi,

 

Could you list the code how you changed TypeAftakking? It will be of help for the peers to diagnose. thank you.

Message 7 of 12

I use two types of code.

The first to select the type of Aftakking.

And the second to select the numbers for AantalKoppelingen

 

Select Case TypeAftakking
 Case 1: Component.IsActive("K1-01:1") = True
               Component.IsActive("K7-01:1") = False
 

Case 7: Component.IsActive("K1-01:1") = False
             Component.IsActive("K7-01:1") = True
 
End Select
iLogicVb.UpdateWhenDone = True

 

Select Case AantalKoppelingen
 Case 1: Component.IsActive("KoppelingT1-01:1") = True
               Component.IsActive("L1-01:1") = False
               Component.IsActive("KoppelingT2-01:1") = False
 
 Case 2: Component.IsActive("KoppelingT1-01:1") = True
               Component.IsActive("L1-01:1") = True
               Component.IsActive("KoppelingT2-01:1") = True
    
End Select
iLogicVb.UpdateWhenDone = True

Mvg Jos

Your drawings are only as good as the symbols that complete them...
Message 8 of 12
jdkriek
in reply to: j.vanderheijden

Yes, you do have to have a level of detail and it has to be selected. Sorry, thought I made that clear.

 

That goes for anytime you are changing visuals - manually or via script.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 9 of 12

Must I then make for every situation a different level of detail?

Mvg Jos

Your drawings are only as good as the symbols that complete them...
Message 10 of 12
jdkriek
in reply to: j.vanderheijden

No, not unless you want to show every combination separately on the drawing.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 11 of 12

  My starting point is 10 couplings  and 9 pieces of pipe .
Now it may happen that I would turn off  1 or more couplings with pipe .
In the coupling can be also variations of different types.

Mvg Jos

Your drawings are only as good as the symbols that complete them...
Message 12 of 12
Anonymous
in reply to: j.vanderheijden

work great if you dont want to change your choice, when is not active because de first choice the rule dont work, it's possible to remake de component active???

 

Thanks for your help!

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

Post to forums  

Autodesk Design & Make Report