Ilogic cilinder stroke

Ilogic cilinder stroke

Anonymous
Not applicable
640 Views
3 Replies
Message 1 of 4

Ilogic cilinder stroke

Anonymous
Not applicable

Dear forum members,

I've got an assembly file where i'm using two different cilinders. They are replacing each other with use of some iLogic coding.

Now i want the customer to fill in a value for the stroke of the cilinder so that the cilinder moves to this position.

So in the coding i use values for the maximum and minimum stroke and some messageboxes.

 

SyntaxEditor Code Snippet

Parameter("24AU034:1", "Stroke") = Stroke_assy

If Height = "< 3900 mm" And Stroke_assy < 0 Then
    Stroke_assy = 0 mm
    MessageBox.Show("Enter a value higher then 0", "Wrong value",Ok)
    MessageBox.Show("Value set to 0", "Wrong value",Ok)
    

ElseIf Height = "< 3900 mm" And Stroke_assy > 1600 Then
    Stroke_assy = 1600 mm
    MessageBox.Show("Enter a value lower then 1600 mm", "Wrong value",Ok)
    MessageBox.Show("Value set to 1600 mm", "Wrong value",Ok)
    

ElseIf Height = "=> 3900 mm" And Stroke_assy < 0 Then
    Stroke_assy = 0 mm
    MessageBox.Show("Enter a value higher then 0 mm", "Wrong value",Ok)
    MessageBox.Show("Value set to 0 mm", "Wrong value",Ok)
    

ElseIf Height = "=> 3900 mm" And Stroke_assy > 1900 Then 
    Stroke_assy = 1900 mm
    MessageBox.Show("Enter a Value lower then 1900 mm", "Wrong value",Ok)
    MessageBox.Show("Value set to 1900 mm", "Wrong value",Ok)
    
    
End If
iLogicVb.UpdateWhenDone = True

So I hioe I could make it a little bit clear.

Dependable on the Height (parameter) a cilinder is chosen.

This will be the cilinder with a stroke of 1600 mm  or the cilinder with a stroke of 1900 mm.

So the borders for both cilinders are:

 

Cilinder 1600 mm = 0 mm/1600 mm

Cilinder 1900 mm = 0 mm/1900 mm

 

When a value is entered that is higher or lower then these numbers there should be an error message.

Until this point it went allright.

But after a wrong value is entered, the cilinder still moves to that wrong number.

So I thought i could set the value of Stroke_assy to 0 mm or 1600/1900 mm after a wrong value is entered.

But till now i didn't manage to do that with the code i have now.

What did i do wrong?

 

0 Likes
Accepted solutions (1)
641 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I Think you have to use this code: 

 

Parameter("Stroke_assy") = 0 mm

This way the parameter will update imidiately.

 

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for your help, but it doesn't  work.

I've got the same problem.

The value is set back to 1600 mm but the assembly still takes the entered value

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

Okay figured it out!!!

It took me a whole day but it's that simple.

 

If Height = "< 3900 mm" And Stroke_assy < 0 Then
    Stroke_assy = 0 mm
    MessageBox.Show("Enter a value higher then 0", "Wrong value",Ok)
    MessageBox.Show("Value set to 0", "Wrong value",Ok)
    

ElseIf Height = "< 3900 mm" And Stroke_assy > 1600 Then
    Stroke_assy = 1600 mm
    MessageBox.Show("Enter a value lower then 1600 mm", "Wrong value",Ok)
    MessageBox.Show("Value set to 1600 mm", "Wrong value",Ok)
    

ElseIf Height = "=> 3900 mm" And Stroke_assy < 0 Then
    Stroke_assy = 0 mm
    MessageBox.Show("Enter a value higher then 0 mm", "Wrong value",Ok)
    MessageBox.Show("Value set to 0 mm", "Wrong value",Ok)
    

ElseIf Height = "=> 3900 mm" And Stroke_assy > 1900 Then 
    Stroke_assy = 1900 mm
    MessageBox.Show("Enter a Value lower then 1900 mm", "Wrong value",Ok)
    MessageBox.Show("Value set to 1900 mm", "Wrong value",Ok)
    
    
End If

Parameter("24AU034:1", "Stroke") = Stroke_assy
iLogicVb.UpdateWhenDone = True

The only thing i needed to do was putting the first line at the end.

So the whole rule runs first and after that the value is linked to the parameter.

 

0 Likes