Jump to content

Lisp lệnh KK trong chủ đề “[yêu cầu] Lisp chỉnh sửa độ dày nét hàng loạt”

svarta timberland kängor http://www.joerglbauer.com/feld.asp?glb=svarta-timberland-kangor

Cách dùng

  1. Tải tệp 231100_kk.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 KK để chạy lisp.

Mã nguồn 231100_kk.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/70113-y%C3%AAu-c%E1%BA%A7u-lisp-ch%E1%BB%89nh-s%E1%BB%ADa-%C4%91%E1%BB%99-d%C3%A0y-n%C3%A9t-h%C3%A0ng-lo%E1%BA%A1t/
;========THAY DOI LINEWEIGHT HANG LOAT==========
;============KANGKUNG 08/04/2013================
(defun C:KK()
  (vl-load-com)
  (command "UNDO" "BE")
  (setq factor(getreal "\n Nhap he so: "))
  (vlax-for for-item (vla-get-blocks(vla-get-activedocument(vlax-get-acad-object)))
    (vlax-for item for-item
      (if (or (= (vla-Get-Lineweight item) -1) (= (vla-Get-Lineweight item) -2) (= (vla-Get-Lineweight item) -3))
	(progn
	  (setq lineweight(vla-Get-Lineweight (vlax-ename->vla-object (TBLOBJNAME "LAYER" (vla-get-Layer item)))))
	  (if (and (/= lineweight -1) (/= lineweight -2) (/= lineweight -3))
	    (if (not (minusp (setq lineweight (* lineweight factor))))
		(vla-put-lineweight (vlax-ename->vla-object (TBLOBJNAME "LAYER" (vla-get-Layer item))) (car
			(vl-remove-if-not
			'(lambda (x) (< lineweight x))
			'(0 5 9 13 15 18 20 25 30 35 40 50 53 60  
			70 80 90 100 106 120 140 158 200 211)))
                      ))
	    )
	  )
	(progn
	  (setq lineweight(vla-Get-Lineweight item))
	  (if (not (minusp (setq lineweight (* lineweight factor))))
		(vla-put-lineweight item (car
			(vl-remove-if-not
			'(lambda (x) (< lineweight x))
			'(0 5 9 13 15 18 20 25 30 35 40 50 53 60  
			70 80 90 100 106 120 140 158 200 211)))
                      ))
	  )
	)
      )
    )
  (command "UNDO" "END")
  (alert "Well done!")
  )
(princ "\n         Written By KangKung - 08/04/2013\n")
(princ "\n           Nhap KK de chay chuong trinh\n")

Thảo luận gốc

Lisp được chia sẻ trong chủ đề [yêu cầu] Lisp chỉnh sửa độ dày nét hàng loạt. Xem đúng bài viết #231100 để đọc hướng dẫn và trao đổi thêm.

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