https://www.cadtutor.net/forum/topic/22887-boundary-creation-lisp-a-request/
Boundary Creation Lisp- a request
Hi, I am doing a work that prompts me to use boundary creation often so I would like to request for Boundary creation LISP. The normal process (AutoCad 2007) when I typed in a command for boundary or "bo"- 1. Type boundary or BO at command line 2. the dial
www.cadtutor.net
(defun c:BND (/ pt)
(while (setq pt (getpoint "\nPick internal point: "))
(command "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "")
)
(princ)
)
;;===== Get insert point for TEXT =====
https://www.cadtutor.net/forum/topic/1070-text-insert-point/
text insert point
Hi, This is my first post in this forum. And as you'll notice I am a beginner to AutoCAD macros. I have worked with Excel macros for quite a while. But with AutoCAD it's all different. I couldn't find a reference help for macros. (object model, methods, co
www.cadtutor.net
(defun c:test()
(setq ss (ssget "X" (list '(0 . "TEXT"))))
(repeat (setq i (sslength ss))
(setq tx1 (ssname ss (setq i (1- i)))
;; a10 (assoc 10 (entget tx1)) ; insert point for text
a11 (assoc 11 (entget tx1)) ; insert point for justification of text
a10 (list 10 (cadr a11) (caddr a11) 0) ; list (10 point Px Py 0)
poi (list '(0 . "POINT") a10)
)
(entmake poi)
)
)
;;;;
;;;;===== Get Boundaries by TEXTs =====
;;;;2025_05_08
(defun KM:BND ( pt0 / pt)
(setq pt pt0)
(command "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "")
(princ)
)
(defun KM:getJtexts( / )
(setq ss (ssget ":S" (list '(0 . "TEXT"))))
(setq tx1 (ssname ss 0)
a11 (assoc 11 (entget tx1)) ; insert point for justification of text
jp (list (cadr a11) (caddr a11) 0.0) ; list ( Px Py 0.0)
)
(print jp)
)
(defun KM:area_lwp ( / e id area m2area )
(setq e (entget (entlast)))
(setq id (cdr (assoc -1 e)))
(setq area (vlax-curve-getArea id))
(setq m2area (* 1.0e-06 area)) ; mm2 -> m2
(setq _M2 (strcat ": " (rtos m2area 2 2) "m2")) ; roundup 0.0#
(princ)
); defun
(defun KM:RmAreaX ( _M2 / txt_lst rmname exist_m2 rmarea)
(setq txt_lst (entget tx1))
(setq rmname (cdr (assoc 1 txt_lst)))
(if (/= nil (setq exist_m2 (vl-string-search ":" rmname))); if it exist rmarea, update rmarea.
(progn
(setq rmname
(substr rmname 1 exist_m2))); progn
); if
(setq rmarea (cons 1 (strcat rmname _M2)))
(entmod (subst rmarea (assoc 1 txt_lst) txt_lst))
(princ)
); defun
;;----- Main get Boundaries by Texts -----
(defun c:aaa( / ) ;Auto careate LWPolyline for AREA
(setq jpt (KM:getJtexts))
(KM:BND jpt)
(KM:area_lwp)
(KM:RmAreaX _M2)
)
'autocad' 카테고리의 다른 글
| Auto creating Room Areas (4) | 2025.05.08 |
|---|---|
| Stamping DATE/TIME (0) | 2025.05.08 |
| location acad.cui (0) | 2025.03.11 |
| 임의의 시트를 출력하기 위한 도각 선택 모듈 (0) | 2025.01.23 |
| get screen coordinates (0) | 2025.01.23 |