Смекни!
smekni.com

Построение параметрической модели детали в среде программирования (стр. 4 из 4)

(setq a8 (list (car a4) (cadr a7)))

(setq a9 (list (car a4) (+ 150 c1)))

(setq a10 (list (car k2) (cadr a9)))

(setq a11 (list (car k2) ( - (cadr os5) 3)))

(setq a12 (list (car k1) (cadr a11)))

(command "line" a1 a2 "")

(setq l5 (entlast))

(command "line" a2 a3 "")

(setq l6 (entlast))

(command "line" a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 "")

(command "line" a12 a1 "")

(setq l7 (entlast))

(command "trim" l7 l6 arc1 "" l3 "")

(command "trim" l7 l3 "" l7 l6"")

(command "erase" l5 "" "")

(command "trim" arc1 l7 "" ss "")

(setq m1 (list ( - (car os4) 4) (+ (cadr k1) 1)))

(setq m2 (list (car m1) (+ (cadr k3) 1)))

(setq m3 (list (car m1) ( - (cadr k7) 1)))

(command "layer" "s" "vsp" "")

(command "bhatch" "p" "ansi31" "0.5" "0" m1 "")

(command "bhatch" "p" "ansi31" "0.5" "0" m2 "")

(command "bhatch" "p" "ansi31" "0.5" "0" m3 "")

(command "style" "Марьяна" "isocpeur" "2.5" "1" "15" "n" "n" "y")

(setvar "dimtxsty" "Марьяна")

(command "dimstyle" "s" "Марьяна" "y")

(command "dimstyle" "r" "Марьяна")

(setq raz1 (list ( - 150 (/ h 2) w1 40) 150))

(setq raz2 (list ( - (car raz1) 7) 150))

(setq raz3 (list ( - (car raz1) 14) 150))

(setq raz4 (list (+ (car raz1) 10) ( - (cadr raz1) c2 10)))

(setq raz5 (list ( - 150 (/ h 2) ( - w1 w2) 40) ( - 150 c2 17)))

(setq raz6 (list (car raz4) ( - (cadr raz5) 7)))

(setq raz7 (list 150 ( - (cadr a11) r3)))

(setq raz8 (list (+ 150 c3) (cadr k5)))

(setq raz9 (list 145 (+ (cadr raz7) r3)))

(setq raz10 (list ( - 150 c3) (cadr a11)))

(setq raz11 (list 150 (+ 150 (/ r1 3))))

(setq raz12 (list (car t3) (cadr t3)))

(setq raz13 (list ( - 150 (/ r1 2) r3 10) 150))

(setq raz14 (list 150 (+ (cadr b1) (/ r2 2))))

(setq raz15 (list (car raz8) (+ (cadr b1) r3)))

(command "dimlinear" k7 k5 "m" "%%c<>" raz1)

(setq p_raz9 (osnap raz9 "nea"))

(setq p_raz14 (osnap raz14 "tan"))

(command "dimlinear" a5 a8 "m" "%%c<>" raz2)

(command "dimlinear" a3 a10 "m" "%%c<>" raz3)

(command "dimlinear" a5 k8 raz4)

(command "dimlinear" a3 k8 raz5)

(command "dimlinear" k7 k8 raz6)

(command "dimdiameter" raz7 raz8)

(command "dimradius" p_raz9 raz10)

(command "dimangular" raz11 raz12 raz13)

(command "dimradius" p_raz14 raz15)

(command "line" "20,5" "205,5" "")

(command "line" "205,5" "205,292" "")

(command "line" "205,292" "20,292" "")

(command "line" "20,292" "20,5" "")

(command "line" "20,60" "205,60" "")

(command "_. zoom" "e")

)


Построение трехмерного изображения детали

(defun c: mod3d (/ d1 d2 d3 w1 w2 w3 r1 r2 r3)

(command "erase" "all" "")

(setvar "cmdecho" 1)

(command "limits" "0,0" "210,297")

(command "snap" "1")

(command "layer" "m" "osn" "l" "continuous" "osn" "lw" "0.3" "osn" "")

(command "_. regen")

(command "view" "t")

(setvar "lwdisplay" 1)

(setq d1 0)

(while (or (< d1 35) (> d1 45))

(initget 6)

(setq d1 (getreal "Введите наибольший диаметр детали <40>"))

(if (= d1 nil) (setq d1 40)))

(setq d2 0)

(while (or (< d2 26) (> d2 37))

(initget 6)

(setq d2 (getreal " Введите средний диаметр детали <32>"))

(if (= d2 nil) (setq d2 32)))

(setq d3 0)

(while (or (< d3 15) (> d3 25))

(initget 6)

(setq d3 (getreal " Введите наименьший диаметр детали <20>"))

(if (= d3 nil) (setq d3 20)))

(setq w1 0)

(while (or (< w1 17) (> w1 27))

(initget 6)

(setq w1 (getreal " Введите максимальную ширину детали <22>"))

(if (= w1 nil) (setq w1 22)))

(setq w2 0)

(while (or (< w2 10) (> w2 20))

(initget 6)

(setq w2 (getreal " Введите расстояние от верха детали до конца среднего кольца <15> "))

(if (= w2 nil) (setq w2 15)))

(setq w3 0)

(while (or (< w3 5) (> w3 15))

(initget 6)

(setq w3 (getreal " Введите высоту верхнего кольца детали <10>"))

(if (= w3 nil) (setq w3 10)))

(setq r1 0)

(while (or (< r1 65) (> r1 75))

(initget 6)

(setq r1 (getreal "Введите диаметр, проходящий через центр фигуры и центр отверстий <70>"))

(if (= r1 nil) (setq r1 70)))

(setq r2 0)

(while (or (< r2 2) (> r2 12))

(initget 6)

(setq r2 (getreal " Введите диаметр маленьких отверстий детали <7>"))

(if (= r2 nil) (setq r2 7)))

(setq r3 0)

(while (or (< r3 3) (> r3 13))

(initget 6)

(setq r3 (getreal " Введите радиус сопряжения детали <8>"))

(if (= r3 nil) (setq r3 8)))

(setq x (list 150 150))

(setq h (+ (/ r1 2) (/ d1 2) r3 r3))

(setq c1 (/ d1 2))

(setq c2 (/ d2 2))

(setq c3 (/ d3 2))

(command "layer" "s" "osn" "")

(setq b1 (list 150 (+ 150 (/ r1 2))))

(command "circle" b1 (/ r2 2))

(setq kr1 (entlast))

(command "circle" b1 r3)

(setq kr2 (entlast))

(command "array" kr2 "" "P" x "2" "-120" "")

(setq mas2 (entlast))

(command "array" kr1 "" "P" x "2" "-120" "")

(setq mas22 (entlast))

(command "array" kr2 "" "P" x "2" "120" "")

(setq mas (entlast))

(command "array" kr1 "" "P" x "2" "120" "")

(setq mass (entlast))

(command "osnap" "tan")

(setq t1 (list ( - 150 r3) (+ 150 (/ r1 2))))

(setq t2 (list ( - 150 (/ r1 2) (/ r3 2)) ( - 150 c2)))

(command "line" t1 t2 "")

(setq l2 (entlast))

(setq t3 (list (car t2) ( - (cadr t2) r2)))

(setq t4 (list (+ 150 (/ r1 2) (/ r3 2)) (cadr t3)))

(command "line" t3 t4 "")

(setq l3 (entlast))

(setq t5 (list (+ 150 r3) (+ 150 (/ r1 2))))

(setq t6 (list (car t4) (cadr t2)))

(command "line" t5 t6 "")

(setq l4 (entlast))

(command "trim" l2 l3 l4 "" kr2 mas2 mas "")

(command "erase" mas "" "")

(command "fillet" "r" r3)

(command "fillet" l2 l3)

(setq arc1 (entlast))

(command "circle" x c3)

(setq rad3 (entlast))

(entdel kr1)

(entdel mass)

(entdel mas22)

(entdel rad3)

(setq h1 ( - w1 w2))

(command "region" "all" "")

(command "extrude" "all" "" h1 "")

(setq reg1 (entlast))

(entdel kr1)

(command "extrude" kr1 "" h1 "")

(setq en1 (entlast))

(entdel mass)

(command "extrude" mass "" h1 "")

(setq en2 (entlast))

(entdel mas22)

(command "extrude" mas22 "" h1 "")

(setq en3 (entlast))

(command "subtract" reg1 "" en1 en2 en3 "")

(command "elev" h1 "")

(command "circle" x c1)

(setq rad1 (entlast))

(setq h2 ( - w2 w3))

(command "extrude" rad1 "" h2 "")

(setq kol1 (entlast))

(command "elev" (+ h1 h2)"")

(command "circle" x c2)

(setq rad2 (entlast))

(command "extrude" rad2 "" w3 "")

(setq kol2 (entlast))

(command "union" reg1 kol1 kol2 "")

(setq reg2 (entlast))

(command "elev" "0" "")

(entdel rad3)

(command "extrude" rad3 "" w1 "")

(setq cil (entlast))

(command "subtract" reg2 "" cil "")

(command "shademode" "F" "")

(command "_. zoom" "e")

)