OpenSCAD - Basics - Make Modules to create Transform Array Operator

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 เม.ย. 2024
  • This is a short tutorial on using for loops in a module to create an easy way to duplicate objects in OpenSCAD. It introduces the concept of an Operator and the children() operator.
    The full code is here:
    github.com/mathcodeprint/open...
    Here are some time indexes:
    00:00 Intro
    00:14 linear_array
    01:20 - for loop using count argument
    01:50 - translate using distance
    01:50 - the children() operator
    02:30 - using the new linear_array operator
    03:10 rectangular_array
    05:26 polar_array
    06:49 rotate() typo :(
    08:00 array typo :(
    09:34 Effect of center=true in rotate()

ความคิดเห็น • 10

  • @kevinbowker2385
    @kevinbowker2385 ปีที่แล้ว

    Thank you for sharing your knowledge!

  • @1944GPW
    @1944GPW 6 ปีที่แล้ว +1

    This is really great, just what I needed to use. One request though, in future videos would you be able to bump your text font size up one notch? I've checked I'm at the highest quality TH-cam setting and it is still a bit fuzzy to read. Thanks again.

  • @mfuseli
    @mfuseli 5 ปีที่แล้ว

    Nice, but I am running into syntax errors.

    • @mathcodeprint
      @mathcodeprint  5 ปีที่แล้ว

      The OpenSCAD editor can be tough for sytax, I will place this code up on github and post the link for you. It will be in this repository but it will take me a few minutes to find the code :)

    • @mfuseli
      @mfuseli 5 ปีที่แล้ว

      I am actually trying the code in the openscad.net and the openjscad.org web apps. But no luck.

    • @ezinatx
      @ezinatx 4 ปีที่แล้ว +1

      @@mfuseli The editor rules are slightly different in the web apps for modules. You must declare the modules 1st, followed by the call to the module. You must also be careful to make sure all variables are defined prior to them being used when you are reversing the tutorial code to work in the web app. If you make a mistake in this part of the editor, you will get a Cannot Convert to Solid Error, with messages pointing to code you do not have access to.

  • @koford
    @koford 6 ปีที่แล้ว

    This is not pretty, how do i rows it?
    Example:
    translate ([-40,195,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    translate ([-40,190,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    translate ([-40,185,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    translate ([-40,180,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    translate ([-40,175,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    translate ([-40,170,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    translate ([-40,165,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    translate ([-40,160,260]) cylinder_array(21,5) cylinder(r=2, h=10);
    module cylinder_array( count, distance ){
    for ( i = [0:1:count-1] ){
    translate([distance*i,0,0])
    children();
    }
    }
    As you can see, iv translate em to move it. but i wich i could add rows to it.

    • @koford
      @koford 6 ปีที่แล้ว

      I can almost taste it, i tried this:
      cylinder_array(21,5,25) cylinder(r=2, h=10);
      module cylinder_array( count, distance, rows ){
      for ( i = [0:1:count-1] ){
      for ( h = [0:1:rows-1]){
      translate([0,distance*i,0])
      translate([rows+distance*h,0,0])
      children();
      }
      }
      }
      But i see it moved away from 0,0

    • @koford
      @koford 6 ปีที่แล้ว

      Awsome, but i think i got it. Iv also posted on OpenSCAD forum and someone gave me the answer.
      The answer was as follow:
      cylinder_array(21,5,25) cylinder(r=2, h=10);
      module cylinder_array( count, distance, rows )
      for (i = [0 : count - 1], h = [0 : rows-1])
      translate([distance * h, distance * i, 0])
      children();
      Im quite new to this stuff and i already love it, it fun, amazine but challence.. a lot of stuff i dont know but a desire to learn.