Edit a spreadsheet value and save document

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
onekk
Veteran
Posts: 6222
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Edit a spreadsheet value and save document

Post by onekk »

why use freecadcmd when you want a GUI view?

in this case it is better to load the py file simply with file - open, and doing this, the file could be executed simply using the macro toolbar hitting the "green arrow" and having the gui to rotate and do all the things you want.

if you use freecadcmd you are telling FreeCAD to run in "command mode only" in other word the GUI is not used so there is no way to use a thing that you have purposely switched off when invoking FreeCAD in this way.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Edit a spreadsheet value and save document

Post by openBrain »

onekk wrote: Fri May 07, 2021 5:46 pm in this case it is better to load the py file simply with file - open, and doing this, the file could be executed simply using the macro toolbar hitting the "green arrow" and having the gui to rotate and do all the things you want.
Why waste time? You can just pass the script as an argument to freecad (GUI) command. ;)
qlerebours
Posts: 9
Joined: Thu May 06, 2021 3:45 am

Re: Edit a spreadsheet value and save document

Post by qlerebours »

onekk wrote: Fri May 07, 2021 5:46 pm why use freecadcmd when you want a GUI view?
I will explain my use case more precisely: What I need, is to "run jobs" that should:
- open a document
- edit dimensions in them
- recompute
- save the file
- extract a PDF or image
and all of this has to be done on a server that will be called by a web application
This is why my first thought was to do it without gui, change the properties and then export
Do you think it can be done (whatever the way it uses)?
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Edit a spreadsheet value and save document

Post by openBrain »

qlerebours wrote: Sat May 08, 2021 5:51 am Do you think it can be done (whatever the way it uses)?
As I said just above, just pass your script as argument to the normal/Gui freecad command. It will execute the script in GUI environment then exit.
User avatar
onekk
Veteran
Posts: 6222
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Edit a spreadsheet value and save document

Post by onekk »

openBrain wrote: Fri May 07, 2021 6:27 pm
onekk wrote: Fri May 07, 2021 5:46 pm in this case it is better to load the py file simply with file - open, and doing this, the file could be executed simply using the macro toolbar hitting the "green arrow" and having the gui to rotate and do all the things you want.
Why waste time? You can just pass the script as an argument to freecad (GUI) command. ;)
Thanks, this is a thing that I'm missing.

Do you know if it works with AppImage too?

Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
qlerebours
Posts: 9
Joined: Thu May 06, 2021 3:45 am

Re: Edit a spreadsheet value and save document

Post by qlerebours »

openBrain wrote: Sat May 08, 2021 6:09 am
qlerebours wrote: Sat May 08, 2021 5:51 am Do you think it can be done (whatever the way it uses)?
As I said just above, just pass your script as argument to the normal/Gui freecad command. It will execute the script in GUI environment then exit.
I will try this today but I think that it will be hard to run on a linux server for instance, since it will run the GUI and most server are not configure to have GUI, right?
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Edit a spreadsheet value and save document

Post by openBrain »

qlerebours wrote: Sat May 08, 2021 9:09 am I will try this today but I think that it will be hard to run on a linux server for instance, since it will run the GUI and most server are not configure to have GUI, right?
Sure. But I'm not sure PDF export is available in console mode.
Post Reply