iLogic to change number of feature pattern occurances

iLogic to change number of feature pattern occurances

jfenter
Enthusiast Enthusiast
564 Views
1 Reply
Message 1 of 2

iLogic to change number of feature pattern occurances

jfenter
Enthusiast
Enthusiast

I am currently working on a part that will ultimately be produced in multiples on a slab.  The slab length can be 9, 10, 11 or 12 feet long based on optimum material usage.  I have created a multi-body part that has a variable length for the finished part.  The finished part then gets laid out for production in slab form.  For this, I am writing a rule to determine the number of occurrences on a rectangular feature pattern.

 

I have written the start of the rule, which seems to work only when I force the slab length input in the rule.  Once I change the slab length to a variable condition, the rule does not run properly.  I get no errors returned, but nothing happens.  The code as I have it written now is this:

 

 

slabLength="9"
'Change slabLength from feet to mm
roundIT=(Round((slabLength*304.8)/partLength))
iteration=roundIT

'Test to see if math worked properly
MessageBox.Show(iteration & "", "Title")

' ***Rectangular Pattern7***
Feature.IsActive("Rectangular Pattern7") = True
Parameter("d177") = iteration

When I run the rule as written above, it calculates the number of occurrences correctly (iteration), but even with a parameter.updateafterchange command in place, I still have to manually click the update button on the Manage tab to change the pattern occurrences to the correct number.   When I set the slabLength variable as the subject of a conditional statement, the rule fails to work at all.  Such as this:

 

 

If slabLength="9" Then
'Change slabLength from feet to mm
roundIT=(Round((slabLength*304.8)/partLength))
iteration=roundIT

'Test to see if math worked properly
MessageBox.Show(iteration & "", "Title")

' ***Rectangular Pattern7***
Feature.IsActive("Rectangular Pattern7") = True
Parameter("d177") = iteration


Parameter.UpdateAfterChange = True
End If 

 I will ultimately be setting this rule to run only when the partLength variable is greater than 660mm, but I haven't had any luck in getting it to run in any state so far.

0 Likes
565 Views
1 Reply
Reply (1)
Message 2 of 2

asiteur
Collaborator
Collaborator

I do notice that you are using slablength="9" as if it's a string while you then apply math operators to it as if it's a number.

Could you try again with better consistency? Hence

User parameter of type number,

if slaglength=9 then...

or alternatively convert the string "9" to float before applying operators.



Alexander Siteur
Project Engineer at MARIN | NL
LinkedIn

0 Likes