Files

83 lines
2.2 KiB
Common Lisp

(Defun C:DIMISO ()
(Setvar "Cmdecho" 0)
(Setq DS (Getvar "Dimscale"))
(Setq DA (Getvar "Dimasz"))
(Setq DT (Getvar "Dimtxt"))
(Setq DE (Getvar "Dimexe"))
(Setq DO (Getvar "Dimexo"))
(Setq A1 (/ Pi 180.0))
(Setq A2 (/ 180 Pi))
(Initget 1 "L R")
(Setq A (Getkword "\nLeft/Right: "))
(Setq P1
(Getpoint
"\nFirst point of the first Construction-Line or RETURN to select: "))
(Cond
((= nil P1)
(Setq P2 (Entsel))
(While
(= nil P2)
(Princ "\nNo object found!")
(Setq P2 (Entsel))
)
(Setq P2 (Osnap (Cadr P2) "_MID"))
(Setq P1 (Osnap P2 "_END"))
(Setq P2 (Polar P1 (Angle P1 P2) (* 2.0 (Distance P1 P2))))
)
((Boundp 'P1)
(Initget 1)
(Setq P2 (Getpoint "\nFirst point of the second Construction-Line: "))
)
)
(Initget 1)
(Setq P3 (Getpoint "\nPlace dimensioning line: "))
(Cond
((= A "L")
(Setq B 150 C 30 G "ISOAROW2" H "ISOTEXT2" I 30)
(Setpt)
(If
(< (Cadr P6) (Cadr P7))
(Setq F -1)
(Setq F 1)
)
(Dimit)
)
((= A "R")
(Setq B 30 C 150 G "ISOAROW1" H "ISOTEXT1" I 330)
(Setpt)
(If
(< (Cadr P6) (Cadr P7))
(Setq F -1)
(Setq F 1)
)
(Dimit)
)
)
)
(Defun Setpt ()
(Setq P4 (Inters P1 (Polar P1 (* A1 B) 1) P3 (Polar P3 (* A1 C) 1) Onseg))
(Setq P5 (Inters P2 (Polar P2 (* A1 B) 1) P3 (Polar P3 (* A1 C) 1) Onseg))
(Setq P6 (Polar P4 (Angle P4 P5) (/ (Distance P4 P5) 2)))
(Setq P7 (Polar P1 (Angle P1 P2) (/ (Distance P1 P2) 2)))
)
(Defun Dimit ()
(Command "_LINE" (Polar P1 (Angle P1 P4) (* DO DS)) (Polar P4 (Angle P1 P4)
(* DE DS)) "" "_LINE" (Polar P2 (Angle P2 P5) (* DO DS)) (Polar P5
(Angle P2 P5) (* DE DS)) "" "_LINE" P4 P5 "")
(Setq P6 (Polar P6 (Angle P1 P4) (* F (* DT DS))))
(Setq D1 (Rtos (Distance P4 P5) (Getvar "Lunits") (Getvar "Luprec")))
(Command "_insert" G P4 (* DS DA) "" (* A2 (Angle P4 P5)))
(Command "_insert" G P5 (* DS DA) "" (* A2 (Angle P5 P4)))
(Prompt "\nDimensioning text <")
(Prompt D1)
(Setq D2 (Getstring t ">: "))
(If
(= D2 "")
(Setq D D1)
(Setq D D2)
)
(Command "_Text" "_S" H "_C" P6 (* DS DT) I D)
)