How to run JSCAD from another application ?
-
One of the things other users have asked for is to have a showcase page/website to link to interesting projects using jscad and of course if those projects link back that helps too.
This would help to build an active community and give incentive for others to join.
I am sure @z3dev would like this too.
I would not go overboard with big ideas, but instead small steps in that direction (like that url proposal for integration and sharing). I would like to connect with you as you are active here (from what I can see) .

-
@hrgdavor With V1 I was able to make a little page where users could choose a model (or import one) then a jscad script, so that the script runs using the model to do something.
. It worked but was buggy with some CSG operations on some models. For those who wanted to learn JSCAD it was possible to export to .jscad and have the full script to learn from it. And for scripts that create lots of 2d data, it exported to multipage pdf. Sadly I don't know how to do the same with V2.For the moment, I made a V2 version of the "tranchage / 2 axes" (2 axis slicer) that makes a skeleton and is useful to make cardboard furniture, but it cannot be used online and need to be download locally in order to be able to add 3d model to be processed, so it's not easy to put that on a website, and I'm making those devs not only for myself but mostly for other cardboard craftsperson and most of them have no knowledge of computer science and they don't understand how to use it. It is here : https://github.com/gilboonet/gilboonet.github.io/blob/master/sq_edit/sqed.zip (uncompress the zip into a folder, and open it as a project from jscad, it can use any .obj file that you put into the folder, enter its name (without .obj) into "volume" parameter)
Last week, I started to explain to someone how to make basic patterns for scroll saw, and I struggled to explain to him that there's no built-in function for projection and that he needs to use the functions that I wrote for that as a workaround. That made this basic project to hard for a beginner.
I'm currently working on a project that I stared very long time ago when JSCAD was alpha : a furniture customizer, I will add a post on the forum when I have a first working example.
-
I will try to do it using the react component from this topic : https://openjscad.nodebb.com/topic/248/react-library-v2
-
That is a very interesting use-case.
One thing that comes to mind is that for example if you can have an additional type of parameter (file) we could make a script that returns empty array in the begining and then when file is uploaded into that paremeter (local file, or external url) the you can play with other options.
It would be a type of script that would work directy on the openjscad.xyz ... and of-course in that case emdbeded in your website for example.
I will look into it and see if I can incorporate support for the use-case in the new jscad website.
-
@hrgdavor super idea.
For now, maybe a new page in the user guide would help.
-
@gilboonet said in How to run JSCAD from another application ?:
Last week, I started to explain to someone how to make basic patterns for scroll saw, and I struggled to explain to him that there's no built-in function for projection and that he needs to use the functions that I wrote for that as a workaround. That made this basic project to hard for a beginner.
There’s a new projection function in the works. Hopefully, it will be available in one or two weeks.
-
For now, maybe a new page in the user guide would help.
ok, I am ok with that, but for what part exactly ?

-
There’s a new projection function in the works. Hopefully, it will be available in one or two weeks.
there is need for projection and slice ...
although one could make a thin slice with subtract and then use projection to make a 2d shape out of it.
-
@hrgdavor sorry
A page that showcases various usage of JSCAD.
-
@z3dev That's great news.
-
Hi ,
I have taken your script and added some performance improvements to enable cool user interaction with the slicer
http://3d.hrg.hr/jscad/three/threejscad.html?uri=examples/sqed/index.js
by default "model preview" is ON and you can see the slices in 3D superimposed over the selected obj model.
speed improvements mean you can move sliders and have live preview.

if you uncheck the "model preview" you will get the 2d view of the parts with all the cuts for interconnecting like in the original version.

I will look into making a a new type of param that is file upload/url so that way users can use your script with their model just by accessing the website and no needing to know how to tweak the script.
this version ov jscad viewer has only stl export (I was lazy and it is only one I use) ... how did you generate PDF ?
-
@hrgdavor You did really nice improvements. On the V2 version I don't export to PDF, but only to a big SVG. On the V1 version that exports to PDF, my scripts create a file with data on what needs to be rendered (triangle, text, line, next page, etc) and the PDF button fires a node js script that read that file and create a pdf from it, as I didn't find a way to fire that button with V2 I didn't add it.
-
PDF button fires a node js script that read that file and create a pdf from it, as I didn't find a way to fire that button with V2 I didn't add it.
can u share that script ?
-
@hrgdavor Yes, it can be found here :
- html (derived from min.html of v1) with the .jscad code https://github.com/gilboonet/gilboonet.github.io/blob/master/OpenJSCAD.org/packages/web/scripts.html
- js (derived from index.js of v1) with the code to create pdf, (creePDF) : https://github.com/gilboonet/gilboonet.github.io/blob/master/OpenJSCAD.org/packages/web/dist/scripts.js
To work the .jscad needs to push data into an array (see creePDF to see possibles types of data) that is then put into a localStorage parameter. The script that's into the textarea with id="zc_tranches02" contains the script for the V1 2 axis slicer and it pushes data that way. But, as I didn't manage to have localStorage work with V2, I don't know if it is possible.
-
@gilboonet if not localStorage, postMessage could work ... as design is running in worker.
and I will look into how to integrate more closely so we can communicate with the embeded jscad script.
-
@hrgdavor yes, the method I used was what was available but any other could replace it. The purpose is to get data from the embedded jscad script and create a pdf file from it that can then be downloaded or directly viewed into the browser.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login