Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

cadhub.xyz integration #893

hrgdavor started this conversation in Ideas
cadhub.xyz integration #893
Jul 24, 2021 * 8 comments * 7 replies
Return to top
Discussion options

hrgdavor
Jul 24, 2021
Collaborator

test integration is available https://cadhub.xyz/dev-ide/jscad

https://cadhub.xyz/ is aiming to create a community of people that enjoy to code CAD.

@z3dev I have implemented a prototype integration using the prototype render-worker. This will also pinpoint important requirements that a render worker for jscad should have so people can integrate jscad into their website.

After a prototype is working I will prepare code suitable for master branch (scrappy code in prototype will need rework after proof of concept )

I am communicating with https://github.com/Irev-Dev the owner of the https://github.com/Irev-Dev/cadhub

  • with parameters 2021-08-08
  • with grid and Z=UP 2021-08-10

update 2021-09-12

it is live !

You must be logged in to vote

Replies: 8 comments 7 replies

Comment options

Irev-Dev
Jul 24, 2021

Hey,
Just chiming in to say would be awesome to have JSCAD to working with CadHub. We've currently got OpenSCAD and CadQuery working in our online IDE. JSCAD will work well since it can run client side

Hopefully CadHub is able to contribute to much of the social and sharing aspects.

You must be logged in to vote
0 replies
Comment options

SimonClark
Jul 31, 2021
Collaborator

I think this is a great idea. I started working on something similar at http://community.mrfantsypants.com/ with the intention of posting both complete jscad models, and importable modules/libraries. For libraries, it handles targeting specific versions, plus version wildcards (2.4.*), which I think is a valuable capability.

If cadhub can fill the need, I'm more than happy to share what I've built so far, and move on to other ideas.

Currently, jscad seems to not be able to import web-based modules/libraries. The syntax

const { screw } = require('https://openjscad.xyz/remote.pl?url=http://community.mrfantsypants.com/screwhole.js')

should work, but does not. I've not had enough time to understand the underlying code, and debug.

You must be logged in to vote
4 replies
Comment options

hrgdavor Jul 31, 2021
Collaborator Author

The reason is pretty simple: remote.pl is not adding Access-Control-Allow-Origin header to the response.
That exact header is the reason you can include scripts from github, but not the example script you mentioned.

edit: it should work on https://openjscad.xyz without the header, but such script would not work on a different website evaluating jscad scripts (like cadhub) .... so yes, there is also a bug in openjscad.xyz

importable modules should be hosted in NPM and/or github, or at least somewhere where they have Access-Control-Allow-Origin: *

Comment options

z3dev Aug 1, 2021
Maintainer

It's not that simple. There's no support for remote loading of scripts.

This has been requested for years and there's no easy solution. Just filter the issues for "Collaboration"

Comment options

hrgdavor Aug 1, 2021
Collaborator Author

It would not be hard to add. But support for remote scripts would be counter productive in the long run. Websites come and go, but npm and git are not likely to disappear just like that.

A tutorial on how to make a jsdad module and publish on npm is something we could add.

Comment options

SimonClark Aug 1, 2021
Collaborator

so, we could host the module metadata and drive discoverabilty on cadhub, etc, host the scripts themselves on github/npm. I don't think code-hosting itself is critical to improve jscad adoption. Object discoverability is.

Comment options

Irev-Dev
Aug 1, 2021

Live here.
https://cadhub.xyz/dev-ide/jscad
The dev-ide route is not accessible from the rest of the website so is meant for us to put proof of concepts up, so the initial implementation is working thanks to @hrgdavor but there's probably some bugs lurking.

You must be logged in to vote
0 replies
Comment options

hrgdavor
Aug 4, 2021
Collaborator Author

script parameters in progress

css is added to match to extent style of cadhub. Thee are few things to iron-out but it is working in general.

You must be logged in to vote
1 reply
Comment options

Irev-Dev Aug 8, 2021

The above customizer is now working at https://cadhub.xyz/dev-ide/jscad too.

Comment options

hrgdavor
Aug 10, 2021
Collaborator Author

updated version is live with grid and Z=UP

You must be logged in to vote
0 replies
Comment options

z3dev
Sep 2, 2021
Maintainer

This is all great stuff! From the JSCAD project standpoint, there should be and are various ways to wrap the JSCAD components, and create applications. I'm glad to see another example.

I'm just now getting back into the swing of things and will try out the latest and greatest cadhub. Sadly, I won't have much time to work on this as there are plenty of fixes / enhancements to complete on the JSCAD components. But I will try to add some thoughts on this discussion and more.

@hrgdavor thanks again for taking a big part. if there are some reusable pieces or changes to JSCAD components then please let us know. This is the place to discuss changes.

@Irev-Dev thanks for adding JSCAD support. hopefully, it wasn't too hard. ;)
it would be good to understand and issues found, and hopefully things can change incrementally to make the integration easier.

You must be logged in to vote
2 replies
Comment options

hrgdavor Sep 2, 2021
Collaborator Author

@z3dev this PR #891 is something I would like to have integrated into cadhub, currently the demo integration uses official version jscad and copy of the script that does the new parameter definition parsing.

Also the worker used to run the the jscad scripts in cadhub is also the prototype I am working on for some time that is intended to be added to jscad in a PR (hopefuly soon I will clean it to be presentable).

Regarding the cadhub integration part, I will gladly take-over whatever is needed in cadhub for jscad.

Comment options

Irev-Dev Sep 2, 2021

Our pleasure @z3dev, and @hrgdavor definitely deserves most of the credit for making the integration work.

Because I wanted to wait until we heard back from you, we got the integration working in our IDE, but without allowing projects to be saved, so we'll progress with that now and will report back when it's fully released. It would be good to get some examples from the community on CadHub at that point :)

Comment options

hrgdavor
Sep 12, 2021
Collaborator Author

it is live !!!

You must be logged in to vote
0 replies
Comment options

Irev-Dev
Sep 20, 2021

We wanted to add "about" info for the packages we support and @franknoirot has added a badge in the top right hand corner of the editor opens a tab with some information.

Atm it's very basic but we'll likey add to it but of course other's are free to make PRs to improve it since you all are in a better position to describe JSCAD. The markdown file can be found here.
https://github.com/Irev-Dev/cadhub/blob/main/app/web/src/helpers/cadPackages/jsCad/userGuide.md

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
4 participants