Additional parameters in iLogic string

Additional parameters in iLogic string

phaeronkor
Advocate Advocate
977 Views
6 Replies
Message 1 of 7

Additional parameters in iLogic string

phaeronkor
Advocate
Advocate

Hello!

 

I am really sorry if there anyone asked about this before. But is there any way (or proper operator) to allow using more than one object in iLogic string?

 

For example, I need to suppress two features if the statement is False but I don't want to type "Feature.IsActive("featurename")=False" for each feature of my multi-body part. Is there any possibility to type something like "Feature.IsActive("featurename","featurename2","featurename3",..etc.)=False"?

 

 

If then.PNG

 

Thanks a lot!

0 Likes
Accepted solutions (1)
978 Views
6 Replies
Replies (6)
Message 2 of 7

Rob67ert
Collaborator
Collaborator

Hi,

 

I guess you need something like this:

 

SyntaxEditor Code Snippet

If Band_Lengte = 900 Then
Poot_Afstand_1 = 80
Poot_Afstand_2 = 600
Aandrijf_Afstand = 145
Feature.IsActive("Poot Pattern2")=False
Feature.IsActive("Poot Pattern3")=False
Feature.IsActive("Gaten_Span")=False


Else If Band_Lengte = 1100 Then
Poot_Afstand_1 = 120
Poot_Afstand_2 = 760
Aandrijf_Afstand = 345
Feature.IsActive("Poot Pattern2")=False
Feature.IsActive("Poot Pattern3")=False
Feature.IsActive("Gaten_Span")=True

 

 

Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Message 3 of 7

phaeronkor
Advocate
Advocate

I think that I was unclear or you didn't understand me.

 

Using your example:

 

Your variant:

If Band_Lengte = 900 Then
Poot_Afstand_1 = 80
Poot_Afstand_2 = 600
Aandrijf_Afstand = 145
Feature.IsActive("Poot Pattern2")=False
Feature.IsActive("Poot Pattern3")=False
Feature.IsActive("Gaten_Span")=False
...

 I want:

If Band_Lengte = 900 Then
Poot_Afstand_1 = 80
Poot_Afstand_2 = 600
Aandrijf_Afstand = 145
Feature.IsActive("Poot Pattern2","Poot Pattern3","Gaten_Span")=False
...

I need some kind of operator to separate features: "." "," ";" ":" "and" "andalso" - has no effect, shows error.

0 Likes
Message 4 of 7

Rob67ert
Collaborator
Collaborator
Aha, my mistake.
For all i know that is not possible.
Would like to have that as well.
Robert

If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
0 Likes
Message 5 of 7

MechMachineMan
Advisor
Advisor

Sure, it's possible!

 

Just need to write your own function/sub to accomplish it.

 

'wrap your original ilogic rule in Sub Main() / End Sub
Sub Main()
	Feature.IsActive("Extrusion1") = True
	Feature.IsActive("Extrusion2") = False
	
	FeaturesActive(True, "Extrusion1", "Extrusion2")
	'FeaturesActive(False, "Extrusion1", "Extrusion2")
End Sub


Sub FeaturesActive(boolActive As Boolean, ByVal ParamArray features As String())
  'Don't touch this sub or anything in it
  For Each i As String In features
    Feature.IsActive(i) = boolActive
  Next 
End Sub

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 6 of 7

phaeronkor
Advocate
Advocate

Well...thanks..haha) Tried to make my functions easier..hm, your suggestion in my opinion makes it only harder =)) If there's no other way to make it simplier I would rather make new strings for each function) But thanks!

0 Likes
Message 7 of 7

MechMachineMan
Advisor
Advisor
Accepted solution

Well, your new rule would just look like this. So to me, the ease of the main functionality of the rule is cleaner and easier to read, although it adds more writing that you dont need to worry about. Guess it's all just a matter of opinion though!

 

Sub Main()
'Take your old iLogic and put it in a Sub Main/End Sub Wrap. If Band_Lengte = 900 Then Poot_Afstand_1 = 80 Poot_Afstand_2 = 600 Aandrijf_Afstand = 145

'Swap your old call with the new one 'Feature.IsActive("Poot Pattern2","Poot Pattern3","Gaten_Span")=False FeaturesActive(False, "Poot Pattern2", "Poot Pattern3", "Gaten_Span") End if End Sub 'Copy/paste this sub into the same rule and don't touch anything in it. Sub FeaturesActive(boolActive As Boolean, ByVal ParamArray features As String()) For Each i As String In features Feature.IsActive(i) = boolActive Next End Sub

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type