• V2 .xyz bug

    3
    2
    0 Votes
    3 Posts
    911 Views
    z3devZ
    See more information on the Node.js modules here: https://nodejs.org/dist/latest-v12.x/docs/api/modules.html#modules_folders_as_modules
  • V2 Update : 2020 SEP 18

    2
    1 Votes
    2 Posts
    473 Views
    z3devZ
    I forgot to mention that the renderer now includes a packaged library. See 'packages/utils/regl-renderer/dist/reglRenderer.js' This library can be used standalone in websites to render JSCAD geometries. This is for developers that want to implement other javascript components, like React.js based components, etc.
  • V2 Feedback : extrudeRotate

    1
    1
    0 Votes
    1 Posts
    429 Views
    No one has replied
  • About polygons winding

    8
    2
    0 Votes
    8 Posts
    1k Views
    gilboonetG
    I'm trying now csg on a .obj file imported (require) into V2. It works fine with an intersect, but when I try to make lots of intersect, the return statement has errors. [image: 1600244901822-capture-d-%C3%A9cran-de-2020-09-16-10-22-07-resized.png] On my example, height is 104 units, I can return a slice every 3 units, but when I try to return a slice every 2 units (and my real process needs smaller slices) it bugs : elapse for solid generation: 39 design.js total time for design regeneration 7015 17 design.js Uncaught (in promise) TypeError: a is undefined (2 times)
  • Symmetrical Json Deserializers

    3
    0 Votes
    3 Posts
    828 Views
    Maria AlzateM
    Awesome! Thank you!
  • V2 Feedback : script hangs

    8
    1
    0 Votes
    8 Posts
    2k Views
    gilboonetG
    @z3dev You're right, the problem was about winding and by correcting it for MeasureArea() < 0 and triangulating was enough to make it work. I updated my source here : https://github.com/gilboonet/gilboonet.github.io/blob/master/demos/gigi.js It contains a volume exported from Wings3d, with Cube1_default() that contains data with quads and table() with this : function table() { var a = Cube1_default(); var tmp = []; for(var i = 0; i < a.polygons.length; i++){ if (measureArea(a.polygons[i]) < 0){ a.polygons[i] = a.polygons[i].reverse(); } for(var j = 1; j< a.polygons[i].length-1; j++){ tmp.push([a.polygons[i][0], a.polygons[i][j], a.polygons[i][j+1]]); } } return scale([8,8,8], polyhedron({points:a.points, faces:tmp})); } There is certainly a way to write this code a more modern way with map() to speed it up.
  • Display Code

    6
    0 Votes
    6 Posts
    1k Views
    z3devZ
    @BarbourSmith is there some reason to use three.js? the primary focus of three.js is quite differnet from JSCAD. It should be pretty trivial to convert between three.js data structures and JSCAD data structures. But don't expect either project to supply the conversions. Maybe somone has a set of functions already, or you'll have to write some simple conversion functions.
  • V2 Update : 2020 SEP 08

    1
    0 Votes
    1 Posts
    344 Views
    No one has replied
  • V2 Update

    14
    1 Votes
    14 Posts
    4k Views
    BarbourSmithB
    Thank you for the Windows fix It is working great for me now.
  • V2 Update : 2020 SEP 02

    2
    0 Votes
    2 Posts
    426 Views
    gilboonetG
    I applied the update, and it's ok. Thank you for the commands to run, I only knew about git pull, not the two other commands.
  • V2 Feedback : converting V1 examples

    9
    1
    0 Votes
    9 Posts
    2k Views
    gilboonetG
    Eighth example, lookup : [image: 1598797062213-capture-d-%C3%A9cran-de-2020-08-30-16-16-04.png] It looks ok, but my lookup function is maybe buggy, I needed to stretch return value (x2) to have same lengths as V1, and to add a center to each cylinders to make it look the same. // title : Lookup // author : OpenSCAD.org, adapted by Rene K. Mueller // description: testing lookup() function // file : lookup.jscad // from http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Mathematical_Functions const jscad = require('@jscad/modeling') const { primitives, transforms, colors, maths } = jscad const { cylinder } = primitives const { translate } = transforms const { colorize, hslToRgb } = colors const { vec2 } = maths const { lerp } = vec2 function getCylinderH (p) { return lookup(p, [ [ -200, 5 ], [ -50, 20 ], [ -20, 18 ], [ +80, 25 ], [ +150, 2 ] ]); } function main () { var w = []; for (var i = -100; i <= 100; i += 5) { w.push(colorize(hslToRgb([((i + 100) / 200) * 0.3 + 0.6, 1, 0.5]), translate([i, 0, -30], cylinder({radius: 4, height: getCylinderH(i) * 3 *2, segments: 16 , center : [i,0,getCylinderH(i) * 3] })))); } return w; } function lookup(ix, L){ // L = [ [ i0, v0], ..., [iN, vN] ] if (ix <= L[0][0]) return L[0][0]; var i = L.length-1; if (ix >= L[i][0]) return L[i][0]; i = L.findIndex( x => x[0] >= ix); v1 = L[i-1][1]; v2 = L[i][1]; if (ix === L[i-1][0]) return v1; if (ix === L[i][0]) return v2; var i1 = L[i-1][0], i2 = L[i][0]; var r = v1 + (v2-v1) / (i2-i1) * (ix-i1); return r; } module.exports = { main }
  • Some thoughts on center

    2
    0 Votes
    2 Posts
    1k Views
    z3devZ
    @faithhack thanks again for the feedback. the 'center' option has been added back to primitives. we want to define primitives using simple mathematics, which means center is required. for example, a circle is a shape consisting of all points in a plane that are a given distance from a given point, the center. hopefully, this brightens the day of a few folks.
  • V2 Update

    1
    0 Votes
    1 Posts
    479 Views
    No one has replied
  • Bezier tubes

    2
    1
    0 Votes
    2 Posts
    994 Views
    z3devZ
    @SimonClark this is cool. thanks for sharing. FYI, this functionality will behave far better after the next update, which folds full numeric precision back into the library. (And 10X improved speed is included for free!)
  • Running single tests...

    2
    0 Votes
    2 Posts
    956 Views
    z3devZ
    @SimonClark no problem. and welcome to the world of jscad development. so, each of the packages are managed via 'lerna'. lerna is kind of cool because it automatically detects the dependencies and links everything together during the 'bootstrap' phase. once everything is linked together, then you can make changes to any of the code, and rerun tests, or run CLI / WEB. also, each of the packages can be tested individually. for example, you can change directories to packages/modeling, and run the tests using 'npm test'. if there's too much noise then you can move the *.test.js files into a temporary directory, and test something special by creating another *.test.js file. AVA is the test harness of choice. It's cool.
  • Additions for consideration...

    5
    1
    0 Votes
    5 Posts
    2k Views
    SimonClarkS
    @z3dev said in Additions for consideration...: @simonclark cool. FYI, there's a bezier function as part of path2 geometry which is based on the SVG algorithm. See src/geometry/path2/appendBezier() Thanks! I'm taking a look at this, and try to make sure the interfaces are similar. My goal was to create something that I could use as an easing function in scaling, rotating, etc. I've also updated the algorithm to support n'th dimensions, and n'th order polynomials (control points).
  • All parameters being ignored in local install.

    4
    0 Votes
    4 Posts
    1k Views
    SimonClarkS
    thanks @z3dev. I made some bad assumptions about what docs were relevant
  • Flattening 3d triangle

    3
    0 Votes
    3 Posts
    734 Views
    gilboonetG
    Thank you. I only work with triangulated models for coding simplicity, even if later (for designs clarity) I usually remove walls between co-planar neighbours. I will certainly soon start to make V2 versions of my code, was only missing this, but for the moment I'm making a vanilla JS pattern editor.
  • V2 Update

    1
    4
    0 Votes
    1 Posts
    506 Views
    No one has replied
  • little V2 feedback

    12
    1
    0 Votes
    12 Posts
    3k Views
    gilboonetG
    @z3dev I update the docs with "npm run docs" and now documentation about color is available.