Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/28/2024 in all areas

  1. Yes, this is possible, although no one think a lisp is needed because you can do this using the polyline command, but just to keep programming here it is my version of it ;;; Creates a fixed lwpolyline based on different given distances ;;; By Isaac A 20240128 ;;; https://www.cadtutor.net/forum/topic/79256-lisp-for-creating-new-line-with-a-sum-of-numbers-of-length/ (defun c:fpl (/ a b c d dw e f l oe) (vl-load-com) (vla-startundomark (setq dw (vla-get-activedocument (vlax-get-acad-object)))) (setq oe (getvar 'cmdecho)) (setvar 'cmdecho 0) (setq a (getpoint "\nPick the starting point") b (getpoint "\Pick a second point for the direction" a) c (angle a b) f (list a) ) (initget 2) (if (not (= (setq d (getreal "\nType the starting distance: ") f (append f (list (polar a c d))) ) (or 0 nil))) (progn (initget 6) (while (setq e (getreal "\nType the next distance: ")) (setq d (+ d e) f (append f (list (polar a c d))) ) ) (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(410 . "Model") '(8 . "Test_lwpolylines") '(62 . 40) '(100 . "AcDbPolyline") (cons 90 (length f)) ) (mapcar (function (lambda (l) (cons 10 l))) f) ) ) ) ) (setvar 'cmdecho oe) (vla-endundomark dw) (princ) )
    2 points
  2. Command always takes a second to run. so if you had about 50 layers that match the wcmatch its setting the first transparency to 35. then if it maches the 2nd wcmatch it then changes to 55 trans. this means it could take 50 to 100 seconds. using a cond function and swapping the order it would only execute the correct transparency on the layer. Lee's way works because its running the command once rather then 50 to 100 times. Tho I try and stay away from using command. if you don't want 100 lines of spam to the command prompt you have to set cmdecho to 0 then back after, also has a higher potential to error. this should work for autocad. might also have to throw in a regen to take effect. (vlax-for layer (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (cond ((wcmatch (vla-get-name layer) "*map*|*") (setpropertyvalue layer "Transparency" 55) ) ((wcmatch (vla-get-name layer) "*|*") (setpropertyvalue layer "Transparency" 35) ) ) )
    2 points
  3. Why not just: (command "_.-layer" "_tr" "35" "*|*" "_tr" "55" "*map*|*" "")
    2 points
  4. Try this and let me know if it works for you. ;;; Creates a fixed line based on different given distances ;;; By Isaac A 20240124 ;;; https://www.cadtutor.net/forum/topic/79256-lisp-for-creating-new-line-with-a-sum-of-numbers-of-length/?_fromLogin=1 (defun c:fl (/ a b c d dw e oe) (vl-load-com) (vla-startundomark (setq dw (vla-get-activedocument (vlax-get-acad-object)))) (setq oe (getvar 'cmdecho)) (setvar 'cmdecho 0) (setq a (getpoint "\nPick the starting point") b (getpoint "\Pick a second point for the direction" a) c (angle a b) ) (initget 2) (if (not (= (setq d (getreal "\nType the starting distance: ")) (or 0 nil))) (progn (while (setq e (getreal "\nType the next distance: ")) (setq d (+ d e)) ) (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 (mapcar '+ a (list (* d (cos c)) (* d (sin c))))) '(8 . "test_lines") '(62 . 1) ) ) ) ) (setvar 'cmdecho oe) (vla-endundomark dw) (princ) )
    1 point
×
×
  • Create New...