Hello Guest it is April 19, 2024, 03:07:46 AM

Author Topic: Setup soft limits per VB script  (Read 1937 times)

0 Members and 1 Guest are viewing this topic.

Setup soft limits per VB script
« on: August 30, 2013, 11:13:50 AM »
Hi

Try, try and no success.

Could someone, please, tell me what's wrong with my code (underneath in the quote). The issue is that I have to run twice the macro in order to get the operation done. The fist time says (almost) always in the status message that "Machine out of limits for SoftLimit Activation" and this is no the case when I check the softlimts values during macro execution.

The second time I execute the macro, everything's fine.

I have the feeling that somehow i have to wait until the process of setting softlimits values be finished and I can't find where to set this.

Any advice?

Many thanks in advance

Quote
'Set softlimits and toggle those ON

SLMax_X = 150 : SLMin_X = 156 : SLMax_Y = 151 : SLMin_Y = 157 : SLMax_Z = 152 : SLMin_Z = 158
DRO_X = 0 : DRO_Y = 1 : DRO_Z = 2 
SoftLimitsLED = 23 : SoftLimtsToggle = 119 : Delta = 1

If GetOEMLED(SoftLimitsLED) Then
  DoOEMButton(SoftLimtsToggle)
End If

SetOEMDRO(SLMin_X, 0) : SetOEMDRO(SLMin_Y, 0) : SetOEMDRO(SLMax_Z, 0)

Res = GetDRO(DRO_X) : SetOEMDRO(SLMax_X, Res+Delta)
Res = GetDRO(DRO_Y) : SetOEMDRO(SLMax_Y, Res+Delta)
Res = GetDRO(DRO_Z) : SetOEMDRO(SLMin_Z, Res-Delta)

If Not GetOEMLED(SoftLimitsLED) Then
  DoOEMButton(SoftLimtsToggle)
End If
Re: Setup soft limits per VB script
« Reply #1 on: September 01, 2013, 08:47:17 AM »
I did find the answer.
One has to recalculate the soft limits after setting them.