0% found this document useful (0 votes)
19 views16 pages

LISPC07 Advanced Applications

The document provides detailed instructions on creating solid profiles and mechanisms using AutoCAD 2002-2015, including commands for managing model and paper spaces, creating viewports, and generating solid profiles. It also includes specific procedures for animating slider-crank and four-bar mechanisms with associated Lisp commands. Additionally, it features homework tasks that require the application of the discussed techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views16 pages

LISPC07 Advanced Applications

The document provides detailed instructions on creating solid profiles and mechanisms using AutoCAD 2002-2015, including commands for managing model and paper spaces, creating viewports, and generating solid profiles. It also includes specific procedures for animating slider-crank and four-bar mechanisms with associated Lisp commands. Additionally, it features homework tasks that require the application of the discussed techniques.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 16

/conversion/tmp/activity_task_scratch/873822923.

doc

Ch.7 Advanced Applications

7.1 Creating Solid Profiles in AutoCAD 2002~2015

§7.1-1 Tiled Viewport, Model Space, and Paper Space


AutoCAD usually begins a new drawing with a single view port. You can create
multiple view ports by the "VPORTS" command and work with multiple view
ports. Drawing changes in one view port will be reflected in other view ports
instantly. When you work with view ports, you are in the "model space" of
AutoCAD.
The "VPORTS" command(or VIEWPORTS ) can be used to create multiple
viewports for the model in the model space.
COMMAND : VPORTS Save
Restore
Delete
Join
SIngle
?
2
<3>
4

§7.1-2 Model Space and Paper space


AutoCAD has two working state: Model space and Paper space. In model space,
a 3D model is created. In paper space, different views of the model, called
floating views, and annotations are placed on the paper. AutoCAD usually begins
a new drawing with a single view port in the model space.

· Change from the model space to the paper space:


command tilemode 0
:

The first time you shift from the model space to the paper space, the graphic area
displays a blank space that represents a white paper. The tile mode 0 or 1 can
also be changed by pressing the “TILE” icon on the status bar.

· Set floating view ports in the paper space (Use the MVIEW commnad) :
command : MVIEW <pt1> <pt2>

· Enter a floating view port of the paper space:


command : mspace

· Return to the paper space from the model space of a floating view ports :
comman pspace
d:
The model space or paper space of a floating view port can also be changed
by pressing the “MODEL” icon on the status bar.

- 7.1 -
/conversion/tmp/activity_task_scratch/873822923.doc

§7.1-3 Creating Solid Profiles in AutoCAD A2002~2015


The 2D solid profiles of a design can be drawn as the following procedure:
1. When entering AutoCAD A2002, you are in the default model space. Draw a solid
model in the model space. For example, a 3D model of a fan is drawn in layer “0”.

2. Enter “Layout1” layout in the paper space:


Command: LAYOUT S LAYOUT1  or press the <Layout1> tab.

3. Enter the model space of the layout:


Command: mspace  or double click the model in the layout center.
 Or press the <PAPER> tag in the status bar.

4. View the solid model from the front view, top view, right view, or isometric view.
Press one of the “View” tool icon:

- 7.2 -
/conversion/tmp/activity_task_scratch/873822923.doc

5. Create the solid profiles:


Command: SOLPROF <select solid> <Enter>
Display hidden profile lines on separate layer? <Y>:
Project profile lines onto a plane? <Y>:
Delete tangential edges? <Y>:
The profiles of the solid are projected onto a plane. All visible lines are projected
to layer “PV-xxx”, and hidden lines are projected to layer “PV-xxx”.

6. Return to the original model space:


Command: model  or press <Model> tab.

7. View the solid model from the required view direction, and then establish an user
coordinates system perpendicular to the viewing direction by:
Command: UCS View

8. Turn off all layers except “PV-xxx” layer, copy and paste the visible profile lines to
another drawing. For example, in the following figure, the front view profiles are
copied and pasted to a new drawing.

9. Return to the original drawing with solid model, keep the solid model, and delete
all generated 2D profiles. This can be done by turning on all layers except layer
“0”, deleting all visible profiles, and then turning on the layer “0”.

- 7.3 -
/conversion/tmp/activity_task_scratch/873822923.doc

10. Repeat steps (3)~(9) for the necessary view profiles. For examples, front view,
top view and isometric view profiles are copied to the new drawing as:

11. After preparing 2D profiles of a design, necessary dimensions of the design


can be added as shown in the following figure.

- 7.4 -
/conversion/tmp/activity_task_scratch/873822923.doc

Home work:
Draw the solid model of the angle plate, use the SOLPROF command to create 2D
profiles, and then add necessary center lines and dimensions, as shown in the figure.

- 7.5 -
/conversion/tmp/activity_task_scratch/873822923.doc

7.2 Mechanism Animation

§7.2-1 Animation of a slider-crank mechanism


Comman (load “slider.lsp”)
d: slider
rs

; Slider.lsp : Slider crank mechanism


; r: radius of the crank
; th: angle of the crank in radian
; c: length of the connecting rod,
; e: offset of the slider
; bx,by: length and width of the slider
; w: width of connecting rod
; di: inside diameter of the joint
;
(defun c:slider (/ ip r c e w di bx by th)
(graphscr)(osnapoff)
(setq ;r 30 th (dtr 30) c 100 e 10 bx 15 by 5
r 30 th (dtr 30) c 70 e 5 bx 15 by 5
w (/ r 10) di (/ w 3.0) ip '(0 0)
)
(slider-crank ip r th c e w di bx by)
(command "zoom" "e" "zoom" "0.5x")
(princ)
)
;================================================

- 7.6 -
/conversion/tmp/activity_task_scratch/873822923.doc

(defun slider-crank (ip r th c e w di bx by / s p1 p2 e1 e2 e3


e4 s1 s2 s3 par)
(setq s (afunc r th c e)
p1 (polar ip th r) p2 (rpoint ip s e)
e1 (entlast)
)
(command "ltscale" 0.5)
(link ip p1 w di) (setq e2 (entlast))
(link p1 p2 w di) (setq e3 (entlast))
(box-center p2 bx by) (setq e4 (entlast))
(setq s1 (sset e1 e2) s2 (sset e2 e3) s3 (sset e3 e4)
par (list r th c e)
sc_set (list ip s1 s2 s3 par) ;global variable
sc_ang th ;global variable
)
(command "zoom" "e" "zoom" "0.5x");need zoom for dimensioning
;--- draw center lines
(setq s (afunc r pi c e) s2 (afunc r 0.0 c e)
p1 (rpoint ip s e) p2 (rpoint ip s2 e)
)
(command "layer" "m" "cen" "")
(command "circle" ip r)
(command "line" p1 p2 "")
(setvar "dimcen" -3)
(command "dimcenter" (polar ip (/ pi 4) r))
(command "layer" "s" "0" "")
(princ)
)
;================================================
; returns the horizontal distance between crank center and the slider
(defun afunc (b th c e / s1 s2)
(setq s1 (* b (cos th))
s2 (- (* b (sin th)) e)
s2 (- (* c c) (* s2 s2) )
s2 (sqrt s2)
)
(+ s1 s2)
)
(defun box-center (ip L w / p1 p2)
(setq p1 (rpoint ip (/ L -2.0) (/ w -2.0))
p2 (rpoint p1 L w)
)
(command "rectang" p1 p2)(princ)
)
;===================================================
=======
(defun link (ip pe w di / ri p1 p2 p3 p4 th th1 th2 pi/2 w/2)
(setq th (angle ip pe) pi/2 (/ pi 2.0) w/2 (/ w 2.0)
th1 (+ th pi/2) th2 (- th pi/2) ri (/ di 2.0)
p1 (polar ip th1 w/2) p2 (polar ip th2 w/2)
p3 (polar pe th1 w/2) p4 (polar pe th2 w/2)
)
(command "pline" p1 "a" "ce" ip p2 "L" p4 "a" "ce" pe p3 "L" "c")
(command "circle" ip ri) (command "circle" pe ri)
(princ)
)
;===================================================
=======

- 7.7 -
/conversion/tmp/activity_task_scratch/873822923.doc

;================================================
; rotate slider-crank
; sc_set : (<i.p.> sset_crank ss_link ss_slider par_list)
; par_list: (r th c e)
; sc_ang: crank angle in radian
; global: sc_set, sc_ang (in radian)
(defun c:rs (/ ip e1 e2 e3 par r th c e dth
p1 p2 L1 L2 q1 q2 da ainc key)
(graphscr)
(setq ip (car sc_set) e1 (nth 1 sc_set)
e2 (nth 2 sc_set) e3 (nth 3 sc_set)
par (nth 4 sc_set) r (car par)
th (nth 1 par) c (nth 2 par) e (nth 3 par)
ainc 10 ;angle increment in degree
)
(setq p1 (polar ip sc_ang r) L1 (afunc r sc_ang c e)
p2 (rpoint ip L1 e)
)
(princ "\n Press <SPACE> to rotate clockwise")
(princ ", Press <backspace> to rotate counter clockwise")
(princ ", Press <RETURN> to end !")
(setvar "cmdecho" 0)
(while (and (setq key (cadr (grread))) (/= 13 key) )
(if (= key 8) ;<back space> is pressed
(setq dth ainc)
(setq dth (- ainc))
)
(setq sc_ang (+ sc_ang (dtr dth))
q1 (polar ip sc_ang r) L2 (afunc r sc_ang c e)
q2 (rpoint ip L2 e)
da (- (angle q2 q1) (angle p2 p1))
da (rtd da)
)
(command "rotate" e1 "" ip dth)
(command "move" e2 e3 "" p2 q2)
(command "rotate" e2 "" q2 da)
(setq p1 q1 p2 q2) ;update p1, p2
);end-while
)
;===================================================
=======

- 7.8 -
/conversion/tmp/activity_task_scratch/873822923.doc

; return a selection set after e1 until e2


(defun sset (e1 e2 / ss)
(setq e1 (if e1 (entnext e1) (entnext))
ss (ssadd e1) )
(while (not (equal e1 e2))
(setq e1 (entnext e1) ss (ssadd e1 ss) )
)
ss ;return value
)

7.2-2 Animation of a Four-Bar mechanism


Comman (load “Four-bar.lsp”)
d: 4bar
R4B

;================================================
; Four-Bar.lsp: Four-bar mechanism
; a: length of fixed link
; b: length of the crank
; c: length of the connecting rod,
; d: length of the follower
; th: angle of the crank in radian
; w: width of links
; di: inside diameter of the joint
; four-bar linkage
(defun c:4b (/) (c:4bar)(princ))
(defun c:r4 (/) (c:r4b)(princ))
;================================================

- 7.9 -
/conversion/tmp/activity_task_scratch/873822923.doc

(defun c:4bar (/ ip a b c d th w di)


(graphscr)(osnapoff) (command "cmdecho" 0)
(setq ;a 100 b 30 c 60 d 80 th 30
a 100 b 30 c 60 d 50 th 60
;a 100 b 30 c 60 d 80 th 60
;a 100 b 30 c 60 d 70 th 60
th (dtr th) w (/ b 10) di (/ w 3.0) ip '(0 0)
)
(4bar ip a b c d th w di)
(command "zoom" "e" "zoom" "0.5x")
(princ)
)
;================================================
(defun 4bar (ip a b c d th w di / p1 p2 p3
e1 e2 e3 e4 s1 s2 s3 par)
(setq p1 (polar ip th b) p3 (polar ip 0.0 a)
p2 (4barpoint ip a b c d th) e1 (entlast)
)
(command "ltscale" 0.5)
(link ip p1 w di) (setq e2 (entlast))
(link p1 p2 w di) (setq e3 (entlast))
(link p3 p2 w di) (setq e4 (entlast))
(setq s1 (sset e1 e2) s2 (sset e2 e3) s3 (sset e3 e4)
par (list a b c d th)
4b_set (list ip s1 s2 s3 par) ;global variable
4b_ang th ;global variable
)
(command "zoom" "e" "zoom" "0.5x");need zoom for dimensioning
;--- draw center lines
(command "layer" "m" "cen" "") (command "circle" ip b)
(command "circle" p3 d) (command "line" ip p3 "")
(command "layer" "s" "0" "") (princ)
)
;================================================
(defun 4barpoint (ip a b c d th / p1 p2 p3 e the alfa th3)
(setq p1 (polar ip th b) p3 (polar ip 0.0 a)
e (distance p1 p3) the (angle p1 p3)
alfa (acos (/ (- (+ (* c c) (* e e)) (* d d)) (* 2 e c)))
th3 (+ alfa the) p2 (polar p1 th3 c)
)
p2 ;return value
)
;===================================================
=======
(defun link (ip pe w di / ri p1 p2 p3 p4 th th1 th2 pi/2 w/2)
(setq th (angle ip pe) pi/2 (/ pi 2.0) w/2 (/ w 2.0)
th1 (+ th pi/2) th2 (- th pi/2) ri (/ di 2.0)
p1 (polar ip th1 w/2) p2 (polar ip th2 w/2)
p3 (polar pe th1 w/2) p4 (polar pe th2 w/2)
)
(command "pline" p1 "a" "ce" ip p2 "L" p4 "a" "ce" pe p3 "L" "c")
(command "circle" ip ri) (command "circle" pe ri) (princ)
)
;================================================
; rotate slider-crank
; 4b_set : (<i.p.> sset_crank ss_link ss_follow par_list)
; par_list: (a b c d th)
; 4b_ang: crank angle in radian

- 7.10 -
/conversion/tmp/activity_task_scratch/873822923.doc

; global: 4b_set, 4b_ang (in radian)


(defun c:r4b (/ ip e1 e2 e3 par a b c d th dth tmp thmax thmin
p1 p2 p3 L1 L2 q1 q2 da3 da4 ainc key flag)
(graphscr) (setvar "cmdecho" 0)
(setq ip (car 4b_set) e1 (nth 1 4b_set)
e2 (nth 2 4b_set) e3 (nth 3 4b_set)
par (nth 4 4b_set) a (car par)
b (nth 1 par) c (nth 2 par) d (nth 3 par)
ainc 10 ;angle increment in degree
)
(setq p1 (polar ip 4b_ang b) p3 (polar ip 0.0 a)
p2 (4barpoint ip a b c d 4b_ang)
)
(if (>= (+ c d) (+ a b))
(setq flag nil)
(progn
(setq flag t tmp (+ c d) tmp (* tmp tmp)
tmp (- (+ (* a a) (* b b)) tmp )
tmp (/ tmp 2.0 a b )
thmax (acos tmp) thmin (- thmax)
)
)
)
(princ "\n Press <SPACE> to rotate clockwise")
(princ ", Press <backspace> to rotate counter clockwise")
(princ ", Press <RETURN> to end !")
(while (and (setq key (cadr (grread))) (/= 13 key) )
(if (= key 8) ;<back space> is pressed
(setq dth ainc)
(setq dth (- ainc))
)
(if (and flag (> (+ 4b_ang (dtr dth)) thmax))
(progn
(setq dth (- thmax 4b_ang) dth (rtd dth) )
)
)
(if (and flag (< (+ 4b_ang (dtr dth)) thmin))
(progn
(setq dth (- thmin 4b_ang) dth (rtd dth) )
)
)
(setq 4b_ang (+ 4b_ang (dtr dth)) q1 (polar ip 4b_ang b)
q2 (4barpoint ip a b c d 4b_ang)
da3 (- (angle q2 q1) (angle p2 p1)) da3 (rtd da3)
da4 (- (angle p3 q2) (angle p3 p2)) da4 (rtd da4)
)
(command "rotate" e1 "" ip dth)(command "rotate" e3 "" p3 da4)
(command "move" e2 "" p2 q2) (command "rotate" e2 "" q2 da3)
(setq p1 q1 p2 q2) ;update p1, p2
);end-while
)
;===================================================
=======

- 7.11 -
/conversion/tmp/activity_task_scratch/873822923.doc

HW: Animation of cycloid curves on a ground


1. Write a lisp program Cycloid2.lsp to draw the cycloid curve of point P at polar
position (r, ) as shown in the figure. The drawing procedure should be:
1. Input the start point of the ground (ps). 2. Input the generating radius rg.
3. Input the position angle . 4. Input position radius r.
5. Input the no. of intervals ni. 6. Draw the cycloid curve as a polyline.
(a) for rg=30, =135, r=25, ni=50, Length of cycloid curve = __________.
(b) for rg=30, =90, r=35, ni=50, Length of cycloid curve = __________.
(c) for rg=30, =270, r=30, ni=50, Length of cycloid curve = __________.
2. Write a lisp function c:rc() to rotate the generating circle on the ground and show
the drawing points of the cycloid curve.
3. Use the Wink and Giff Movie Gear software to produce an animation image
“cycloid2.gif”.

- 7.12 -
/conversion/tmp/activity_task_scratch/873822923.doc

7.3 Method to produce AutoCAD animation images

1. Install Wink Ver. 1.5 software(wink15.exe).


Install Magic pic2ani software(mpic2ani.exe).
Install Giff Movie Gear (ver. 3).
2. Run wink software, <File><New><Custom rectangle><Activate
AutoCAD window><Activate Wink window><Choose: select
necessary rectangle><ok>

3. Press <pause> to save an image, rotate AutoCAD drawing and then


press <pause> again to save another image. Repeat these rotate and
save image process as necessary.
4. <right-click the Wink icon at lower-right corner><Finish Capture>:

- 7.13 -
/conversion/tmp/activity_task_scratch/873822923.doc

5. <File><Export As HTML><Input save directory><Select file type:


JPG><ok>.
<File><Close> to end Wink v1.5.

6. Display saved images *.jpg files in AcdSee 6.0,


<View><Auto advance><options><start>

7. Convert to *.gif or *.avi using Gif Movie Gear(ver. 3):


 Run Gif Movie Gear (GMG),<Start from scratch>.
 Select Insert Frames from the File menu or click the toolbar
button .

- 7.14 -
/conversion/tmp/activity_task_scratch/873822923.doc

 Ordering frames: GMG imports GIF files according to how they


are named. Reorder the frames if necessary.
 Previewing the Animation. Click on the Show Animation
Preview toolbar button , or use the keyboard shortcut: Ctrl+P.
 <File><Save GIF Animation>: Save file *.gif, and play it in
Power point or AcdSee.
Before saving file to *.gif, press <Optimize Animation> icon to
reduce the file size of *.gif.
 <File><Save AVI Video>: Save file *.avi, and play it using
media player.

- 7.15 -
/conversion/tmp/activity_task_scratch/873822923.doc

8. Convert to *.avi or *.gif file using Magic Pic2ani (mpic2ani.exe):


<Add dir: include images file><Convert now><File type: *.avi or
*.Gif><ok><Save><select compression program: select 1st one><ok>.

Conclusion:
1. For the generated GIF file size, GIF Movie Gear is better than Magic Pic2ani.
GMG also has “Optimize Animation” option to reduce file size further.
2. For the generated AVI file size, Magic Pic2ani is better than GIF Movie Gear.
3. If only one software can be selected, choose GIF Movie Gear.

- 7.16 -

You might also like