All Activity
- Past hour
-
Tapered Offset/Stretch closed polyline shape
GLAVCVS replied to SLW210's topic in AutoLISP, Visual LISP & DCL
I think this thread is becoming interesting again. I suppose there will be some updates in the near future — I believe @Dexus has opened the door to some much-needed improvements. As for me, I take up the gauntlet. But I believe the basic rule should be not to rely on third-party libraries/APIs (except those inherent to Windows and AutoCAD). - Today
-
Tapered Offset/Stretch closed polyline shape
SLW210 replied to SLW210's topic in AutoLISP, Visual LISP & DCL
The biggest advantage to LISP solution is usability, very few people are allowed to load programs on their work computers, but most can download and run a LISP. @GLAVCVS latest works fine for me as of now. Right now I'm just getting a few things done for after I retire to help those behind me do things easier. I might just do a whole new take on a solution to this issue and have the user input the new diameters/radii, lengths, etc. and redraw it. -
Yes, the Intel® Iris® Xe Graphics in the Lenovo Yoga Slim 6 OLED should be suitable for AutoCAD 2D work. While it's not a dedicated GPU, Iris Xe performs well for general productivity and light design tasks. For 2D drafting in AutoCAD, it will handle things smoothly. However, for more demanding 3D modeling or rendering, a system with a dedicated GPU would be a better fit. For your described use case, you should be just fine.
-
Tapered Offset/Stretch closed polyline shape
GLAVCVS replied to SLW210's topic in AutoLISP, Visual LISP & DCL
Everything can be improved But, IMO, there are two fundamental aspects in which Lisp code has a clear advantage over others: self-sufficiency and versatility. Self-sufficiency: because the code is able to resolve by itself (using the two platforms it has available—Windows and AutoCAD) all the needs it may encounter to solve a problem. Versatility: a *.lsp file is much more versatile and adaptable across versions (for obvious reasons) than a *.arx file. @dexus Therefore, if you write something entirely in Lisp that solves whatever you consider important, I will also applaud your code. (P.S.: Sometimes the .arx file that’s supposed to be valid for a certain version of AutoCAD doesn’t work—as you can see in the image.) I believe AutoCAD has made it this far not because its applications are particularly fast or slow, but because it gives the user a great deal of freedom in handling drawing objects. Someone said in another thread on this forum that AutoCAD will eventually stop supporting Visual Lisp. The day that happens, I know many who will stop using AutoCAD and stick with whatever software best inherits its strengths. And I will be one of them. -
rlx started following Just a funny / basic toolbar
-
Wanted more buttons but ran out of space so just created an alternative reallity for myself. Its very basic / simple and a work in progress but as usual time is not on my side especially now my boss in away for 4 weeks and he probably was afraid I would get bored and start to play with myself , whatever. Maybe it's useful , maybe it's not...bite me. ;;; RlxGrMenu - 2025-07-08 - Just a funny / very basic little 'toolbar' ;;; It draws a column with 12 rows. Config is not working yet, quit by click or by typing Q or q. ;;; I've run a little out of button-space so wanted an out of the box fix for my problem. ;;; It's just a way to run my 10 most used lisp routines, nothing more , nothing less. ;;; Substitute the names in app-list (line 45 in this file) with the names of your own favorite lisp routines. ;;; apps have to be in search path so (findfile (strcat "MyApp" ".lsp") should work'. ;;; Also app should not be self executing and the start command should be same as app name ;;; If your app is named "MyApp" this routine loads app if found and starts it with (eval (read (strcat "C:" "Myapp"))) ;;; have fun ;;; ------------------------------ ;;; ;;; |S1 S2| ;;; ;;; | -------------- ----- [a]| ;;; ;;; | |E1 E2| [b]| ;;; ;;; | | | [c]| ;;; ;;; | | | [d]| ;;; ;;; | |E3 E4| [e]| ;;; ;;; | -------------------- [f]| ;;; ;;; |S3 S4| ;;; ;;; ------------------------------ ;;; ;;; (count_calcula) : ;;; values are effected by resize window : vc , vs , ss , x+ , x- , y+ , y- , P1-P4 ;;; screen corner points : S1 = (x- y+) , S2 (x+ y+) , S3 (x- y-) , S4 (x+ y-) ;;; extents corner points : E1 - E5 extmin / extmax ;;; viewsize : vs - height current viewport (drawing units) (i.e. 300 / 386 after resize) ;;; screen size : ss (1187 532) (pixels) after max acad window : vs = 386 , ss = (1840 685) ;;; - 12 rows, 1-10 for user , 11 for confid , 12 for exit ;;; - height each row = (fix (/ (- y+ y-) 12)) , for example 25 ;;; - row width = row height , lets call it cell-size ;;; cell-ip = (list (- (fix x+) cell-size) (fix y+)) ;;; vector draw cell-ip -> cell-size<0, (* cell-size 12)<270 , cell-size<180 , (* cell-size 12)<90 (defun draw_menu ( / ip-x ip-y cell-h cell-w cell-ul cell-ll cell-ur cell-lr y-list ctr-x app-list app) (redraw) ;;; get live screen data (count_calcula) ;(setq app-list (list "LC" "VT" "RlxBatch" "USB" "FX" "FIP" "LspUser1" "LspUser2" "LspUser2" "Spare" "Config" "Quit")) ;(setq cell-h (fix (/ (- y+ y-) 12)) cell-w (* cell-h 2)) ;;;; corner points ;(setq cell-ul (list (- (fix x+) cell-w) (fix y+)) cell-ur (list (fix x+) (fix y+)) ; cell-ll (list (- (fix x+) cell-w) (fix y-)) cell-lr (list (fix x+) (fix y-))) (setq app-list (list "LC" "VT" "RlxBatch" "USB" "FX" "FIP" "LspUser1" "LspUser2" "LspUser2" "Spare" "Config" "Quit")) (setq cell-h (/ (- y+ y-) 12) cell-w (* cell-h 2)) ;;; corner points (setq cell-ul (list (- x+ cell-w) y+) cell-ur (list x+ y+) cell-ll (list (- x+ cell-w) y-) cell-lr (list x+ y-)) ;;; draw the outlines (grdraw cell-ll cell-ul 1)(grdraw cell-ul cell-ur 1)(grdraw cell-ur cell-lr 1)(grdraw cell-lr cell-ll 1) ;;; get y values for all horizontal separators (setq x-list (list (car cell-ll) (car cell-lr)) y-list (gnl- (- (fix y+) cell-h) 11 cell-h)) (foreach y y-list (grdraw (list (car cell-ll) y) (list (car cell-lr) y) 1) ) ;;; label the cell (setq ctr-x (+ (car cell-ll) (* cell-w 0.5))) (mapcar '(lambda (s y)(grtxt (strcase s) (list ctr-x (+ y (* cell-h 0.5))) 1 0 "M")) app-list (append y-list (list (- (last y-list) cell-h)))) (RlxGrMenu_Get_Cell_ID x-list y-list) ;;; launch app (if app (RlxGrMenu_Start_App app)) (princ) ) ;;; (re) calculate display parameters (count_calcula) (defun count_calcula () (setq vc (getvar "VIEWCTR") vs (getvar "VIEWSIZE") ss (getvar "SCREENSIZE") dx (* vs (/ (car ss) (cadr ss)) 0.5) dy (* vs 0.5) x- (- (car vc) dx) y- (- (cadr vc) dy) x+ (+ (car vc) dx) y+ (+ (cadr vc) dy) ip (getvar "viewctr") vc-x (car ip) vc-y (cadr ip) txt-h (/ (getvar "VIEWSIZE") 100.0))) ;;; (getvar "extmin") (getvar "extmax") (setq dvx (- x+ x-) dvy (- y+ y-)) (defun screen_res (/ s i is) (setq s (vlax-invoke (vlax-create-object "WbemScripting.SWbemLocator") 'ConnectServer nil nil nil nil nil nil nil) is (vlax-invoke s 'ExecQuery "SELECT CurrentHorizontalResolution, CurrentVerticalResolution FROM Win32_VideoController")) (vlax-for i is (vlax-get i 'CurrentHorizontalResolution))) ;;; get aspect ratio current screen (defun asp_rat () (rtos (* 1.5 (/ (getvar "VIEWSIZE") (cadr (getvar "SCREENSIZE")))))) ;;; determine status caps lock for when typing filter (even though filter uses strcase) (defun case (s) (cond ((null s) "") ((not (eq (type s) 'STR)) "") ((null capslock) s) (t (if (= (acet-sys-keystate 20) 0) (strcase s t) (strcase s))))) ;;; generate number (gnum 1 5) -> '(1 2 3 4 5) (defun gnum (s e / i l) (and (numberp s)(numberp e)(setq i s)(while (<= i e)(setq l (cons i l) i (1+ i)))) (reverse l)) ;;; i = startnumber n = number of numbers , d = difference (gnl- 100 6 12) -> (100 88 76 64 52 40) (defun gnl- (i n d / l) (setq l (list i))(repeat (1- n)(setq l (cons (setq i (- i d)) l)))(reverse l)) ;;; found this old lisp (grtxt.lsp) , don't know author but all credits are for this human from earth ;;; text string / coordinate point / color / angle justificationz ;;; *** UPPER CASE ONLY *** (grtxt (STRCASE "Rob") (getvar "viewctr") 1 0 "M") (defun grtxt (ts cp cl a j / vp ltb i xp z c p1 p2 lp ld n al) ;;; vertex points (setq vp '(( 1 ( 0.50 0.25))( 2 ( 0.50 0.55))( 3 ( 0.50 0.85))( 4 ( 0.50 1.00))( 5 ( 0.25 1.00)) ( 6 ( 0.00 1.00))( 7 (-0.25 1.00))( 8 (-0.50 1.00))( 9 (-0.50 0.85))(10 (-0.50 0.55)) (11 (-0.50 0.25))(12 (-0.50 0.10))(13 (-0.25 0.10))(14 ( 0.00 0.10))(15 ( 0.25 0.10)) (16 ( 0.50 0.10))(17 ( 0.50 -0.05))(18 ( 0.50 -0.45))(19 ( 0.50 -0.85))(20 ( 0.50 -1.00)) (21 ( 0.25 -1.00))(22 ( 0.00 -1.00))(23 (-0.25 -1.00))(24 (-0.50 -1.00))(25 (-0.50 -0.85)) (26 (-0.50 -0.40))(27 (-0.50 -0.05))(30 ( 0.35 0.85))(31 (-0.35 0.85))(32 (-0.35 -0.85)) (33 ( 0.35 -0.85))(40 ( 0.25 0.35))(41 (-0.25 0.35))(42 ( 0.25 -0.15))(43 (-0.25 -0.15)) (44 ( 0.00 0.45))(45 ( 0.00 -0.25))(50 ( 0.30 0.20))(51 ( 0.30 0.35))(52 ( 0.20 0.35)) (53 ( 0.20 0.20))(54 ( 0.30 0.10))(55 ( 0.30 -0.10))(56 ( 0.20 -0.10))(57 ( 0.20 0.10)) (60 (-0.30 0.20))(61 (-0.30 0.35))(62 (-0.20 0.35))(63 (-0.20 0.20))(64 (-0.30 0.10)) (65 (-0.30 -0.10))(66 (-0.20 -0.10))(67 (-0.20 0.10)))) ;;; letter table (setq ltb '(("A" 24 9 7 5 3 20 16 12) ("B" 12 15 1 3 5 8 24 21 19 17 15) ("C" 3 5 7 9 25 23 21 19) ("D" 3 5 8 24 21 19 3) ("E" 4 8 12 15 12 24 20) ("F" 4 8 12 15 12 24) ("G" 3 5 7 9 25 23 21 19 16 14) ("H" 20 -4 8 -24 16 12) ("I" 7 5 6 22 23 21) ("J" 4 19 21 23 25) ("K" 8 24 12 13 4 13 20) ("L" 8 24 20) ("M" 24 8 14 4 20) ("N" 24 8 20 4) ("O" 3 5 7 9 25 23 21 19 3) ("P" 12 15 1 3 5 8 24) ("Q" 3 5 7 9 25 23 21 19 3 -19 20 45) ("R" 20 14 12 15 1 3 5 8 24) ("S" 3 5 7 9 11 13 15 17 19 21 23 25) ("T" 4 8 6 22) ("U" 8 25 23 21 19 4 20) ("V" 8 22 4) ("W" 8 23 14 21 4) ("X" 4 -24 8 20) ("Y" 8 14 22 14 4) ("Z" 8 4 24 20) ("0" 3 5 7 9 25 23 21 19 -3 4 24) ("1" 31 7 6 22 21 23) ("2" 9 7 5 3 1 15 13 27 24 20) ("3" 9 7 5 3 1 15 13 15 17 19 21 23 25) ("4" 8 12 16 15 5 21) ("5" 4 8 12 15 17 19 21 23 25) ("6" 3 5 7 9 25 23 21 19 17 15 12) ("7" 8 4 22) ("8" 3 5 7 9 11 13 27 25 23 21 19 17 15 13 15 1 3) ("9" 25 23 21 19 3 5 7 9 11 13 16) ("<" 4 12 20) (">" 8 16 24) ("," 33 21) ("." 19 20 21 33 19) ("\'" 4 30) ("\"" 4 -30 7 31) (";" 50 51 52 53 -50 54 55 56 57 55 45) (":" 50 51 52 53 -50 54 55 56 57 55) ("\\" 8 20) ("/" 4 24) ("?" 11 10 7 5 2 1 45 22) ("|" 6 -44 45 22) ("+" 44 -45 13 15) ("=" 40 -41 43 42) ("-" 13 15) ("_" 20 24) (")" 6 2 18 22) ("(" 6 10 26 22) ("*" 40 -43 41 -42 45 44) ("&" 21 31 7 6 26 25 23 16) ("^" 10 6 2) ("%" 57 54 55 56 -57 63 60 61 62 -63 5 24) ("$" 3 5 7 9 11 13 15 17 19 21 23 25 -26 22 6) ("#" 24 -6 22 -4 1 -11 17 27) ("@" 42 15 40 44 41 13 43 45 42 17 3 5 7 9 25 23 21 19) ("!" 6 -45 22 22) ("~" 9 31 44 40 2) ("`" 8 31) ("[" 6 8 24 22) ("]" 6 4 20 22) ("{" 6 7 41 12 43 23 22) ("}" 6 5 40 16 42 21 22) (""))) ;;; text height (setq z (/ (getvar "VIEWSIZE") (cadr (getvar "SCREENSIZE")) 0.2)) (cond ;;; left justification ((eq (strcase (substr j 1 1)) "L") (setq xp (list (+ (car cp) z) (cadr cp)) i 1)) ;;; middle justification ((eq (strcase (substr j 1 1)) "M") (setq xp (list (- (car cp) (* z (strlen ts) 0.5)) (cadr cp)) i 1)) ;;; right justification ((eq (strcase (substr j 1 1)) "R") (setq xp (list (- (car cp) (* z (strlen ts) 1.5)) (cadr cp)) i 1)) ) (repeat (strlen ts) ;;; each charachter / line point list / letter point def (setq c (substr ts i 1) lp '() ld (cdr (assoc c ltb))) (while (> (length ld) 1) (setq p1 (cadr (assoc (abs (nth 0 ld)) vp)) p2 (cadr (assoc (abs (nth 1 ld)) vp)) p1 (mapcar '* (list z z) p1) p2 (mapcar '* (list z z) p2) p1 (mapcar '+ xp p1) p2 (mapcar '+ xp p2) lp (append lp (list (if (minusp (nth 0 ld)) 0 cl) p1 p2)) ld (cdr ld)) ) ;;; add rotation angle (setq n 0 al nil) (repeat (/ (length lp) 3) (setq al (cons (nth n lp) al) al (cons (polar cp (+ a (angle cp (nth (+ n 1) lp))) (distance cp (nth (+ n 1) lp))) al) al (cons (polar cp (+ a (angle cp (nth (+ n 2) lp))) (distance cp (nth (+ n 2) lp))) al)) (setq n (+ n 3)) ) (and al (grvecs (reverse al))) (setq xp (list (+ (car xp) (* z 1.5)) (cadr xp)) i (1+ i)) ) (prin1) ) ;;; probably won't need tracking mode (cut-copy-paste you know...) (defun RlxGrMenu_Get_Cell_ID (xl yl / loop inp dev tpt prev-tpt mark-current-tracking-point cell-id prev-cell-id) (setq loop T) (while loop (setq inp (vl-catch-all-apply 'grread (list T 8 1))) (if (vl-catch-all-error-p inp) (progn (setq loop nil inp nil)(redraw)) (progn (setq dev (car inp) tpt (cadr inp)) (cond ;;; point selection (3 (221.882 173.853 0.0)) ((= dev 3) (if (setq rtn (find_cell tpt xl yl)) (progn ;(alert (setq app (nth (1- (atoi rtn)) app-list))) (princ (strcat "\nLaunching : " (setq app (nth (1- (atoi rtn)) app-list)))) (setq loop nil) ) ) ) ;;; device tracking point (probably don't need tracking mode) ((= dev 5) ;;; if mouse moved (if (or (/= (car prev-tpt)(car tpt)) (/= (cadr prev-tpt)(cadr tpt))) (progn (setq prev-tpt tpt)))) ;;; Space - mark current tracking point ((and (= dev 2) (member (last inp) '(32))) (setq mark-current-tracking-point T) (setq tpt prev-tpt) (setq loop nil) ) ;;; q or Q (Quit) ((and (= dev 2) (member (last inp) '(113 81))) (redraw)(setq loop nil) ) ) ) ) ) ) ;;; pt = point , xl = x-list , yl = y-list ;;; scribble : (< 1 2 3) , (> 3 2 1) , (cdr (vl-sort '(1 2 3 4 5) '>)) -> '(4 3 2 1) (defun find_cell ( pt xl yl / ptx pty y-lst l n hit) (setq n nil hit nil ptx (car pt) pty (cadr pt) y-list (vl-sort (append yl (list 0)) '>)) (if (< (car xl) ptx (cadr xl)) (mapcar '(lambda (y)(if (and (not hit) (> pty y)) (setq hit T n (vl-position y y-list)))) y-list)) (if n (itoa (1+ n))) ) ;;; program assumes no self starting routines and start command is "C:" + app name (defun RlxGrMenu_Start_App (app / fn) (cond ((setq fn (findfile (strcat app ".lsp"))) (redraw)(load fn)(eval (read (strcat "(C:" app ")")))) ((wcmatch (strcase app) "QUIT")(princ "\nBye bye")) ((wcmatch (strcase app) "CONFIG")(princ "\nUnder construction")) (t (princ (strcat "\nUnable to load " (vl-princ-to-string app) " ...bye"))) ) (princ) ) ;;; future... ;;; RlxGrMenu - Rlx Jul/25 (defun RlxGrMenu_future ( / ;;; global variables scr-res cell-rows cell-cols cell-col cell-id app-list ;;; display parameters like viewctr/viewsize/screensize (count_calcula) vc vs ss dx dy x- x+ y- y+ ip vc-x vc-y txt-h ;;; registry variables RlxGrMenu-nof-cell-rows RlxGrMenu-nof-cell-cols RlxGrMenu-app-list ) ;;; mostly not used because for now I just just one column with 10 rows (setq scr-res (screen_res) rows 3 cols 3 cell-col 141 cell-id 1) (count_calcula) (setq app-list (list "LC" "VT" "RlxBatch" "USB" "FX" "FIP" "LspUser1" "LspUser2" "LspUser2" "Spare")) (RlxGrMenu_Init) (RlxGrMenu_Doit) (RlxGrMenu_Exit) (princ) ) (defun RlxGrMenu_Init ()(princ "\nUnder construction - RlxGrMenu_Init ")) (defun RlxGrMenu_Doit ()(princ "\nUnder construction - RlxGrMenu_Doit ")) (defun RlxGrMenu_Exit ()(princ "\nUnder construction - RlxGrMenu_Exit ")) (defun c:RlxGrMenu ()(draw_menu)) (defun c:t1 ()(draw_menu))
-
- 1
-
-
2D objects are fundamental to creating designs in AutoCAD and include many forms such as lines, arcs, circles, rectangles, and polygons. For our AutoCAD Foundations blog series, we’re sharing four quick exercises to help get you started learning the basics of 2D objects. For the full tutorial on how to create 2D objects, you can check out the AutoCAD Foundations article. 2D Objects Exercise #1: Create a Line in AutoCAD Let’s start at the very beginning. A line is the most common 2D object in a drawing. Draw a Line In this exercise, you’ll try out multiple ways to start the LINE command and draw a line. From the ribbon, click Home tab > Draw panel > Line. Or enter LINE at the Command prompt and press Enter. When prompted for the first point, you can type in a coordinate or click in the drawing area where you’d like to begin the line. Once you specify your first point, the Command prompt will ask where you’d like to end the line. Here, you can type in a coordinate or click in the drawing area. The LINE command continues to prompt you for additional points. Press Enter or the Spacebar to end the command. 2D Objects Exercise #2: How to Create a Polyline in AutoCAD Now that you have the line down, let’s move on to a polyline. A polyline is a connected series of line or arc segments that is created as a single object. They are useful for irregular shapes; borders; contour lines; roads and rivers in maps; and more. Polylines can be open or closed and have different starting and ending widths for each segment. Draw a Basic Polyline In this exercise, you’ll draw a polyline. From the ribbon, click Home tab > Draw panel > Polyline. Or enter PLINE at the Command prompt and press Enter. After you specify the first point of the polyline, you can use the Width option to specify the width of all subsequent segments. You can change the width value at any time, even as you create new segments. Continue specifying additional points to define the polyline. Press Enter or the Spacebar to end the command. 2D Objects Exercise #3: How to Create a Rectangle in AutoCAD Now, let’s move on to see how to draw closed objects such as rectangles and polygons. Draw a Rectangle In this exercise, you’ll draw a rectangle. 1. Do one of the following: From the ribbon, click Home Tab > Draw Panel > Rectangle/Polygon drop-down menu > Rectangle Or enter RECTANG at the Command prompt and press Enter 2. Specify the first and then second corner of the rectangle 2D Objects Exercise #4: How to Draw a Polygon in AutoCAD Once you’ve mastered the rectangle, you can move on to a polygon. Draw a Polygon In this exercise, you’ll create a polygon. 1. Do one of the following: From the ribbon, click Home tab > Draw panel > Rectangle/Polygon drop-down menu > Polygon Or, enter POLYGON at the Command prompt and press Enter 2. Enter the number of sides for the polygon. 3. Specify the center of the polygon. 4. Enter c to specify a polygon circumscribed about a circle. 5. Specify the radius of the circle, either by moving the cursor and clicking in the drawing area or by entering a distance. Learn More: How to Create 2D Objects Ready to move on to arcs, circles, polyline arcs, donuts, ellipses, and splines? Be sure to check out the entire AutoCAD Foundations article for even more in-depth tutorials on creating these 2D objects. And stay tuned for our entire series here on the blog (or catch up on past articles!) as we highlight even more great tips for getting started with AutoCAD. The post How to Create 2D Objects: AutoCAD Foundations appeared first on AutoCAD Blog. View the full article
-
sorry wrongly code posted (cond ((null (setq lst (vl-sort lst '(lambda (a b) (< (car a) (car b)))))) (princ "\nNo blocks found in drawing.") ) ((null (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (foreach line (list (strcat "blockpreview : dialog { label = \"" datetitle "\";") " spacer;" " : row {" " : boxed_column { label = \"Block List\"; width = 35; fixed_width = true;" " : list_box { key = \"lst\"; height = 15; fixed_height = true; tabs = \"20 8\"; }" " }" " spacer;" " : boxed_column { label = \"Preview\"; width = 35; fixed_width = true;" " : image { key = \"img\"; height = 15; fixed_height = true; }" " }" " }" " spacer;" " : image { color = 30; width = 50; height = 0.5; alignment = centered; }" " spacer;" " : boxed_column { label = \"Block Tools\";" " : row {" " : button { key = \"cbp_btn\"; label = \"Change Base Point\"; }" " : button { key = \"cbpr_btn\"; label = \"Change Base Point (Ref)\"; }" " }" " spacer;" " : row {" " : button { key = \"rename_btn\"; label = \"Rename\"; is_default = true; }" " : button { key = \"select_btn\"; label = \"Select Block\"; }" " : button { key = \"cancel\"; label = \"Cancel\"; is_cancel = true; }" " : button { key = \"about\"; label = \"About\"; }" " }" " }" " spacer;" " : text { label = \"Author: xyz | https://abcd.com/\"; alignment = centered; }" "}" ;; ) (write-line line des)) (not (setq des (close des))) (< 0 (setq dcl (load_dialog tmp))) (new_dialog "blockpreview" dcl) )) (princ "\nUnable to load dialog.") ) (t (start_list "lst") (foreach x lst (add_list (strcat (car x) "\t" (cadr x))) ; Tab-separated entry ) (end_list) (set_tile "lst" "0") (setq blkname (caar lst)) (_blockpreview blkname) ..... " : boxed_column { label = \"Block List\"; width = 35; fixed_width = true;" " : list_box { key = \"lst\"; height = 15; fixed_height = true; tabs = \"20 8\"; }" " }" ;---------------------------------------------------------------- (t (start_list "lst") (foreach x lst (add_list (strcat (car x) "\t" (cadr x))) ; Tab-separated entry ) (end_list)
-
Tapered Offset/Stretch closed polyline shape
dexus replied to SLW210's topic in AutoLISP, Visual LISP & DCL
I added a gray helper line so you can see how it edits curved segments. Maybe that makes it clearer what is happening and therefore more predictable. For me @GLAVCVS code is not as usefull since it doesn't keep tangent lines tangent when changing curves. It does work quite nicely on straight segments though. -
Trim Lines inside Rectangs
Mountain_XD replied to Mountain_XD's topic in AutoLISP, Visual LISP & DCL
Thank you so much SLW210. Your code very good (defun c:TICS) -
Tapered Offset/Stretch closed polyline shape
SLW210 replied to SLW210's topic in AutoLISP, Visual LISP & DCL
I have started down a new path (rabbit hole?), I hope to get back into this soon in LISP as well as... C#... Solved: Stretch Command code in C#.net to stretch multiple segments of closed polygon - Autodesk Community Haven't had time at home lately either. ElpanoxEvgeniy's original code works, just no accuracy, can't test the Snap addition in AutoCAD 2026. -
In the future please place your code in code tags. (<> in the editor toolbar)
-
This might help the OP... my 2nd favourite LISP website... also use Lees example above (from my 1st favourite LISP website) https://www.afralisp.net/archive/lispa/lisp49af.htm
-
Where have you added the tab character "\t"? Where did you add the tabs attribute?
-
Sir \t not working ;; Collect block names (setq lst nil) (while (setq def (tblnext "BLOCK" (null def))) (if (and (= 0 (logand 125 (cdr (assoc 70 def)))) (not (wcmatch (cdr (assoc 2 def)) "`_*,`**,*|*")) ) (setq lst (cons (cdr (assoc 2 def)) lst)) ) ) ;-----------------------------------------------DCL (cond ((null (setq lst (vl-sort lst '<))) (princ "\nNo blocks found in drawing.") ) ((null (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (foreach line (list (strcat "blockpreview : dialog { label = \"" datetitle "\";") ;; Title with date-time " spacer;" " : row {" " : boxed_column { label = \"Block List\"; width = 35; fixed_width = true;" " : list_box { key = \"lst\"; height = 15; fixed_height = true; }" " }" " spacer;" " : boxed_column { label = \"Preview\"; width = 35; fixed_width = true;" " : image { key = \"img\"; height = 15; fixed_height = true; }" " }" " }" " spacer;" " : image { color = 30; width = 50; height = 0.5; alignment = centered; }" ;; Orange line " spacer;" " : boxed_column { label = \"Block Tools\";" ;; Single box around ALL buttons " : row {" " : button { key = \"cbp_btn\"; label = \"Change Base Point\"; }" " : button { key = \"cbpr_btn\"; label = \"Change Base Point (Ref)\"; }" " }" " spacer;" " : row {" " : button { key = \"rename_btn\"; label = \"Rename\"; is_default = true; }" " : button { key = \"select_btn\"; label = \"Select Block\"; }" " : button { key = \"cancel\"; label = \"Cancel\"; is_cancel = true; }" " : button { key = \"about\"; label = \"About\"; }" " }" " }" " spacer;" " : text { label = \"Author: XYZ | https://abcd.com/\"; alignment = centered; }" "}" ) (write-line line des) ) (not (setq des (close des))) (< 0 (setq dcl (load_dialog tmp))) (new_dialog "blockpreview" dcl) ) ) (princ "\nUnable to load dialog.") ) ;---------------------------------------------------------------------------- (t (start_list "lst") (foreach x lst (add_list x)) (end_list) (set_tile "lst" "0") (setq blkname (car lst)) (_blockpreview blkname) (action_tile "lst" "(setq blkname (nth (atoi $value) lst)) (_blockpreview blkname)" ) (action_tile "rename_btn" "(done_dialog 2)") (action_tile "select_btn" "(done_dialog 3)") (action_tile "cbp_btn" "(done_dialog 4)") (action_tile "cbpr_btn" "(done_dialog 5)") (action_tile "cancel" "(done_dialog 0)") (action_tile "about" "(startapp \"explorer\" \"https://ABCD.COM/\")") (setq response (start_dialog)) (cond ((= response 2) (RENB blkname)) ((= response 3) (princ "\nSelect a block reference in the drawing.") (if (and (setq ent (car (entsel))) (= "INSERT" (cdr (assoc 0 (entget ent))))) (progn (setq blkname (cdr (assoc 2 (entget ent)))) (RENB blkname)) (princ "\nInvalid selection.") ) ) ((= response 4) (LM:changeblockbasepoint nil)) ((= response 5) (LM:changeblockbasepoint t)) ) ) ) (*error* nil) (princ) )
-
Probably, the answer to your question has already been answered. Try reading all the messages in this thread.
- Yesterday
-
@PGia "where AutoCAD controls an already running instance of Access" You should be able to use get application, this is for Excel. Try this line with Access. The code works with Word and I am pretty sure works with Access. Have your access open when running the code. ;; Try to get or create Excel instance (setq myxl (vl-catch-all-apply 'vlax-get-or-create-object '("Excel.Application"))) Did you do a Google "read and write to Access Autolisp". Pretty sure its similar to Excel uses row and columns. I can provide read write for Excel which should work with Access. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/getting-data-from-an-access-database/td-p/6238062
-
This task is posted over at Autodek forums as well https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/custom-pc3-not-supported/td-p/13710861 Some answers re set page sheet details were provided.
-
Forward Visibility Lisp - DXF issue
BIGAL replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
@SLW210 " extra time to make something." it is actually easy to work out a line from two points along say a pline, you just start with a point on the pline. and then draw an arc forward the radius = length of the line , using intersectwith you get the forward point, so just join the 2 points. @CivilTechSource need more info a dwg etc. Drive along a path uses a short arc length. -
I use the technique frequently to achieve list box columns - for example, as used by the Content Builder dialog displayed by my Incremental Numbering Suite.
-
Hi, Sorry for not replying earlier. I've been traveling for several days. @BlackBox: I don't understand what's so special about implementing a Lisp function that returns the privileges with which another application, controlled by AutoCAD, was launched. Do you need my code? Here it is: (setq Access (vl-catch-all-apply 'vlax-get-object '("Access.Application"))) (if (vl-catch-all-error-p Access) (progn (setq privileges (adminP "acad")) (setq msg (strcat "\nThere is no current instance of Access\nA new one will open with the same privileges as AutoCAD: " privileges)) (alert msg) (setq Access (vl-catch-all-apply 'vlax-create-object '("Access.Application"))) (if (vl-catch-all-error-p Access) (princ "\nIt was not possible to open a new instance of Access") (progn (vlax-put-property Access 'Visible :vlax-true) (princ "\nConnection successful") ) ) ) (progn (setq privileges (adminP "access")) (setq msg (strcat "\nAn instance of Microsoft Access was found with the folowing privileges: " privileges "\nConnection successful")) (alert msg) ) ) Where adminP is the function I need. It's something I found somewhere and I'm trying to adapt it to my needs. This code will be used on 3 PCs. Currently, in all cases, AutoCAD is configured to start as Administrator. Therefore, any application launched from AutoCAD should inherit the same privileges, as far as I understand. However, I would also like to cover the case where AutoCAD controls an already running instance of Access, as you mentioned. So I tried to add something to the code to take that possibility into account. Is it possible to create a Lisp function that returns whether an already opened instance of Access has Administrator privileges or not?
-
BlackBox started following custom .pc3 not supported
-
Given how long ago the Autopublish mechanism was introduced, I'm surprised it's not being used more. Autopublish uses the Page Setup you've assigned to Layout, to automagically produce PDF when you save DWG. To plot a full plan set, PUBLISH is frequently used, but it plots the entire set one-at-a-time in series, which takes entirely too long. Autopublish also works in Core Console... which allows you to effectively plot all DWG files at the same time in parallel. As example: If it takes 30 seconds to PUBLISH a single-Layout drawing, it takes the same amount of time to plot all drawings in the set, and you have 50 drawings, PUBLISH might take +/-25 minutes to produce PDF. With Core Console it only takes less than 1 minute to plot the same plan set (Note: your workstation's system resources and single vs multi-layout drawings determine how long it takes, multiple single-layout drawings take less time to plot, than fewer multi-layout drawings). Here's a sample .REG file to create the Windows Shell Menu, so you can plot DWG-->PDF from File Explorer (I use Civil 3D): Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf] @="2026 DWG to PDF" "AppliesTo"=".dwg" ; "Icon"="C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe" "HasLUAShield"="" "Position"="Bottom" [HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf\command] @="\"C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe\" /i \"%1\" /ld \"C:\\Program Files\\Autodesk\\AutoCAD 2026\\AecBase.dbx\" /p \"<YourProfileHere>\" /product \"C3D\" /language \"en-US\" /s \"C:\\<YourFilePathHere>\\RightClickDwgToPdf.scr\"" Here's the dependent Script: ;; reload layer state, set other sysvars (setvar 'automaticpub 1) (command ".QSAVE") That's it; this little bit of code is all that's needed. HTH
-
@Steven P For sure I'm try this and let you know and thank you so much...
-
Not sure if this will make any difference, this is a stripped down version of my PDF plotting, - check it works first with a standard PDF plot maybe? then change to what you want. I have a little function for each pdf setting - below they are just values but would be things like client specific stuff, company styles and so on, then these are set to variables which is what most of this is. Look through for 'Change this bit here' as what to change for your PDFs. Note that there are 2 PDF plotters set, I use one to do a plot preview and one that doesn't - you'll need to change both to your Foxit plotter. Anyway, if this works for you it is a basis to do all the other stuff that you might want - just go to each sub function to adjust as you need. (defun c:pdfplot ( / ) ;; NOTE: Variables not set ;; Sub functions (defun PDFgetdetailedplotconfiguration ( / dpc) (setq dpc "Yes") dpc) (defun PDFgetlayoutname ( / lname) (setq lname (getvar "ctab")) lname ) ;;;;;;;;;;;;;;;;;;;;;; ;;Change this bit here (defun PC3Name ( / ) "DWG to PDF.pc3" ) ; plotter setting with preview ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;Change this bit here (defun PC3NameNP ( / ) "DWG to PDF no Preview.pc3" ) ; No preview plotter setting ;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;Change this bit here (defun PDFgetpapersize ( / ) (setq papersize "ISO expand A0 (841.00 x 1189.00 MM)") ) ;;;;;;;;;;;;;;;;;;;;;; (defun PDFgetpaperunits ( / pu) (setq pu "") pu) (defun PDFGetPageOrientation ( / ) (setq pageorientation "L") pageorientation) (defun PDFgetorientation ( / orientation) (setq orientation "landscape") orientation) (defun PDFgetplotupsidedown ( / plud) (setq plud "N") plud) (defun PDFgetplotarea ( / pla) (setq pla "Extents") pla) ;;Extents, Display, Limits, View (defun PDFgetplotscale ( / pls) (setq pls "Fit") pls) (defun PDFgetplotoffset ( / plo) (setq plo "Center") plo) (defun PDFgetplotwithplotstyles ( / plwpls) (setq plwpls "Y") plwpls) ;;;;;;;;;;;;;;;;;;;;;; ;;Change this bit here (defun PDFgetplotstyletablename ( / plstname) (setq plstname "acad.ctb") plstname) ;;;;;;;;;;;;;;;;;;;;;; (defun PDFgetplotwithlineweights ( / plwlw) (setq plwlw "Y") plwlw) (defun PDFgetshadeplotsetting ( / spls) (setq spls "As Displayed") spls ) (defun PDFgetfullpath ( / fp) (if (= (getvar 'dwgtitled) 1)(setq fp (getvar "dwgprefix"))) ;;drawing saved (if (= (getvar 'dwgtitled) 0)(setq fp (strcat (PDFgetDesktop) "\\"))) ;;drawing not saved fp ) (defun PDFgetDesktop ( / script spFolders desktop) ;;gets the location of the desktop (cond ( (setq script (vlax-create-object "WScript.Shell")) (setq spFolders (vlax-get-property script "SpecialFolders") desktop (vlax-invoke-method spFolders 'Item "Desktop") ) (vlax-release-object spFolders) (vlax-release-object script) )) desktop ) (defun PDFgetfilename ( / myfnloc myfn myf) ;; check in here if PDF file to write to is open (setq myfnloc (PDFgetfullpath)) (setq myfn (vl-filename-base (getvar 'dwgname))) (setq myf (strcat myfnloc myfn ".pdf")) myfn ) (defun PDFgetsaveplotsettings ( / savepls) (setq savepls "N") savepls ) (defun PDFgetproceedwithplot ( / pwpl) (setq pwpl "Y") pwpl ) (defun PDFgetplottername ( pdfpreview / pname) ;;;;pname this needs to be set up in pagesetup settings ;;;; ;;;;;;;;;;;;;;;;;;;;;; ;;Change this bit here (setq pname "DWG to PDF.pc3") ;;Default DWG to PDF plotter ;;;;;;;;;;;;;;;;;;;;;; (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3Name))) ) (setq pname (PC3Name)) );;end if (if (= pdfpreview "N") ;; plotter setting with no preview (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3NameNP))) ) (setq pname (PC3NameNP)) );;end if );;end if pname ) ;;End of sub functions (setq detailedplotconfiguration (PDFgetdetailedplotconfiguration)) (setq layoutname (PDFgetlayoutname)) (setq pdfpreview "N") (setq plottername (PDFgetplottername pdfpreview)) (setq papersize (PDFgetpapersize)) ;;drawing paper size...not plotting size if different (setq paperunits (PDFgetpaperunits)) (setq orientation (PDFgetorientation)) (setq plotupsidedown (PDFgetplotupsidedown)) (setq plotarea (PDFgetplotarea)) (setq plotscale (PDFgetplotscale)) (setq plotoffset (PDFgetplotoffset)) (setq plotwithplotstyles (PDFgetplotwithplotstyles)) (setq plotstyletablename (PDFgetplotstyletablename)) (setq plotwithlineweights (PDFgetplotwithlineweights)) (setq shadeplotsetting (PDFgetshadeplotsetting)) (setq fullpath (PDFgetfullpath)) (setq myfilename (PDFgetfilename)) (setq filepathname (strcat fullpath myfilename ".pdf")) (setq saveplotsettings (PDFgetsaveplotsettings)) (setq proceedwithplot (PDFgetproceedwithplot)) ;; Do plotting ;;Plot model space (if (= (getvar "TILEMODE") 1) ;;model space plot (progn (if (= (ssget "_x" '((410 . "Model"))) nil) ;;check if there are any objects to plot (progn (alert "-CANCELLING-\nThe drawing is blank") (exit) ) ; end progn ) ; end if (if (= plotarea "window") (command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea pause pause plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights shadeplotsetting filepathname saveplotsettings proceedwithplot) ) ; end if 'window' (if (/= plotarea "window") (command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights shadeplotsetting filepathname saveplotsettings proceedwithplot) ) ; end if ) ; end progn ) ; end if modelspace ;;Plot paper space (if (= (getvar "TILEMODE") 0) (progn (if (= plotarea "window") (command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea pause pause plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights "" "" "" filepathname saveplotsettings proceedwithplot) ) (if (= plotarea "extents") (command "zoom" "all" "zoom" ".95x") ;; Zoom screen, just because (command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights "" "" "" filepathname saveplotsettings proceedwithplot) ) ; end if ) ; end progn ) ; end if paperspace (princ) ; exit quietly )
-
I didn't know you could do that! Still need to add the tabs \t to the base list, but you'd get a better result I think
-
Lee Mac started following Gap Dcl in Block list
-
Use the DCL tabs attribute and prefix the list items with a tab character ("\t").