วันจันทร์ที่ 24 กรกฎาคม พ.ศ. 2566

Install Area Tools bar

วิธีติดตั้ง Area Tools bar.

วันเสาร์ที่ 22 กรกฎาคม พ.ศ. 2566

Scale Draft ย่อ-ขยายมาตราส่วนในโฉนด

ย่อ-ขยายมาตราส่วนในโฉนด

 ;|
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")
;-----------------------------------------------------------------+

วันอังคารที่ 4 กรกฎาคม พ.ศ. 2566

Object Snap

(setq old_osnap (getvar "osmode"));;  Keep the original value before use.

Control Object Snap modes using the following bitcodes.

(setvar "osmode" 0)

0 NONe

1 ENDpoint

2 MIDpoint

4 CENter

8 NODe

16 QUAdrant

32 INTersection

64 INSertion

128 PERpendicular

256 TANgent

512 NEArest

1024 QUIck

2048 APParent Intersection

4096 EXTension

8192 PARallel

(setvar "osmode" old_osnap);;   restore original before use