JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. wildjerry
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Best 0
    • Controversial 0
    • Groups 0

    wildjerry

    @wildjerry

    0
    Reputation
    1
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    wildjerry Unfollow Follow

    Latest posts made by wildjerry

    • RE: Why am I getting "Uncaught TypeError: CSG.Path2d is not a constructor"?

      Related Noob Question: I'm trying to add color to my script, and I'm getting this error:

      Uncaught TypeError: object.setColor is not a function
      Line: 6919,col: 17
      

      My current code is:

      function main(params) {
          
          sketches = [
              square([10,2]), 
              square([3,10]),
              new polygon([
                  [0,0],
                  [9,0],
                  [3,9],
                  ],true),
              ];
              
          
          return render(sketches,params.dimension);
      }
      
      function getParameterDefinitions() {
          return [
              { name: 'dimension', type: 'checkbox', checked: false, caption: 'render in 3d?' },
          ];
      }
      
      function render(obj,dim,colors) {
          if (dim){
              extrudes =[];
              for (var i of obj){
                  extrudes.push(rotate_extrude(i));
              }
              
              extrudes[0]=color(extrudes[0],"Red")
              extrudes[1]=color(extrudes[1],"Red")
              extrudes[2]=color(extrudes[2],"White")
              
              return union(extrudes);
          }
          else {
              return union(sketches);
          }
      }
      

      The only difference between the fixed version of the code and this one is the added colors after I extrude. Based on the documentation, I don't see why this doesn't work.

      posted in General Discussions
      wildjerry
      wildjerry
    • RE: Why am I getting "Uncaught TypeError: CSG.Path2d is not a constructor"?

      Thank You!

      posted in General Discussions
      wildjerry
      wildjerry
    • RE: Beginner Questions

      In errors, what is the blob url? Going to them just yields a 404.

      posted in General Discussions
      wildjerry
      wildjerry
    • Why am I getting "Uncaught TypeError: CSG.Path2d is not a constructor"?

      I'm new to both Open(J)Scad and javascript in general, and I keep getting this error.

      Uncaught TypeError: CSG.Path2d is not a constructor
      Line: 97,col: 9
      (blob:https://openjscad.org/f3af8c9b-afdd-46ee-ad07-40d1f04dd681)
      

      My code is intended to create an array of 2d shapes, then render them in either 2d or 3d(using a revolve extrude) with a union().

      function main(params) {
          
          sketches = [
              square([10,2]), 
              square([3,20]),
              new CSG.Path2d([
                  [0,0],
                  [0,9],
                  [19,0],
                  ],true),
              ];
          return render(sketches,params.dimension);
      }
      
      function getParameterDefinitions() {
          return [
              { name: 'dimension', type: 'checkbox', checked: false, caption: 'render in 3d?' }, 
          ];
      }
      
      function render(obj,dim) {
              if (dim){
              extrudes =[];
              for (var i of obj){
                  extrudes.push(rotate_extrude(i));
              }
              return union(extrudes);
          } else {
              return union(sketches);
          }
      }
      
      posted in General Discussions
      wildjerry
      wildjerry