NEWS
LinuxCNC 2.5.2 Release
LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 
Home Forum Configuring LinuxCNC pyVCP initval is not working in scale

Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: initval is not working in scale

initval is not working in scale 19 Jun 2012 12:46 #21118

  • babis
  • babis's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Hi

I use this line in my pyvcp:
<scale halpin="heater1.set-sv" initval="10" min_="300" max_="0" orient="vertical" width="25" length="500" />

Whatever the initval i use the scale always start at 300 or whatever is the min value.
If i reverse the order of min and max then it works ok. Is any way to force the initial value to apply?

Thank you
Charalampos Alexopoulos
The administrator has disabled public write access.

Re:initval is not working in scale 19 Jun 2012 12:55 #21119

  • BigJohnT
  • BigJohnT's Avatar
  • OFFLINE
  • Administrator
  • Posts: 4960
  • Thank you received: 87
  • Karma: 134
I would assume that min must be less than the initial value and max must be more than the initial value to work. You seem to have it backwards...

John
The administrator has disabled public write access.

Re:initval is not working in scale 19 Jun 2012 13:22 #21121

  • babis
  • babis's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Thank you for your answer. You are right, after some search i found in the [pyvcp_widgets.py] file in the [pyvcp_scale] class this code fragment:

if initval < min_:
self.value=min_
elif initval > max_:
self.value=max_
else:
self.value=initval

I change it to:

if max_ > min_:
if initval < min_:
self.value=min_
elif initval > max_:
self.value=max_
else:
self.value=initval
else:
if initval > min_:
self.value=min_
elif initval < max_:
self.value=max_
else:
self.value=initval

Now it working both ways. It will be nice if it is added to the next release. When you use verical scale is more user friendly to have the lower value in the bottom.

Regards
The administrator has disabled public write access.

Re:initval is not working in scale 19 Jun 2012 13:48 #21122

  • BigJohnT
  • BigJohnT's Avatar
  • OFFLINE
  • Administrator
  • Posts: 4960
  • Thank you received: 87
  • Karma: 134
Makes sense to me...

John
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.876 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.