Group Details Private

Development Moderators

Developers

Member List

  • RE: Has anyone had success using openjscad in react?

    @kevinos no problem.

    so, JSCAD designs are actually Javascript functions which perform calcuations, create geometry, perform operations with geometry, and finally return the geometry of interest.

    const {primitives} = require('@jscad/modeling')
    
    const main = () => {
      let object1 = primitives.circle({radius: 22, segments: 36})
      object1.color = [1,0,0,1]
    
      return object1
    }
    module.exports = {main}
    

    The return of object1 from main() is a 2D geometry, i.e. a geom2 object. In the WEB UI, this object is passed to the 'rendering' function, and shows up on the screen as a red circle.

    The Vue component requires 2D/3D geometries as well. And as a Vue component, it can live inside another Vue component (or application). This is the rendering piece only.

    The JSCAD WEB UI is doing a whole lot more underneath. It loads all the code, evaluates (compiles?) each piece of code, and finally executes the main() function.

    If you want this functionality then there's some more plumbing required.

    posted in General Discussions
  • RE: Has anyone had success using openjscad in react?

    @kevinos sure.

    here's the code https://github.com/z3dev/vue-components

    this is only a viewer for a pre-compiled (JSON) design. V2 only!

    posted in General Discussions
  • RE: Has anyone had success using openjscad in react?

    @kevinos There's no documentation on embedding because there far too many frameworks. However, as you already researched, there are people embedding JSCAD in webpages.

    Recently, I've been playing Vue, and have a simple Vue component which can render a JSCAD V2 geometry. It's kind of cute, but shows potential.

    posted in General Discussions
  • RE: How do I share the parametric model without sharing the code?

    @kevinos welcome!

    The JSCAD model (code) is required as the compilation is completed by the browser. So, you will have to find ways to obfuscate the code.

    posted in General Discussions
  • RE: Parametric Lego brick generator

    @DrShoggoth This is great! Thanks for sharing!

    posted in General Discussions
  • RE: Bezier tubes

    @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!)

    posted in Development Discussions
  • 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!

    posted in Development Discussions
  • RE: Running single tests...

    @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.

    posted in Development Discussions
  • RE: 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()

    posted in Development Discussions
  • RE: Additions for consideration...

    @simonclark Nice innovations to V2. 😎

    I think some others will be interested in the automatic VM launch, and configuration. Please consider adding a pull request to the V2 branch.

    I'm also excited to see another use of the new extrude functions.

    Funny... I don't remember math.bezier() 😉 There was talk about adding bezier() to the primitives, but no time. Again, please consider adding a pull request to the V2 branch.

    posted in Development Discussions