Reading values from qtdragon.pref.
- wusel0464
- Offline
- Senior Member
Less
More
- Posts: 56
- Thank you received: 6
31 Dec 2024 13:44 #317716
by wusel0464
Reading values from qtdragon.pref. was created by wusel0464
Hello,
is it possible and if so how can I read values from qtdragon.pref and use them in a macro or an MDI call, for example?
Best wishes and a happy New Year to everyone. Frank
is it possible and if so how can I read values from qtdragon.pref and use them in a macro or an MDI call, for example?
Best wishes and a happy New Year to everyone. Frank
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
Less
More
- Posts: 7780
- Thank you received: 2075
01 Jan 2025 05:19 #317760
by cmorley
Replied by cmorley on topic Reading values from qtdragon.pref.
Here is a novel way:
save this as myofile.ngc is a path described in the INI's PROGRAM_PREFIX or SUBROUTINE_PATH
Then call it as an oword:
o<myofile> call
save this as myofile.ngc is a path described in the INI's PROGRAM_PREFIX or SUBROUTINE_PATH
(filename myofile.ngc)
o<myofile> sub
;py,from interpreter import *
;py,import os
;py,from qtvcp.lib.preferences import Access
; find and print the preference file path
;py,CONFPATH = os.environ.get('CONFIG_DIR', '/dev/null')
;py,PREFFILE = os.path.join(CONFPATH,'qtdragon.pref')
;py,print(PREFFILE)
; get an preference instance
;py,Pref = Access(PREFFILE)
; load a preference and print it
;py,this.params['toolToLoad']=Pref.getpref('Tool to load', 0, int,'CUSTOM_FORM_ENTRIES')
;py,print('Tool to load->:',this.params['toolToLoad'])
; return the value
o<myofile> endsub [#<toolToLoad>]
M2
Then call it as an oword:
o<myofile> call
Please Log in or Create an account to join the conversation.
- wusel0464
- Offline
- Senior Member
Less
More
- Posts: 56
- Thank you received: 6
01 Jan 2025 12:18 #317770
by wusel0464
Replied by wusel0464 on topic Reading values from qtdragon.pref.
Hello,
Thank you very much for your quick help.
I'll try in the next few days to see if I can do it the way I thought I would.
The reason is actually quite simple, I want to use my camera offset
that I assigned to an MDI button from the qtdragon setup so that I don't have to enter the values in different places.
At some point I'll forget and then I'll be surprised.
A happy new year to everyone and best wishes, Frank.
Thank you very much for your quick help.
I'll try in the next few days to see if I can do it the way I thought I would.
The reason is actually quite simple, I want to use my camera offset
that I assigned to an MDI button from the qtdragon setup so that I don't have to enter the values in different places.
At some point I'll forget and then I'll be surprised.
A happy new year to everyone and best wishes, Frank.
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.056 seconds