Presentation is loading. Please wait.

Presentation is loading. Please wait.

CADjs Polygons and Polyarcs

Similar presentations


Presentation on theme: "CADjs Polygons and Polyarcs"— Presentation transcript:

1 CADjs Polygons and Polyarcs

2 Review Question Base: (50,50,2) Cylinder: r =5, h = 30 Hole: r = 2
Use one for-loop! Step 1 Step 2 Step 3 Step 4

3 Review Question - Solution
base = cube(50,50,2); cyl1 = cylinder(5,30).rotateX(90).translateZ(15); cyl2 = cylinder(2,40).rotateX(90).translateZ(20); tube = cyl1.difference(cyl2).translate(20,20,0); for (i = 0; i < 4;i++) { tube.rotateZ(90*i); base = base.union(tube); } base.display();

4 Wedge How to create? Subtract one cube from another!

5 Wedge s=polygon([ [0,0],[1,0],[0,1] ]); s.display(); (1,0) (0,0) (1,0)
g = extrudeShape(s,0.25);//thickness g.display();

6 Star (0,50) (10,10) s = polygon([[0,50],[10,10],[50,10],[15,-10],[30,-50],[0,-20],[-30,-50],[-15,-10],[-50,10],[-10,10]]); s.display(); (50,10)

7 Star s = polygon([[0,50],[10,10],[50,10],[15,-10],[30,-50],[0,-20],[-30,-50],[-15,-10],[-50,10],[-10,10]]); s.display(); g = extrudeShape(s,10); g.display();

8 Hollow Wedge s=polygon([ [0,0],[1,0],[0,1] ]);
h = polygon([ [0.1,0.1],[0.8,0.1], [0.1,0.8]]); s.holes.push(h); s.display(); g = extrudeShape(s,0.2); g.display();

9 Star with Hole

10 Star with Hole s = polygon([[0,50],[10,10],[50,10],[15,-10],[30,-50],[0,-20],[-30,-50],[-15,-10],[-50,10],[-10,10]]); star = extrudeShape(s,10); hole = cylinder(5,30).rotateX(90); star = star.difference(hole); star.display();

11 Try … 100 R = 5 20 10

12 Engineering Drawings

13 More Examples Method 1: Block + Cylinder Method 2: Sketch and Extrude

14 2D Shape with Arcs (0,1) (1,1) (1,0.5) Anti-clockwise (0,0) (1,0)
s = start2DGeom(0,0); s.addLine(1,0); s.addArc(1,1,1,0.5,false); //xEnd,yEnd,xCenter,yCenter,Clockwise s.addLine(0,1); s.display();//display 2D shape

15 2D Shape with Arcs s = start2DGeom(0,0);
s.addLine(1,0).addLine(1,0.4).addLine(0.5,0.4); s.addArc(0.4,0.5,0.5,0.5,true); //xEnd,yEnd,xCenter,yCenter,Clockwise s.addLine(0.4,1).addLine(0,1).addLine(0,0); s.display();//display 2D shape (1,0.4) (0,0) (1,0) (0.4,0.5) (0.5,0.5) (0.5,0.4) Clockwise

16 Example

17 Method 1 g= cube(60,20,38).translateZ(21);
g2 = cylinder(30,20,100); g3 = cylinder(15,50,39); g = g.difference(g1).union(g2).difference(g3); g.display();

18 Method 2 arc = [38,60,38,30,false]; s=polyarc([[0,0],[38,0], arc,[0,60],[0,45],[10,45],[10,15],[0,15] ] ); g = extrudeShape(s,20); cyl = cylinder(15,25).rotateX(90).translate(38,30,10); g = g.difference(cyl); g.display();

19 Method 3 arc = [38,60,38,30,false]; s = polyarc([[0,0],[38,0], arc,[0,60],[0,45],[10,45],[10,15],[0,15] ] ); c = circle(38,30,15); s.holes.push(c); g = extrudeShape(s,20); g.display();


Download ppt "CADjs Polygons and Polyarcs"

Similar presentations


Ads by Google