Jump to content

Viết lisp Break Pline tại điểm chèn Block.


Của bạn đây. Bạn thử nhé :

Cách dùng

  1. Tải tệp 173524_inn.lsp về máy.
  2. Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
  3. Gõ lệnh INN để chạy lisp.

Mã nguồn 173524_inn.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/56782-y%C3%AAu-c%E1%BA%A7u-vi%E1%BA%BFt-lisp-break-pline-t%E1%BA%A1i-%C4%91i%E1%BB%83m-ch%C3%A8n-block/?tab=comments#comment-173805

(defun C:INn(/ SS ENT OBJ )
;;;copy right by Tue_NV
(command "undo" "begin")
(setq ss (ssget '((0 . "*POLYLINE,LINE"))) i -1)
(while (setq ent (ssname ss (setq i (1+ i))))
	(if (= (acet-dxf 0 (entget ent)) "LINE")
(progn (command "pedit" "m" ent "" "y" "") (setq ent (ENTLAST)))
	)

	(setq obj (vlax-ename->vla-object ent))
	(foreach y (mapcar
'(lambda(x)
(acet-dxf 10 (entget x))
 )
(acet-ss-to-list (ssget "f" (acet-geom-vertex-list ent) '((0 . "INSERT"))))
)
(if (equal (vlax-curve-getClosestPointTo ent y nil) y 0.01)
(vlax-invoke Obj 'AddVertex (1+ (fix (vlax-curve-getparamatpoint ent y)))
(list (car y) (cadr y)))
)
	)
 )
 (command "undo" "END")
)

Thảo luận gốc

Lisp được chia sẻ trong chủ đề [yêu cầu] Viết lisp Break Pline tại điểm chèn Block.. Xem đúng bài viết #173524 để đọc hướng dẫn và trao đổi thêm.

Về Thư viện AutoLisp (trang 55)