Stepconf destroy postgui_custom.hal
Why stepconf overwrites the postgui_custom.hal file while it leaves untouched custom.hal?
I believe that the problem is here:
custom = os.path.join(base, "custom_postgui.hal")
if os.path.exists(custom):
shutil.copy( custom,os.path.join(base,"postgui_backup.hal") )
f1 = open(custom, "w")
Did I do something wrong?
Nicola.
Please Log in or Create an account to join the conversation.
The custom file is not overwritten so custom code will not be destroyed, but unfortunately most code requires to be added after the GUI loads - so most code needs to be in the postgui file.
probably a better way (one that pncconf uses) is have the postgui code call a user hal file after all the machine written code.
This user file would not be overwritten.
Put another way have the postgui file call the custom hal file.
Even better would be to have stepconf smart enough to work around custom code but I think that is just do difficult to do well.
Chris M
Please Log in or Create an account to join the conversation.
it overwrite the custom post gui file because it allows the users to select options that require changes in the file.
Ok, you're right. So I think this row is useless:
shutil.copy( custom,os.path.join(base,"postgui_backup.hal") )
probably a better way (one that pncconf uses) is have the postgui code call a user hal file after all the machine written code.
This user file would not be overwritten.
Put another way have the postgui file call the custom hal file.
The easiest way I think is tell of stepconf just append a second file at the end of custom_postgui.hal. Like:
cat user_custom_postgui.hal >> custom_postgui.hal.
Or I can update the ini file to include user_custom_postgui.hal.
1) Do you think I can add additional POSTGUI_HALFILE lines?:
POSTGUI_HALFILE = custom_postgui.hal
POSTGUI_HALFILE = user_custom_postgui.hal
Or can I put other files in same row?:
POSTGUI_HALFILE = custom_postgui.hal; user_custom_postgui.hal
2) Is there a way to call a hal file within another?:
load user_custom_postgui.hal
Even better would be to have stepconf smart enough to work around custom code but I think that is just do difficult to do well.
To differentiate the stepconf lines those custom lines, I might add comment lines like many programs, such as:
#### do not remove this line ####
What I do not know is whether there are precedence in command of hal files. In this case I would not know how to handle the lines.
Thanks, Nicola.
Please Log in or Create an account to join the conversation.
Ok, you're right. So I think this row is useless:
Originally maybe someone wanted to save the file and then he left there these lines.shutil.copy( custom,os.path.join(base,"postgui_backup.hal") )
This was me it is done so if the user modified the postgui file (like most will) then uses stepconf again
they have a chance to not lose their hard work.
I think this is risky order of stuff is important.The easiest way I think is tell of stepconf just append a second file at the end of custom_postgui.hal. Like:
cat user_custom_postgui.hal >> custom_postgui.hal.
and if the user continues to edit and re use stepconf you will add it twice or need to add code to check for it...
Nope.Or I can update the ini file to include user_custom_postgui.hal.
1) Do you think I can add additional POSTGUI_HALFILE lines?:
POSTGUI_HALFILE = custom_postgui.hal
POSTGUI_HALFILE = user_custom_postgui.hal
Or can I put other files in same row?:
POSTGUI_HALFILE = custom_postgui.hal; user_custom_postgui.hal
Yes this is what i was referring to:2) Is there a way to call a hal file within another?:
load user_custom_postgui.hal
source [some_filename]
Even better would be to have stepconf smart enough to work around custom code but I think that is just do difficult to do well.
To differentiate the stepconf lines those custom lines, I might add comment lines like many programs, such as:
#### do not remove this line ####
What I do not know is whether there are precedence in command of hal files. In this case I would not know how to handle the lines.
Thanks, Nicola.
The problem with mixing user code and configuration made code in the same file is the complication that the user is
unpredictably dangerous
I'm sure it can be done.
then one needs to also look at how we offer custom snipits of code as examples.
They always mention the postgui file. better to leave this file for the user to play with alone.
In pncconf the INI calls a postgui 'jumpfile' that jump file has source commands in it.
One source command isused to call postgui.hal.
While slighly more complicated and unusual it separates config made code from user made code pretty well.
Chris M
Please Log in or Create an account to join the conversation.
thanks for your answer.
I looked in the documentation but could not find anything about "source" command But it seems to work.
About pncconf seems to have a much more complex management for hal files. I think I will copy and paste the pncconf code inside stepconf.
Pncconf 1.1 revamped by Chris Morley 2014
Nicola.
Please Log in or Create an account to join the conversation.
Stepconf was originally built and maintained by some one else.
His objectives were different then mine - I tried to honour the differences when I updated to newer glade files.
Pncconf was my baby so I was free to do as I pleased - right or wrong
I'm a little tired of both so am glad you are interested !
It's a very import part of linuxcnc.
Chris M
Please Log in or Create an account to join the conversation.
I have not thought about using man pages, I usually find everything on the web.man halcmd does show the source command... it's a little used gem.
Well done!Pncconf was my baby so I was free to do as I pleased - right or wrong
Have you a Mesa card for your cnc machine?
Uh? Please stay here!I'm a little tired of both so am glad you are interested !
I came here for two months and I have not done anything with my milling machine , I'm not good enough to do what you did.
Nicola.
Please Log in or Create an account to join the conversation.
I have a large okuma lathe that uses mesa (never quite finished but works)
I have a sherline mill that uses mesa.
I am not a very good programmed but I am tenacious. I hack till it works. after so many years it just looks like I might know something
I enjoy the mental challenge.
Welcome to linuxcnc !
Chris M
Please Log in or Create an account to join the conversation.
Now stepconf writes 3 files:
postgui_call_list.hal
pyvcp_options.hal
custom_postgui.hal
The last file is never overwritten. I hope I have not done too much confusion.
I did not understand if the Mesa cards can directly control motors or if you need to buy another "power card".I have a large okuma lathe that uses mesa (never quite finished but works)
I have a sherline mill that uses mesa.
Thanks.Welcome to linuxcnc !
Nicola.
Please Log in or Create an account to join the conversation.
Typically people are talking about Mesa interface cards then control other servo/stepper amplifiers
But you can do either - Mesa sells amplifier cards too.
Chris M
Please Log in or Create an account to join the conversation.