LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.81k stars 1.16k forks source link

Update python-interface.adoc #2789

Closed Sigma1912 closed 8 months ago

Sigma1912 commented 11 months ago

Remove reference to 'axes' attribute as it has been removed from linuxcnc.stat

jethornton commented 11 months ago

I feel it's wrong to remove this from the docs, the stat should be put back into src/emc/task/taskinf.cc as it's based on a required ini file entry and gives you the number of axes without having to be a math wizard.

I don't know why Jeff deleted it with commit 43deeedd065faf31254933ee56af01c314823827

Sigma1912 commented 11 months ago

Wouldn't this give you the number of axes:

n = s.axis_mask axes = n.bit_count()

Sigma1912 commented 11 months ago

Just tried it:

number_of_axes = (s.axis_mask).bit_count()

jethornton commented 11 months ago

Well I would never been able to figure that out because I suspect like me most folks never heard of bit_count().

However if that snippet of code was in the manual then everyone that was trying to get the axis count by looking at the status documents would then know how to get the number of axes.

jethornton commented 11 months ago

While bit_count() works it feels like a work around for a previously working stat item s.axes. Seems simpler to just put the s.axes back in...

jethornton commented 8 months ago

Instead of just deleting the axes from the docs and letting people who are not python programmers and don't have a clue how to get that information fumble around for days trying to figure it out why not put that code in the docs?

petterreinholdtsen commented 8 months ago

[jethornton]

Instead of just deleting the axes from the docs and letting people who are not python programmers and don't have a clue how to get that information fumble around for days trying to figure it out why not put that code in the docs?

I would also recommend not removing the axes entry completely from the documentation, as it would confuse those that try to figure out why their old setup no longer is working. I believe it is better to move it to a list of no longer present attributes, mention when it was removed and explain how to get the same value in a different way using your example code.

-- Happy hacking Petter Reinholdtsen

jethornton commented 8 months ago

I would add to Petter reply to leave the axes in the current spot so it's easy to find and add what Petter suggested.

Sigma1912 commented 8 months ago

I buggered it up and I don't have time to fix it. Maybe jethornton can create a pull request and I can then delete this one.