Generating coil spring drawings from a web application

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
mani_gs
Posts: 1
Joined: Thu Apr 30, 2020 3:46 am

Generating coil spring drawings from a web application

Postby mani_gs » Thu Apr 30, 2020 3:56 am

Dear Friends,
I am new to FreeCAD. I am developing a Web application for designing coil springs (Compression, tension, torsion). Like this one (this is in the early stage of development) https://mani-developer.github.io/springdesigner/ . Instead of having a static image of the spring, we would like to generate the drawing using FreeCAD based on the customer input parameters and display the same on the screen (either as image or pdf). Have any one tried anything similar to this ? Could you please guide me on how to proceed ?
mario52
Posts: 3215
Joined: Wed May 16, 2012 2:13 pm

Re: Generating coil spring drawings from a web application

Postby mario52 » Thu Apr 30, 2020 9:01 am

hi

c'est beau ça

for FreeCAD i make this macro Macro_FCSpring_Helix_Variable and simulate animation Macro_Spring (without sweep)

convert it in Java ...

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
amrit3701
Posts: 307
Joined: Mon Jun 13, 2016 5:37 pm

Re: Generating coil spring drawings from a web application

Postby amrit3701 » Thu Apr 30, 2020 9:37 am

mani_gs wrote:
Thu Apr 30, 2020 3:56 am
Dear Friends,
I am new to FreeCAD. I am developing a Web application for designing coil springs (Compression, tension, torsion). Like this one (this is in the early stage of development) https://mani-developer.github.io/springdesigner/ . Instead of having a static image of the spring, we would like to generate the drawing using FreeCAD based on the customer input parameters and display the same on the screen (either as image or pdf). Have any one tried anything similar to this ? Could you please guide me on how to proceed ?
Hi,

I did a lot of similar stuff, run FreeCAD at backend and show recomputed model to user on web browser.

I suggest you to use https://hub.docker.com/r/amrit3701/freecad-cli docker image for your web application. In this image, I compiled FreeCAD without GUI and it gives better performance.

You can use OBJ format as communication between FreeCAD and Web.

To render OBJ file on web browser you can use Three.js. Here is the example of how to load OBJ file in three.js (https://threejs.org/docs/#examples/en/loaders/OBJLoader)

How does the whole cycle work? :?:
Get parameter from frontend -> Change parameter values in FreeCAD -> Recomputed model -> Export OBJ file -> Send OBJ file to frontend -> Three.js load OBJ file and render your model on web browser.

Thanks,
User avatar
Kunda1
Posts: 8686
Joined: Thu Jan 05, 2017 9:03 pm

Re: Generating coil spring drawings from a web application

Postby Kunda1 » Thu Apr 30, 2020 12:35 pm

amrit3701 wrote:
Thu Apr 30, 2020 9:37 am
I suggest you to use https://hub.docker.com/r/amrit3701/freecad-cli docker image for your web application. In this image, I compiled FreeCAD without GUI and it gives better performance.
@amrit3701 Nice!
Perhaps we can add this to Compile_on_Docker or some variant page?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
bernd
Posts: 10915
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Generating coil spring drawings from a web application

Postby bernd » Thu Apr 30, 2020 4:18 pm

amrit3701 wrote:
Thu Apr 30, 2020 9:37 am
I did a lot of similar stuff, run FreeCAD at backend and show recomputed model to user on web browser.
wow cool, is an example available on the internet?
abdullah
Posts: 3565
Joined: Sun May 04, 2014 3:16 pm

Re: Generating coil spring drawings from a web application

Postby abdullah » Sun May 03, 2020 2:30 pm

amrit3701 wrote:
Thu Apr 30, 2020 9:37 am

How does the whole cycle work? :?:
Get parameter from frontend -> Change parameter values in FreeCAD -> Recomputed model -> Export OBJ file -> Send OBJ file to frontend -> Three.js load OBJ file and render your model on web browser.

Thanks,
Even for somebody so far away from web applications as me, this really sounds cool! :)
User avatar
sliptonic
Posts: 1971
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Generating coil spring drawings from a web application

Postby sliptonic » Sun May 03, 2020 5:52 pm

CADCloud is the most advanced FreeCAD-powered web application I've seen so far.
The production reference implementation is at justyour.parts.

Here's a torsion spring project I made. The 3D view shows a rendering problem that I think has been resolved now.

The github repo can be found at https://github.com/CADCloud/CADCloud

A gitter community to discuss it also exists.

@vejmarie is the guy to know.
vejmarie wrote: ping
User avatar
amrit3701
Posts: 307
Joined: Mon Jun 13, 2016 5:37 pm

Re: Generating coil spring drawings from a web application

Postby amrit3701 » Mon May 04, 2020 8:26 am

bernd wrote:
Thu Apr 30, 2020 4:18 pm
wow cool, is an example available on the internet?
No, I created apps for commercial companies and all the things are closed source. :( Anyway, now I am thinking to create a most simple FreeCAD web-based project which illustrates how to use FreeCAD as a CAD engine for 3D web application and share here soon.
User avatar
vejmarie
Posts: 680
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Generating coil spring drawings from a web application

Postby vejmarie » Tue May 05, 2020 12:46 am

amrit3701 wrote:
Mon May 04, 2020 8:26 am
bernd wrote:
Thu Apr 30, 2020 4:18 pm
wow cool, is an example available on the internet?
No, I created apps for commercial companies and all the things are closed source. :( Anyway, now I am thinking to create a most simple FreeCAD web-based project which illustrates how to use FreeCAD as a CAD engine for 3D web application and share here soon.
@bernd, and @amrit3701 this is closed to what CADCloud is doing except I am using xeogl as a renderer for the Wavefront OBJ object. We can easily re-implement amrit3701 idea. It is not the intend of CADCloud which is targeting more a github for open hardware project, but that might be a funny feature to add. Latency might be the challenge.
User avatar
vejmarie
Posts: 680
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Generating coil spring drawings from a web application

Postby vejmarie » Tue May 05, 2020 12:49 am

sliptonic wrote:
Sun May 03, 2020 5:52 pm
CADCloud is the most advanced FreeCAD-powered web application I've seen so far.
The production reference implementation is at justyour.parts.

Here's a torsion spring project I made. The 3D view shows a rendering problem that I think has been resolved now.

The github repo can be found at https://github.com/CADCloud/CADCloud

A gitter community to discuss it also exists.

@vejmarie is the guy to know.
vejmarie wrote: ping
Thanks for the support. Your bug is going to be fixed pretty soon. I am using on the server side the FreeCAD snap that I maintain (got more than 20k users now !). I just updated it to 0.19 (was soon running 0.19) but with many enhancement like OCCT 7.4 (which was required to fix the mesh generation of the Torsion Spring), qt5, python3 and latest master commit. I just finished to polish it tonight and released it on the snap store as a latest/release.