iLogic

iLogic

Sam.Abdallah
Participant Participant
343 Views
4 Replies
Message 1 of 5

iLogic

Sam.Abdallah
Participant
Participant

Hi

I'm trying to suppress/activate features in a part

 

If condition A is true

 Set_features (hole1, hole2...)

 if ofeature = Set_features then

 Feature.IsActive ( ofeature) = True

Else 

 Feature.IsActive ( ofeature) = False

 

 

My question is how to define a set of features?

0 Likes
344 Views
4 Replies
Replies (4)
Message 2 of 5

Sam.Abdallah
Participant
Participant

This is what I got for parts in assembly, but doesn't work. Any suggestions?

 

SyntaxEditor Code Snippet

' GROUP MEMBERS TO ACTIVATE/SUPPRESS

MEMBER1GROUP = New String(){"MEMBER1"}

'SELECT MEMBERS THAT ARE REQUIRED

If MEMBER_1 = 1 Then
        For Each Value As String In MEMBER1GROUP
            Try  
                If Value = MEMBER1GROUP Then
                Component.IsActive(Value) = True
                Else
                Component.IsActive(Value) = False
                End If
            Catch
            End Try
        Next
End If

 

0 Likes
Message 3 of 5

MechMachineMan
Advisor
Advisor

A similar solution was made in the proposed in the past:

 

https://forums.autodesk.com/t5/inventor-forum/additional-parameters-in-ilogic-string/m-p/6810149/hig...

 

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
Message 4 of 5

Sam.Abdallah
Participant
Participant

Thanks Justin

 

Thanks for your reply.

 

I did see that thread. As you said, it will solve the 'suppress/activate' action. But I intend to use the group execute other actions, may be, change material, change supplier, etc. 

 

Essentially, I'm after

1. creating a group for parts, for example:

MEMBER1GROUP = New String(){"MEMBER1", "MEMBR2", ....}

2. Loop to action for each member of that group, for example: 

If MEMBER_1 = 1 Then
        For Each Value As String In MEMBER1GROUP
            Try  
                If Value = MEMBER1GROUP Then
                Component.IsActive(Value) = True
                Else
                Component.IsActive(Value) = False
                End If
            Catch
            End Try
        Next
End If

 

This approach will allow me to add members to a group at later stage and add/change actions to be executed to members in selected groups

0 Likes
Message 5 of 5

Sam.Abdallah
Participant
Participant

I guess I figured it out. Just had to simplify the statements

 

SyntaxEditor Code Snippet

'Create member group
MEMBER1GROUP = New String(){"MEMBER1", "MEMBER2", "MEMBER3"}'Create action: suppres / activate condition
For Each VALUE In MEMBER1GROUP
    If MEMBER_1 = 0 Then
    Component.IsActive(VALUE)=False
            
    ElseIf MEMBER_1 = 1 Then
    Component.IsActive(VALUE)=True
    End If
Next
0 Likes