You are on page 1of 3

;To draw a rectangular plate having hole at its center

(defun c:mech()

(setq Pt1(getpoint "Enter first point Pt1 : ")


Pt3(getpoint "Enter diagonally opposite point Pt3 : ")
d(getreal "Enter the diameter of circle d : ")

Pt2(list (car Pt3) (cadr Pt1))


Pt4(list (car Pt1) (cadr Pt3))
Cp(list (/ (+ (car Pt1) (car Pt2)) 2) (/ (+ (cadr Pt1) (cadr Pt4)) 2)))
(command "line" Pt1 Pt2 Pt3 Pt4 Pt1 "")
(command "circle" Cp "d"d "")

(setq Pt(list (car Cp) (+ (cadr Pt4) 5))


Pb(list (car Cp) (- (cadr Pt1) 5))
Pl(list (- (car Pt1) 5) (cadr Cp))
Pr(list (+ (car Pt2) 5) (cadr Cp)))
(setvar "ltscale" 2)
(command "line" Pt Pb "")
(command "chprop" "l" "" "lt" "center" "")
(command "line" Pl Pr "")
(command "chprop" "l" "" "lt" "center" "")

(setq a(list (car Cp) (- (cadr Pt1) 10))


b(list (+ (car Pt2) 10) (cadr Cp))
c(list (+ (car Cp) 10) (+ (cadr Pt4) 10))
d(polar Cp (/ pi 4) (/ d 2) ))
(command "dimlinear" Pt1 Pt2 a "")
(command "dimlinear" Pt2 Pt3 b "")
(command "dimradius" d c)
(command "zoom" e)
)
Command Line :
Command: mech
Enter first point Pt1 : 0,0
Enter diagonally opposite point Pt3 : 40,20
Enter the diameter of circle d : 10
line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]:
Specify next point or [Close/Undo]:
Specify next point or [Close/Undo]:
Specify next point or [Close/Undo]:
Command: circle Specify center point for circle or [3P/2P/Ttr (tan tan radius)]:
Specify radius of circle or [Diameter] <5.0000>: d Specify diameter of circle
<10.0000>: 10.00000000000000
Command: MECH Unknown command "MECH". Press F1 for help.
Command: line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]:
Command: chprop
Select objects: l 1 found
Select objects:
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: lt
Enter new linetype name <ByLayer>: center
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]:
Command: line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]:
Command: chprop
Select objects: l 1 found
Select objects:
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: lt
Enter new linetype name <ByLayer>: center
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]:
Command: dimlinear
Specify first extension line origin or <select object>:
Specify second extension line origin:
Specify dimension line location or
[Mtext/Text/Angle/Horizontal/Vertical/Rotated]:
Dimension text = 40.00
Command: MECH Unknown command "MECH". Press F1 for help.
Command: dimlinear
Specify first extension line origin or <select object>:
Specify second extension line origin:
Specify dimension line location or
[Mtext/Text/Angle/Horizontal/Vertical/Rotated]:
Dimension text = 20.00
Command: MECH Unknown command "MECH". Press F1 for help.
Command: dimradius
Select arc or circle:
Dimension text = 5.00
Specify dimension line location or [Mtext/Text/Angle]:
Command: zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>:
Output :

R5.00

20.00

40.00

You might also like