V2 Update
-
HEADS UP! Please get the latest version of JSCAD V2, as there have been some BIG name space changes in the modeling API.
- math => maths
- geometry => geometries
These are the last major changes to the modeling API, as all big changes have been completed.
The WEB UI is now quite usable for creating designs. It's best to drag-n-drop project folders to the window, and work with the pieces via a favorite editor. If "Enable auto reload" is checked then changes will be detected, and rendered again.
For those wanting to get hold of JSCAD V2, it's still in 'early adoption' mode. But you can get started here.
And a BIG THANKS for everyone that has provided feedback. Keep those comments coming!
-
Thank you for the Windows fix It is working great for me now.
-
@z3dev I don't have a real implementation of projection, but I'm using a function that returns a 2d geometry from a 3d one, it needs an axis and retrieve polygons from the 3d geometry that lies on this axis or are paralleled. It works well with intersection of the 3d geometry and a cuboid. If you use it, beware, I suspect that I am mistaken with axes (X, Y, Z) affectations as I need to reverse the points for 'y'.
function vol2surf(vol, axe, orig = 0){ // axe = 'x' | 'y' | 'z' var n, pts, ok, P, i, pt; let S = []; var X, Y, Z; for(n = 0; n < vol.polygons.length; n++){ pts = []; P = vol.polygons[n]; ok = true; switch(axe){ case 'x': X = 1; Y = 2; Z = 0; break; case 'y': X = 0; Y = 2; Z = 1; break; case 'z': X = 0; Y = 1; Z = 2; break; } for(i=0; (i < P.vertices.length) && ok; i++){ pt = P.vertices[i]; if(Math.abs(pt[Z] - orig)< 0.05){ pts.push([pt[X], pt[Y]]); } else { ok = false; } } if (ok){ if(axe == 'x'){ S.push(polygon({points:pts.reverse()})); } else { S.push(polygon({points:pts})); } } } return S; }
-
@gilboonet said in V2 Update:
Hello, I'm restarting to test V2.
I'm on Ubuntu 20 64 bits, Firefox 79. There was a 404 error on the downloading of fonts, my package/web didn't have assets directory, so I took it from package/desktop, but not there's an error with the fonts files, maybe those from desktop are not the good ones ?This is from the CSS file, which specifies a specific font to access. We'll remove this at a later time, so please ignore.
- I noticed that when you populate an array with geometries that will be returned, if there are empty values, it fires an error. For the moment I filter them by geometry.polygons.length > 0.
Thanks. I created issue 665 for tracking and fixing this.
- Is there anything on v2 lib to do projection from 3d to 2d ?
Not yet. There have been several requests. Does anyone have an implementation of projection?
-
I now have a 2 axis slicer that works. It made me notice that when you get a slice from x axis (keep points y and z from a polygon points having same x) you must reverse points order, but when you get a slice from y axis (keep points x and z from points with same y), you don't have to reverse points order. I hope this stays the same for all kinds of 3d models. -
@gilboonet One more little feedback : it was not hard to adapt my code from V1 and I was even able to improve it. On this capture is the result of an intersection, it is retrieved into one bunch of polygons and my code split them so I'm able to cut each one in two equal parts.
-
Hello, I'm restarting to test V2.
-
I'm on Ubuntu 20 64 bits, Firefox 79. There was a 404 error on the downloading of fonts, my package/web didn't have assets directory, so I took it from package/desktop, but not there's an error with the fonts files, maybe those from desktop are not the good ones ?
-
I noticed that when you populate an array with geometries that will be returned, if there are empty values, it fires an error. For the moment I filter them by geometry.polygons.length > 0.
-
Is there anything on v2 lib to do projection from 3d to 2d ?
-
This version seems very cool.
-
-
Yes, absolutely. I will file bugs right away after verifying that the issue is still present in the latest version. Very excited about the pace of changes.
-
@BarbourSmith Thanks much.
Can you create new issues for these two bugs?
https://github.com/jscad/OpenJSCAD.org/issues
Next, keep your local copy of OpenJSCAD.org up to date, as there are changes being made almost daily now.
-
I am very much willing to test and help. I'm not particularly knowledgeable, but I'm excited to give V2 a go.
-
@BarbourSmith thanks.
those test cases create files on the fly, and it seems that the paths to those files are not the same on windows.
we definitely needs some testing / fixes on windows. anyone willing to help?
-
Update:
I am able to launch the web viewer, however I am seeing what seems to be a related error there:
-
Hey everyone, I went to give V2 a test and I'm running into an issue when running the tests. Here's what I'm seeing:
Edit: This is on windows.
─ @jscad/svg-deserializer: 28 tests passed @jscad/core: > @jscad/core@1.4.0 test C:\Users\Bar\OpenJSCAD.org\packages\core @jscad/core: > ava './**/*.test.js' --verbose --timeout 2m @jscad/amf-serializer: > @jscad/amf-serializer@1.0.0 test C:\Users\Bar\OpenJSCAD.org\packages\io\amf-serializer @jscad/amf-serializer: > ava --verbose --timeout 2m 'tests/**/*.test.js' @jscad/amf-serializer: √ serialize 3D geometry to amf @jscad/amf-serializer: ─ @jscad/amf-serializer: 1 test passed @jscad/core: × webRequire: should support require, from a single file Error thrown in test @jscad/core: × webRequire: should support require, from a directory with index.js Error thrown in test @jscad/core: × webRequire: should support require, from a directory with index.json Error thrown in test @jscad/core: × webRequire: should support require, from a directory with project.json Error thrown in test @jscad/core: × webRequire: should support require, from a directory with dependent files Error thrown in test @jscad/core: × webRequire: should allow using require.extensions like the native node require (simple) Error thrown in test @jscad/core: × webRequire: should allow using require.extensions like the native node require (parser) Error thrown in test @jscad/core: ─ @jscad/core: webRequire: should support require, from a single file @jscad/core: code-loading\webRequire.test.js:15 @jscad/core: 14: let requireFn = makeWebRequire(singleFileJs, { apiMainPath }) @jscad/core: 15: let designRootModule = requireFn(singleFileJs[0].fullPath) @jscad/core: 16: @jscad/core: Error thrown in test: @jscad/core: Error { @jscad/core: message: 'Cannot find relative path to module C:\\logo.js', @jscad/core: } @jscad/core: » _require (code-loading/webRequire.js:182:13) @jscad/core: » code-loading/webRequire.test.js:15:26 @jscad/core: webRequire: should support require, from a directory with index.js @jscad/core: code-loading\webRequire.test.js:34 @jscad/core: 33: const requireFn = makeWebRequire(directoryWithIndexJs, { apiMainPath }) @jscad/core: 34: const designRootModule = requireFn('/project') @jscad/core: 35: @jscad/core: Error thrown in test: @jscad/core: Error { @jscad/core: message: 'Cannot find relative path to module C:\\project', @jscad/core: } @jscad/core: » _require (code-loading/webRequire.js:182:13) @jscad/core: » code-loading/webRequire.test.js:34:28 @jscad/core: webRequire: should support require, from a directory with index.json @jscad/core: code-loading\webRequire.test.js:44 @jscad/core: 43: const requireFn = makeWebRequire(directoryWithIndexJson, { apiMainPath… @jscad/core: 44: const designRootModule = requireFn('/project') @jscad/core: 45: @jscad/core: Error thrown in test: @jscad/core: Error { @jscad/core: message: 'Cannot find relative path to module C:\\project', @jscad/core: } @jscad/core: » _require (code-loading/webRequire.js:182:13) @jscad/core: » code-loading/webRequire.test.js:44:28 @jscad/core: webRequire: should support require, from a directory with project.json @jscad/core: code-loading\webRequire.test.js:54 @jscad/core: 53: const requireFn = makeWebRequire(directoryWithPackageJson, { apiMainPa… @jscad/core: 54: const designRootModule = requireFn('/project') @jscad/core: 55: @jscad/core: Error thrown in test: @jscad/core: Error { @jscad/core: message: 'Cannot find relative path to module C:\\project', @jscad/core: } @jscad/core: » _require (code-loading/webRequire.js:182:13) @jscad/core: » code-loading/webRequire.test.js:54:28 @jscad/core: webRequire: should support require, from a directory with dependent files @jscad/core: code-loading\webRequire.test.js:66 @jscad/core: 65: registerAllExtensions(fakeFs, requireFn) @jscad/core: 66: const designRootModule = requireFn('/project') @jscad/core: 67: @jscad/core: Error thrown in test: @jscad/core: Error { @jscad/core: message: 'Cannot find relative path to module C:\\project', @jscad/core: } @jscad/core: » _require (code-loading/webRequire.js:182:13) @jscad/core: » code-loading/webRequire.test.js:66:28 @jscad/core: webRequire: should allow using require.extensions like the native node require (simple) @jscad/core: code-loading\webRequire.test.js:102 @jscad/core: 101: @jscad/core: 102: const designRootModule = requireFn(mainPath) @jscad/core: 103: t.true('main' in designRootModule) @jscad/core: Error thrown in test: @jscad/core: Error { @jscad/core: message: 'Cannot find relative path to module C:\\logo.jscad', @jscad/core: } @jscad/core: » _require (code-loading/webRequire.js:182:13) @jscad/core: » code-loading/webRequire.test.js:102:28 @jscad/core: webRequire: should allow using require.extensions like the native node require (parser) @jscad/core: code-loading\webRequire.test.js:151 @jscad/core: 150: @jscad/core: 151: const designRootModule = requireFn(mainPath) @jscad/core: 152: @jscad/core: Error thrown in test: @jscad/core: Error { @jscad/core: message: 'Cannot find relative path to module C:\\examples\\logo.js', @jscad/core: } @jscad/core: » _require (code-loading/webRequire.js:182:13) @jscad/core: » code-loading/webRequire.test.js:151:28 @jscad/core: ─ @jscad/core: 7 tests failed @jscad/core: npm ERR! code ELIFECYCLE @jscad/core: npm ERR! errno 1 @jscad/core: npm ERR! @jscad/core@1.4.0 test: `ava './**/*.test.js' --verbose --timeout 2m` @jscad/core: npm ERR! Exit status 1 @jscad/core: npm ERR! @jscad/core: npm ERR! Failed at the @jscad/core@1.4.0 test script. @jscad/core: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. @jscad/core: npm ERR! A complete log of this run can be found in: @jscad/core: npm ERR! C:\Users\Bar\AppData\Roaming\npm-cache\_logs\2020-08-17T20_27_15_357Z-debug.log lerna ERR! npm run test exited 1 in '@jscad/core' lerna WARN complete Waiting for 2 child processes to exit. CTRL-C to exit immediately. npm ERR! Test failed. See above for more details.
-
Nice! I'll pull it down tonight.