ย่อ-ขยายมาตราส่วนในโฉนด
;|
Scale Draft
- ย่อ-ขยายมาตราส่วนในโฉนด
- Reduce-enlarge the scale in the title deed.
Create and Design by SONGKHRAN JONGKUL July 2023
Contact https://www.facebook.com/groups/AutolispTH
|;
;;---------------------------------------------------------------
(defun my_error (msg)
(if
(or
(= msg "Function cancelled")
(= msg "quit / exit abort")
)
(princ)
(princ (strcat "\nError: " msg))
)
(if msg (Alert (strcat "\nApplication error: " msg)))
(setq *error* old_error)
(setvar "cmdecho" old_cmdecho)
(setvar "osmode" old_osnap)
(princ)
);;end my_error
;------------------------------------------------------
(defun c:scdraft ()
(vl-load-com)
(setq old_cmdecho (getvar "cmdecho"))
(setq old_osnap (getvar "osmode"))
(setq old_error *error*)
(setq *error* my_error )
(setvar "cmdecho" 0)
(setvar "dimzin" 0)
(or scd (setq scd 4000))
(setq scdefault(getdist (strcat "\nEnter Scale Default 1:<"(rtos scd 2 0)">")))
(if(not scdefault)(setq scdefault scd)(setq scd scdefault))
(or scw (setq scw 500))
(setq scwant(getdist (strcat "\nEnter Scale to Want. 1:<"(rtos scw 2 0)">")))
(if(not scwant)(setq scwant scw)(setq scw scwant))
(setvar "osmode" 1)
(setq p1(getpoint "\nPick Frist Point. :")
p2(getpoint "\nPick Second Point. :")
)
(setq led (distance p1 p2)
lesc(/(* led scdefault)1000.0) ;length in scale default meter.
lewa(/(* lesc 1000.0)scwant) ;length in scale want meter.
sct (/ lewa led)
ss (ssget)
pts (getpoint "\nPick Base Point. :")
)
(setvar "osmode" 0)
(command "_scale" ss "" "_non" pts (rtos sct 2 4))
(setq next (strcat "1:"(rtos scwant 2 0))
enam (car(entsel "\n Select Text Scale :"))
)
(if (and enam(member(cdr (assoc 0 (entget enam)))'("TEXT" "MTEXT" "ATTRIB")))
(vl-catch-all-apply 'vla-put-textstring
(list (vlax-ename->vla-object enam) next)
)
(princ "\nNot Text, Mtext or Attribute")
)
(setq *error* old_error)
(setvar "cmdecho" old_cmdecho)
(setvar "osmode" old_osnap)
(princ)
)
;;----------------------------------------------------------------+
(prompt "\n\t\t\t |------------------------------------------|\n")
(prompt "\n\t\t\t | Start with SCDRAFT to execute. |\n")
(prompt "\n\t\t\t |------------------------------------------|\n")
;-----------------------------------------------------------------+
ไม่มีความคิดเห็น:
แสดงความคิดเห็น