본문 바로가기

OpenCAD

XYDrawing [1]

설명하기가 어렵습니다.  명령문을 주석처리하면서 이해하는 것이 좋을 같습니다.  

 

 

Source file


module step(len, mod) // x축 양쪽 지지대입니다.
{
  for (i = [0:$children-1]) {
    translate([ len*(i - ($children-1)/2), 0, 0 ]) children((i+mod) % $children);
  } }

module stepy(len, mod) // y축입니다.
{
  for (i = [0:$children-1]) {
    translate([ 0, len*(i - ($children-1)/2), 0 ]) children((i+mod) % $children);
  }
}
echo(version=version());
for (i = [1:1]) {      // x축 길이와 위치
   translate([0,0, 0]) step(100, i) {
    cube([5,50,15], true);
    union() {
      cube([5,50,15], true);
    }
  }
}
translate([0,10, -5])  // x축
cube([100,5,3], true);
translate([-40,-15, -5])  //축
cube([5,75,3], true);
for (i = [1:1]) {   //펜 크기와 위치
   translate([-40,-15, -4]) stepy(75, i) {
    cube([5,5,7], true);
    union() {
         color("red")
      cylinder(r = 1, h = 25, center = true);
    }
  }
}

 

'OpenCAD' 카테고리의 다른 글

polyhedron  (0) 2021.07.16
module, children() [3]  (0) 2021.07.16
회전 _ROTATE() [2]  (0) 2021.07.16
2D _변수 [1]  (0) 2021.07.16