Leaderboard
Popular Content
Showing content with the highest reputation on 08/11/2022 in all areas
-
Easiest is save excel as csv lots of read a csv. Then do the insert bit. Then just as you say insert at 0,0 and scale of 1, 0 rotation -insert bname s 1 pt 0 Then zoom 0.9XP this is a nice size just inside work area. Set attreq to 0 so turn off atts input if ok. A tip for make slides it was started back in year dot so screens with like 4k screens now will screw up the making of slides, I make my Autocad about 1/4 of screen size then make slides I am using 1920x1080. And yes can make 100 or so in one go if set up right. There is slidelibrary out there but had problems with it when I threw like 50+ at it. The old old acad slidelib.exe worked great.1 point
-
Dimension overrides are messy and are lost when the drawing they're in are inserted into another drawing. A cleaner way might be to select a dimension you want modified, modify it in the Properties Palette, then right-click and select Dim Style → Save as New Dim Style… giving it a descriptive name like "Red→0.6 h0.5" Then just change any other dimensions to that Dim Style you want. Next time you need it just import that Dim Style or add it to any templates that Dim Style would be useful in.1 point
-
True !! i like to do break codes nowadays and this code took its place in my lisp library1 point
-
Best chance of continuing to get help on forums is to record where you got that help and who you got it from which I always save as comments in the code. The original thread includes more info on what you wanted and makes more sense to whoever looks at it. Also shows respect for dlanorh who created the code for you for free.1 point
-
I know how you like to rotate things and break my code @Scoutr4 so if you use 0 angle it would be the 3rd from the top last one is using the endpoints of line when prompt for angle if they are always going to be horizontal lines. remove the getangle and update the pt line with (setq pt (mapcar '+ pt1 (list dist 0 0))1 point
-
;;----------------------------------------------------------------------;; ;; SPACE BLOCKS BY DISTANCE (defun c:dex (/ ss fblk dist pt1 line ang pt) (prompt "\nSelect Blocks to Align: ") (setq ss (ssget '((0 . "INSERT")))) (if (setq fblk (car (entsel "\nSelect First Block : "))) (ssdel fblk ss) ) (setq dist (getdist "\nSpacing Distance :")) (setq pt1 (cdr (assoc 10 (entget fblk)))) (setq ang (getangle "\nSpace Blocks on angle : ")) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq ent (entget ent)) (setq pt (polar pt1 ang dist)) (entmod (subst (cons 10 pt) (assoc 10 ent) ent)) (setq pt1 pt) ) (princ) ) ;;----------------------------------------------------------------------;; ;; MOVE BLOCKS TO LINE (defun c:xs (/ SSBLK blk pt1 pt2) (princ "\nSelect Blocks : ") (setq SSBLK (ssget '((0 . "INSERT")))) (setq line (car (entsel "\nSelect Line : "))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SSBLK))) (setq pt1 (cdr (assoc 10 (setq ent (entget ent))))) (setq pt2 (vlax-curve-getclosestpointto (vlax-ename->vla-object line) pt1)) (entmod (subst (cons 10 pt2) (assoc 10 ent) ent)) ) (C:dex) (princ) ) --edit updated code if line wasn't horizontal dex wasn't correct1 point
-
1 point
-
One of the simplest is did you pick an object if no then exit (while (setq ent (entsel "\nPick object - Press Enter to exit")) do your stuff ) ; while1 point
-
LISP commands are called differently, so it wouldn't simply work if you put "YOURLISP" or "C:YOURLISP" to the above. Because they are user-defined functions, you would have to call them like you would any other sub functions. The routine can of course be modified to suit. In my case below, for a LISP command, do not put them in quotations in the list, and supply the full name of your function including the "c:" (defun c:foo ( / cmd cmds rep) (setq cmds '("MOVE" "COPY" c:lisp1 c:lisp2 "ALIGN")) ;; Your list of commands to rinse and repeat. Will repeat to the start at the end of the list (while (progn (cond ( (eq (type (setq cmd (car cmds))) 'str) (command cmd) (while (not (zerop (getvar "cmdactive"))) (command pause)) ) ( (and (eq (type cmd) 'sym) (member (type (eval cmd)) '(subr usubr))) ((eval cmd)) ) ) (initget "Repeat Next Exit") (setq rep (getkword (strcat "\nRepeat " (if (eq (type cmd) 'sym) (vl-string-subst "" "C:" (vl-prin1-to-string cmd)) cmd) " command or proceed to next? [Repeat/Next/Exit]: <Repeat>: ") ) ) (cond ((member rep '("Repeat" nil))) ((= rep "Next") (setq cmds (append (cdr cmds) (list cmd)))) ) ) ) (princ) )1 point
-
Updating code. sorting blocks from insertion point works if all blocks are basically in a line. if their are deviations off the line then the code might not work depending on the rotation. This code fixes those issues and makes the code work both in AutoCAD and BricsCAD with out having to change > around depending on what software you use. it also uses zoom to object to make sure nentselp is working even if your zoomed out. ;;----------------------------------------------------------------------;; ;; CONNECT BLOCK TO LINE (defun C:FOO (/ r ss line p1 p2 p3 p4 brkpts) (or (setq r (vlax-ldata-get "radius" "R")) (C:SETUP)) ;thanks ronjonp (setq ss (ssget '((0 . "INSERT")))) (setq line (car (entsel "\nSelect Line: "))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq p1 (vlax-get (vlax-ename->vla-object ent) 'InsertionPoint)) (setq p2 (vlax-curve-getclosestpointto (vlax-ename->vla-object line) p1)) (entmake (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2))) (setq p3 (polar p2 (+ (angle p1 p2) (/ pi 2)) r)) (setq brkpts (cons p3 brkpts)) (setq p4 (polar p2 (- (angle p1 p2) (/ pi 2)) r)) (setq brkpts (cons p4 brkpts)) (entmake (list (cons 0 "ARC") (cons 10 p2) (cons 40 r) (cons 50 (angle p2 p3)) (cons 51 (angle p2 p4)))) ) (setq brklst (vl-sort brklst '(lambda (a b) (if (equal (car a) (car b) 1e-6) (> (cadr a) (cadr b)) (> (car a) (car b)) ) ) ) ) (setvar 'cmdecho 0) (command "_view" "_S" "Prebreak") ;save zoom location (repeat (/ (length brkpts) 2) (setq p5 (mapcar '/ (mapcar '+ (car brkpts) (cadr brkpts)) '(2 2 2))) (entmake (list (cons 0 "CIRCLE") (cons 10 p5) (cons 40 r))) (setq cir (entlast)) (command "_.Zoom" "_OB" cir "") ;zoom to trim location (command "TRIM" cir "") (command (nentselp p5)) (command (nentselp p5)) (command "") (entdel cir) (setq brkpts (cddr brkpts)) ) (command "_View" "_R" "Prebreak") ;load zoom location (setvar 'cmdecho 1) (princ) ) ;;----------------------------------------------------------------------;; ;; SETS R FOR FOO COMMAND (defun C:SETUP () (or (setq *r (vlax-ldata-get "Radius" "R")) (setq *r 0.500)) (if (setq r (getdist (strcat "\nSet Radius [" (rtos *r 2) "]: "))) (vlax-ldata-put "Radius" "R" r) (vlax-ldata-put "Radius" "R" (setq r *r)) ) )1 point
-
Assuming that they're all AutoCAD commands and not LISP commands, perhaps you want something like this? (As soon as you hit escape, it's over) (defun c:foo ( / cmds rep) (setq cmds '("MOVE" "COPY" "ALIGN")) ;; Your list of commands to rinse and repeat. Will repeat to the start at the end of the list (while (progn (command (car cmds)) (while (not (zerop (getvar "cmdactive"))) (command pause)) (initget "Repeat Next Exit") (setq rep (getkword (strcat "\nRepeat " (car cmds) " command or proceed to next? [Repeat/Next/Exit]: <Repeat>: "))) (cond ((member rep '("Repeat" nil))) ((= rep "Next") (setq cmds (append (cdr cmds) (list (car cmds))))) ) ) ) (princ) )1 point
-
Mhupp Started using the setvars method today on some new code, THANKS. Easier than foreach.1 point
-
nice, and if you get stuck or need advice you know where to come.1 point