Passing parameters from front end to macro

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
maheshkavre
Posts: 9
Joined: Fri Nov 15, 2019 5:39 am

Passing parameters from front end to macro

Post by maheshkavre »

Hello, I am Mechanical engineering student, I want small help.... If possible please help, My query is:
Supposr I have to make a Disk having diametet "D" and thickness 'T' , now if I make Front end to take input from user and i want to send that parameters to macro file and making my macro to run automatically.
If above things are possible
Then ,
1)in which programming language i should make front end so that I can send parameters to macro
2)how can i link that front end to my macro of FreeCAD

Kindly guide.....
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Passing parameters from front end to macro

Post by openBrain »

Hi,

Language will be Python where you use PySide (Qt binding) to design the GUI.
IMO your strategy isn't the right one. Actually you have to consider that your macro will create the front-end then expose it to the user and finally process the data once user validate them. It will be a sequential process entirely held in the same macro. ;)
maheshkavre
Posts: 9
Joined: Fri Nov 15, 2019 5:39 am

Re: Passing parameters from front end to macro

Post by maheshkavre »

Thank you for your response....
My thinking is like..... My freeCAD will be open in back end
And my front is open for user ..... As he enters values of D and T and when he click "Generate" button, my macro should run automatically and geometry should be done as per passed parameters in backend.

Is it possible in FreeCAD??
In this case is my front end is by using Pyside?? Or using different language??
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Passing parameters from front end to macro

Post by openBrain »

I still think using Python is a good deal. Doing so, you can not exactly run FreeCAD as a back-end, but import FreeCAD in your Python script and directly run FreeCAD routines from there. ;)
And yes, I'd choose PySide for front-end GUI.
maheshkavre
Posts: 9
Joined: Fri Nov 15, 2019 5:39 am

Re: Passing parameters from front end to macro

Post by maheshkavre »

Oky, thank you for your guidance
maheshkavre
Posts: 9
Joined: Fri Nov 15, 2019 5:39 am

Re: Passing parameters from front end to macro

Post by maheshkavre »

As per our above discussion,
If I make web based front end using Python "Django" is it possible to import freeCAD in that web page.

Means if I create web based front end and if I take required parameters from user and suppose I made "Generate Geometry" button on front end

Once user click on generate geometry button, is it possible that new tab will open and my geometry will generate in new tab (using MACRO feature of Freecad)
Post Reply