Preview in MM while DRO's are in inch

More
02 Sep 2022 03:45 #250972 by auto-mation-assist
I have been updating a older computer in the past several days that runs gmoccapy for its UI. Its running on Linux Mint Cinnamon version 21 and Linux cnc-1 5.19.6-rt10 #2 SMP PREEMPT_RT Thu Sep 1 10:37:18 AKDT 2022 x86_64 x86_64 x86_64 GNU/Linux.

Gmoccapy version is 3.13.10 and running in place with development master.

It is mostly working from what I can tell but I noticed is that the angles show in the preview were all in MM while the DRO's were all indicating in inch. This difference remained until I clicked on the  make the preview as large as possible button near the lower right of the UI. The preview display then showed the angles in inches when returning back to the normal size of the preview window.

While trouble shooting this I also noticed that there is a duplicate line in gmoccapy at 2258, self.widgets.btn_jump_to.set_sensitive(self.widgets.IconFileSelection1.btn_jump_to.get_sensitive())

Please Log in or Create an account to join the conversation.

More
02 Sep 2022 08:35 #250983 by HansU
So your machine configuration is Inch and the preview (gremlin) shows first MM wrongly, until you enter and leave full screen mode.
Did I get that right?

Please Log in or Create an account to join the conversation.

More
02 Sep 2022 16:19 #251019 by auto-mation-assist
Yes that is correct

Please Log in or Create an account to join the conversation.

More
02 Sep 2022 17:25 - 02 Sep 2022 17:50 #251035 by auto-mation-assist
Here is a picture showing difference between DRO's and Preview. But switching to fill preview screen and back did not fix this and only drifted the positions slightly. Stopping and restarting linuxcnc was required after that.

Initial screen
 

After restart
 

And selecting full display screen
 
 
Attachments:
Last edit: 02 Sep 2022 17:50 by auto-mation-assist.

Please Log in or Create an account to join the conversation.

More
02 Sep 2022 17:48 #251045 by cmorley
GMoccapy/gremlin probably doesn't reload the screen on g20/g21 changes.

Please Log in or Create an account to join the conversation.

More
02 Sep 2022 18:12 #251053 by auto-mation-assist
I'm not sure if the info from the startup debug info is help full or not but it I attached it just in case someone can spot a potential problem.
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Sep 2022 04:21 - 04 Sep 2022 04:22 #251152 by auto-mation-assist
I have been checking a bit and found this somewhat interesting

In gmoccapy.py line 87 and 88 have
_INCH = 0 # imperial units are active
_MM = 1 # metric units are active

I added these two temp lines 584 and 585
print ("584 Get Linear units")
print("linear units is ",self.stat.linear_units)

This moved everything down two lines but at the original gmoccapy.py starting at line 584 I see
if self.stat.linear_units != _MM:
digits = 4
self.dro_digits = self.prefs.getpref("dro_digits", digits, int)
self.dro_size = self.prefs.getpref("dro_size", 28, int)

In the terminal I get  this back from my print statements.

584 Get Linear units
linear units is 0.03937007874015748

I was expecting back 0 so this seems unusual to me since I would expect either a 0 or 1.

The 0.03937007874015748 is not eqaul to _MM: so digits in dro should be 4 but they are 3 for mm. This odd value, if not a format problem is strange.

What do you think?
Last edit: 04 Sep 2022 04:22 by auto-mation-assist.

Please Log in or Create an account to join the conversation.

More
04 Sep 2022 04:30 #251153 by cmorley
from memory - I think Gmoccapy can display imperial/metric independent of current G20/21 mode.
So you might confirm if that is for mode units or display units or I am remembering wrong.

Please Log in or Create an account to join the conversation.

More
04 Sep 2022 13:57 #251168 by HansU

[ GMoccapy/gremlin probably doesn't reload the screen on g20/g21 changes.

It seems it does. If you switch to G21 and then back to G20, then the DRO in gremlin is correct.


584 Get Linear units
linear units is 0.03937007874015748

I was expecting back 0 so this seems unusual to me since I would expect either a 0 or 1.


This is just the factor which shows you that gmoccapy is using inch (=1/25.4)

From gmoccapy code:
# self.stat.linear_units will return 1.0 for metric and 1/25,4 for imperial

From emcsh.cc:
"For linear joints, something close to 0.03937 is deemed "inch", 1.000 is "mm", 0.1 is "cm", otherwise it's "custom"."

Please Log in or Create an account to join the conversation.

More
04 Sep 2022 20:55 - 05 Sep 2022 03:31 #251184 by auto-mation-assist
I did isolate the cause of this problem as described below. I think changes such as this should be incorporated in gmoccapy.py
.
The value being passed to Gremlin dro.set_property("metric_units" is 1/25.4 instead of True or False at start up. This variable is not declared in the self.dro_dic = {}, and data is routed to it is coming from the wrong source, self.widgets.gremlin.set_property("metric_units", int( self.stat.linear_units ) )

This gives it a scaling value instead of True or False.

My line numbers are approximate for

For testing I added this to the self.dro_dic = {}
at about line 650
dro.set_property("metric_units", False)

And this under def _init_gremlin( self ):
at about line 2072
dro = self.dro_dic[list(self.dro_dic.keys())[0]]
self.widgets.gremlin.set_property("metric_units", dro.metric_units)

With these lines added the preview display is correct at start up.

dro.set_property("metric_units", False) or set to True depending  on desired default value.

This ends up routing to:

**** Entering init gremlin ****
dro object is  <combi_dro.Combi_DRO object at 0x7f14f12cffc0 (Combi_DRO at 0x562b81b5b330)>
combi_dro.Combi_DRO metric units  False

linear_units is  0.03937007874015748 and was the prior incorrect variable used for configuring the gremlin dro's (not True or False)

As a note I find that there are so many uses of "unit" versions that it gets very confusing
Last edit: 05 Sep 2022 03:31 by auto-mation-assist. Reason: Added more notes to the suggested changes

Please Log in or Create an account to join the conversation.

Moderators: newbynobiHansU
Time to create page: 0.190 seconds
Powered by Kunena Forum