CADjs Polygons and Polyarcs
-
Upload
percival-ray -
Category
Documents
-
view
214 -
download
0
description
Transcript of CADjs Polygons and Polyarcs
![Page 1: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/1.jpg)
CADjs
Polygons and Polyarcs
![Page 2: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/2.jpg)
Review Question
Base: (50,50,2)Cylinder: r =5, h = 30Hole: r = 2
Use one for-loop!
Step 1 Step 2 Step 3 Step 4
![Page 3: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/3.jpg)
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();
![Page 4: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/4.jpg)
Wedge
How to create?
Subtract one cube from another!
![Page 5: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/5.jpg)
Wedge
s=polygon([ [0,0],[1,0],[0,1] ]);s.display();
g = extrudeShape(s,0.25);//thicknessg.display();
(0,0)(1,0)
(1,0)
![Page 6: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/6.jpg)
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();
(0,50)
(10,10)(50,10)
![Page 7: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/7.jpg)
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();
![Page 8: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/8.jpg)
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();
![Page 9: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/9.jpg)
Star with Hole
![Page 10: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/10.jpg)
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();
![Page 11: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/11.jpg)
Try …
100
20
10
R = 5
![Page 12: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/12.jpg)
Engineering Drawings
![Page 13: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/13.jpg)
More Examples
Method 1:Block + Cylinder
Method 2:Sketch and Extrude
![Page 14: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/14.jpg)
2D Shape with Arcs
s = start2DGeom(0,0);s.addLine(1,0);s.addArc(1,1,1,0.5,false); //xEnd,yEnd,xCenter,yCenter,Clockwises.addLine(0,1);s.display();//display 2D shape
(0,0) (1,0)
(1,1)(0,1)
(1,0.5) Anti-clockwise
![Page 15: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/15.jpg)
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,Clockwises.addLine(0.4,1).addLine(0,1).addLine(0,0);s.display();//display 2D shape
(0,0)
(1,0)
(1,0.4)
(0.5,0.4)
(0.4,0.5)(0.5,0.5)
Clockwise
![Page 16: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/16.jpg)
Example
![Page 17: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/17.jpg)
Method 1
g= cube(60,20,38).translateZ(21);
g1 = cube(30,60,38).translateZ(49);
g2 = cylinder(30,20,100);
g3 = cylinder(15,50,39);
g = g.difference(g1).union(g2).difference(g3);
g.display();
![Page 18: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/18.jpg)
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();
![Page 19: CADjs Polygons and Polyarcs](https://reader036.fdocuments.in/reader036/viewer/2022081702/5a4d1b647f8b9ab0599aec1f/html5/thumbnails/19.jpg)
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();