Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. without the actual drawings unable to test this so this is untested : (defun c:BatchXref ( / skipList folder curPhase prevPhases phaseList ) (setq skipList '("X-TTLB.dwg" "X-DETL.dwg" "X-LGND.dwg")) (setq folder (GetShellFolder "Select target folder")) ;;; Prompt for current phase number (setq curPhase (getstring "\nEnter current phase number (e.g., 03): ")) ;;; Prompt for previous phase numbers (setq prevPhases (getstring "\nEnter previous phase numbers (comma-separated, e.g., 01,02): ")) ;;; split up previous phases (setq phaseList (SplitStr prevPhases ",")) ;; Display phase info (princ (strcat "\nCurrent Phase: X-BASE-UN" curPhase)) (princ (strcat "\nPrevious Phases: " (apply 'strcat (mapcar (function (lambda (p) (strcat " " p))) phaseList)))) ;;; Create X-REF layer if needed (if (not (tblsearch "LAYER" "X-REF")) (command "_.-LAYER" "_Make" "X-REF" "_Color" "7" "X-REF" "")) ;;; Get DWG files (if (vl-consp (setq files (vl-directory-files folder "*.dwg" 1))) (progn ;;; Insert XREFs (foreach file files (if (not (member (strcase file) (mapcar 'strcase skipList))) (progn (setq fullpath (strcat folder file)) (command "_.-XREF" "_Overlay" fullpath '(0 0 0) 1 1 0) (command "_.CHPROP" "L" "" "_LA" "X-REF" "") ) ) ) ;;; Lock the layer (command "_.-LAYER" "_Lock" "X-REF" "") ;;; Change color of layers with previous phase names in XREF or nested XREF (setq layerTable (tblnext "LAYER" T)) (while layerTable (setq layerName (cdr (assoc 2 layerTable))) (setq matched nil) ;;; *** vl-string-split *** made up by glorified paperclip ;;; Split layer name into parts (XREF nesting) (setq xrefParts (SplitStr layerName "|")) ;;; Check each part for a match with previous phase names (foreach part xrefParts (if (member (strcase part) phaseList) (setq matched T))) ;;; If matched, change layer color using entmod (if matched (progn (setq layerEnt (tblobjname "LAYER" layerName)) (if layerEnt (progn (setq layerData (entget layerEnt)) (if (assoc 62 layerData) (setq layerData (subst (cons 62 251) (assoc 62 layerData) layerData)) (setq layerData (append layerData (list (cons 62 251)))) ) (entmod layerData) (entupd layerEnt) ) ) ) ) (setq layerTable (tblnext "LAYER")) ) (princ "\nOverlay XREFs added. Layers in matching XREFs and nested XREFs set to color 251.") ) (princ "\nNo folder selected / files to proces") ) (princ) ) ;;; s = string d = delimiter p = position delimiter (setq r (SplitStr "01,02" ",")) -> '("01" "02") (defun SplitStr ( s d / p ) (if (setq p (vl-string-search d s))(cons (substr s 1 p) (SplitStr (substr s (+ p 1 (strlen d))) d)) (list s))) ;;; (setq f (GetShellFolder "Select a folder")) -> "C:\\Temp\\Lisp\\" (defun GetShellFolder ( m / f s) (if (and (setq s (vlax-create-object "Shell.Application")) (setq f (vlax-invoke s 'browseforfolder 0 m 65536 "")))(setq f (vlax-get-property (vlax-get-property f 'self) 'path)) (setq f nil))(vl-catch-all-apply 'vlax-release-object (list s)) (if f (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" f)) "\\"))) Just a couple remarks : getfolder (or GetShellFolder) is more generic than selecting a drawing and stripping out path. It's not wrong but soooo last century. ChatGPT or Copilot : stop using them and learn to do it yourself. As long as those glorified paperclips are not star-trek level you can't trust them. They make up commands like in your code : (setq xrefParts (vl-string-split layerName "|")) , maybe somebody at one time created this (vl-string-split) as a custom defun but in my visual lisp editor it didn't turn blue so its not a core command. I replaced it with SplitStr. Oh I also don't see a save command anywhere so I assume that's handled by you or Copilot? I hope code above works , if not... bite me
  3. Today
  4. In the future, please use Code Tags for your code. (<> in the editor toolbar)
  5. Hello all! I work in the land development field and I'm trying to use Microsoft Copilot to write some LISP routines to make our sheet production easier on multi-phase subdivision projects. Each phase will have a separate job folder with separate xref's, C3D data files and a sheetset. Our base files will follow a naming convention that includes the unit number. So for unit 1 the base file would be X-BASE-UN01 and so on. In our base files for a given unit, we'll have a file called X-BASE-PREV-UNXX. This will have no data in and of itself, but will contain attached xref's of previous unit base files that need to be shown as existing on the current unit plans. It's essentially a one stop shop so I don't have to go hunting through 4 different job folders to find the previous unit base files every time I set up a new sheet. I'm wanting this LISP routine to do the following: 1. Prompt the user for a path to look for xref's. 2. Prompt the user for the current phase number 3. Prompt the user for previous phase numbers 4. Bring in all dwg files in the supplied location, with the exception of the titleblock, legend base and detail base. 5. Place the xref's on the X-REF layer (and make one if it doesn't exist) and lock it. 6. Analyze the layers in the drawing and change the colors of any layer in an xref that matches the user input for previous phases to 251. Eventually, I'll expand this into several LISP routines and have them do specific layer control for the sheet depending on the discipline (i.e. one for street sheets, one for sewer, one for water one for drainage). That's why I have it asking for the current unit number. But I need to get this basic framework in place first. The code that Copilot is giving me will go through the first three steps just fine but then returns an ;error too few arguments when it comes time to bring in the references. I've pasted the code below. I appreciate any light y'all can shed on this since I know very little about LISP coding or how it works (why I'm trying to use CoPilot to do this). (defun c:BatchXref ( / folder files file skipList fullpath curPhase prevPhases phaseList layerTable layerName xrefParts matched layerEnt layerData) (setq skipList '("X-TTLB.dwg" "X-DETL.dwg" "X-LGND.dwg")) ;; Prompt for folder path using file dialog (setq folder (getfiled "Select any DWG file in target folder" "" "dwg" 8)) (if folder (progn ;; Ensure folder ends with a backslash (setq folder (vl-filename-directory folder)) (if (/= (substr folder (strlen folder)) "\\") (setq folder (strcat folder "\\"))) ;; Prompt for current phase number (setq curPhase (getstring "\nEnter current phase number (e.g., 03): ")) ;; Prompt for previous phase numbers (setq prevPhases (getstring "\nEnter previous phase numbers (comma-separated, e.g., 01,02): ")) (setq phaseList (mapcar (function (lambda (x) (strcase (strcat "X-BASE-UN" x)))) (vl-remove "" (mapcar 'vl-string-trim (vl-string->list (vl-string-translate "," " " prevPhases)))) ) ) ;; Display phase info (princ (strcat "\nCurrent Phase: X-BASE-UN" curPhase)) (princ (strcat "\nPrevious Phases: " (apply 'strcat (mapcar (function (lambda (p) (strcat " " p))) phaseList)))) ;; Create X-REF layer if needed (if (not (tblsearch "LAYER" "X-REF")) (command "_.-LAYER" "_Make" "X-REF" "_Color" "7" "X-REF" "") ) ;; Get DWG files (setq files (vl-directory-files folder "*.dwg" 1)) ;; Insert XREFs (foreach file files (if (not (member (strcase file) (mapcar 'strcase skipList))) (progn (setq fullpath (strcat folder file)) (command "_.-XREF" "_Overlay" fullpath '(0 0 0) 1 1 0) (command "_.CHPROP" "L" "" "_LA" "X-REF" "") ) ) ) ;; Lock the layer (command "_.-LAYER" "_Lock" "X-REF" "") ;; Change color of layers with previous phase names in XREF or nested XREF (setq layerTable (tblnext "LAYER" T)) (while layerTable (setq layerName (cdr (assoc 2 layerTable))) (setq matched nil) ;; Split layer name into parts (XREF nesting) (setq xrefParts (vl-string-split layerName "|")) ;; Check each part for a match with previous phase names (foreach part xrefParts (if (member (strcase part) phaseList) (setq matched T) ) ) ;; If matched, change layer color using entmod (if matched (progn (setq layerEnt (tblobjname "LAYER" layerName)) (if layerEnt (progn (setq layerData (entget layerEnt)) (if (assoc 62 layerData) (setq layerData (subst (cons 62 251) (assoc 62 layerData) layerData)) (setq layerData (append layerData (list (cons 62 251)))) ) (entmod layerData) (entupd layerEnt) ) ) ) ) (setq layerTable (tblnext "LAYER")) ) (princ "\nOverlay XREFs added. Layers in matching XREFs and nested XREFs set to color 251.") ) (princ "\nNo folder selected.") ) (princ) )
  6. BCDJOHN123

    .DXF files not showing up

    On the drawing, I do the DWGUNITS command and change units to (3) millimeters and press enter for all the other settings. When it converts, it will disappear from view, and I'll usually double-click the mouse scroller to find it.
  7. SLW210

    .DXF files not showing up

    Hard to say without a drawing to look at. Most likely something to do with going from inches to mm, what is the process for doing the conversion?
  8. In the future please use Code Tags for your code. (<> in the editor toolbar)
  9. Hello. I have a multileader entity. I want to add additional leaders to my multileader. acadObj is the ActiveX object of my multileader. This is how I made it work for me: (setq muu_lead_vert_new_indx (vla-AddLeader acadObj)) (setq muu_lead_vertices_new (vlax-make-safearray vlax-vbdouble '(0 . 8))) (vlax-safearray-fill muu_lead_vertices_new (list pt1 pt2 pt3)) (vla-AddLeaderLine acadObj muu_lead_vert_new_indx muu_lead_vertices_new) It pretty much does the trick, but not as neat as I want it. If I add multiple leaders, and then I want to work with the new leaders... I search for new leaders via: (vlax-invoke acadObj 'getleaderlineindexes 0) (vlax-invoke acadObj 'getleaderlineindexes 1) but 1st command returns '(0), and the second one returns '(1), even if I already have 5 or 8 or 10 leaders on my multileader. An ugly way around that I found, is the following: (setq sbe_ml_indxlist (vl-sort (append (vlax-invoke acadObj 'getleaderlineindexes 0) (vlax-invoke acadObj 'getleaderlineindexes 1)) '<)) (and (/= (length sbe_ml_indxlist) (vla-get-LeaderCount acadObj)) (foreach memb '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) (and (not (vl-catch-all-error-p (vl-catch-all-apply '(lambda (x) (vla-GetLeaderIndex acadObj x)) (list memb)))) (setq sbe_ml_indxlist (append sbe_ml_indxlist (list memb)))))) The idea is: I make a list of leader indexes (first 2 lines). In my code I have more lines prior to it... with some verifications... but the idea is that sbe_ml_indxlist in first 2 lines should get all existing leader line indexes. Next 4 lines, check: If leader indexes added via vla-AddLeaderLine do not end in the list composed by getleaderlineindexes, I check 1 by 1, if a leader with index X exists, it adds that index to the list of existing indexes. There are still many problems... I don't want to get into too much detail... because my post is not about "solving 20 problems"... which result from damaging the multileader entity... My post is about: "please tell me the right way to add leaders to existing multileader" Some of extra-problems with multileader on which I did run vla-AddLeader, just fyi: 1. One time I had a multileader with 10+ leaders, but vla-get-leadercount showed 8 leaders. After I copied the multileader, the new one was returning 7 from vla-get-leadercount. 2. If I add leaders via (command "_.mleaderedit" entname "A" $ pause), than the ones added to the left of multileader are seen via getLeaderLineIndexes but the ones added to the right are not seen. 3. Once I had a case that getLeaderLineIndexes did not return 0-index leader... but (getLeaderIndex acadObj 0) showed that such a leader exists, but I can't recreate it.
  10. Anyone who’s used AutoCAD for a while probably remembers the little arrow buttons on the layout tabs that let you flip between sheets quickly. For some reason Autodesk removed them, and it’s always been a small but annoying thing to lose — especially when you’re working with lots of sheets. This LISP is a simple fix. It adds two commands: LNEXT to jump to the next layout and LPREV to go back. It reads the tabs in the proper order, can skip the Model tab if you want, and will loop around from the end back to the start. You can even put the commands on your Quick Access Toolbar so they’re always there, just like the old arrows used to be. Nothing fancy — just a small script that makes working with layouts feel normal again. How to install and use: Save the LISP: Copy the code into a file called LAYOUT_ARROWS.lsp. Load it in AutoCAD: Type APPLOAD → browse to your .lsp file → click Load. (Optional) To load automatically every time: place it in a support folder and add (load "LAYOUT_ARROWS.lsp") to your acaddoc.lsp. Use the commands: LNEXT – jumps to the next layout tab LPREV – jumps to the previous layout tab LTABS – lists layouts in order LGOTO – jump to a specific layout number Add arrow buttons to the Quick Access Toolbar (QAT): Type CUI and press Enter. In the Command List panel, click New Command twice. For the first command: Name: Next Layout Macro: ^C^C_LNEXT For the second command: Name: Previous Layout Macro: ^C^C_LPREV (Optional) Assign arrow icons to each command. Drag both commands into Quick Access Toolbar 1 (left panel). Click Apply and OK — your new arrow buttons will appear at the top of AutoCAD. Done. You now have simple arrow buttons to flip between layout tabs — just like AutoCAD used to have. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ; ----------------------------------------- ; LAYOUT_ARROWS.lsp — Next/Prev/Goto layout tabs ; Brings back “arrowing” between layout tabs. ; Commands: LNEXT, LPREV, LGOTO, LTABS, LSETMODEL, LSETWRAP ; Settings: NB*INCLUDE-MODEL* (T/NIL), NB*WRAP* (T/NIL) ; ----------------------------------------- (vl-load-com) ;; ----------------------------- ;; SETTINGS (tweak as you like) ;; ----------------------------- (setq NB*INCLUDE-MODEL* nil) ; T = include "Model" in rotation; NIL = skip it (setq NB*WRAP* T) ; T = wrap around at ends; NIL = stop at ends ;; -------------------------------- ;; UTIL: get tab names in TabOrder ;; -------------------------------- (defun nb:layouts-get (/ doc lays pairs name ord) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) lays (vla-get-Layouts doc) pairs '()) (vlax-for L lays (setq name (vla-get-Name L) ord (vla-get-TabOrder L)) (setq pairs (cons (cons name ord) pairs)) ) ;; sort by visible left->right order (setq pairs (vl-sort pairs '(lambda (a b) (< (cdr a) (cdr b))))) ;; optionally drop MODEL (setq pairs (if NB*INCLUDE-MODEL* pairs (vl-remove-if '(lambda (p) (= (strcase (car p)) "MODEL")) pairs))) ;; return just the names (mapcar 'car pairs) ) ;; -------------------------------- ;; UTIL: index of item in list ;; -------------------------------- (defun nb:index-of (x lst / i) (setq i 0) (while (and lst (/= (car lst) x)) (setq lst (cdr lst) i (1+ i))) (if lst i -1) ) ;; -------------------------------- ;; Safe tab switch (case-insensitive) ;; -------------------------------- (defun nb:safe-settab (name / tabs exact) (setq tabs (nb:layouts-get)) ;; find actual-cased name from current tab list (setq exact (vl-some '(lambda (x) (if (= (strcase x) (strcase name)) x)) tabs)) (if exact (setvar 'CTAB exact) (prompt (strcat "\nLayout not found in current list: " name)) ) (princ) ) ;; -------------------------------- ;; Core: next/prev logic with wrap ;; -------------------------------- (defun nb:nextprev (dir / tabs cur idx new total) (setq tabs (nb:layouts-get)) (cond ((or (null tabs) (null (cdr tabs))) (prompt "\nOnly one layout available to cycle.")) (t (setq cur (getvar 'CTAB)) ;; If Model is excluded but current is Model, start from first paper tab (if (and (not NB*INCLUDE-MODEL*) (= (strcase cur) "MODEL")) (setq cur (car tabs)) ) (setq idx (nb:index-of cur tabs) total (length tabs)) (if (< idx 0) (progn (prompt "\nCurrent tab not in list; jumping to first.") (nb:safe-settab (car tabs)) ) (progn (setq new (+ idx dir)) (cond ((and NB*WRAP* (< new 0)) (setq new (- total 1))) ((and NB*WRAP* (>= new total)) (setq new 0)) ) (if (or (< new 0) (>= new total)) (prompt "\nReached end; wrapping disabled.") (nb:safe-settab (nth new tabs)) ) ) ) ) ) (princ) ) ;; -------------------------------- ;; Commands ;; -------------------------------- (defun c:LNEXT () (nb:nextprev 1)) (defun c:LPREV () (nb:nextprev -1)) (defun c:LGOTO (/ tabs n) (setq tabs (nb:layouts-get)) (if (null tabs) (prompt "\nNo paper space layouts.") (progn (c:LTABS) (setq n (getint (strcat "\nGo to layout number <1-" (itoa (length tabs)) ">: "))) (if (and n (>= n 1) (<= n (length tabs))) (nb:safe-settab (nth (1- n) tabs)) (prompt "\nInvalid number.") ) ) ) (princ) ) (defun c:LTABS (/ tabs i cur) (setq tabs (nb:layouts-get) i 1 cur (getvar 'CTAB)) (prompt "\nLayouts (TabOrder):") (foreach L tabs (prompt (strcat "\n " (itoa i) ". " L (if (equal (strcase L) (strcase cur)) " <current>" ""))) (setq i (1+ i))) (princ) ) (defun c:LSETMODEL (/ ans) (setq ans (getkword (strcat "\nInclude MODEL in rotation? [Yes/No] <" (if NB*INCLUDE-MODEL* "Yes" "No") ">: "))) (cond ((wcmatch (strcase (vl-princ-to-string ans)) "Y*") (setq NB*INCLUDE-MODEL* T)) ((wcmatch (strcase (vl-princ-to-string ans)) "N*") (setq NB*INCLUDE-MODEL* NIL))) (princ (strcat "\nInclude MODEL: " (if NB*INCLUDE-MODEL* "Yes" "No"))) (princ) ) (defun c:LSETWRAP (/ ans) (setq ans (getkword (strcat "\nWrap-around at ends? [Yes/No] <" (if NB*WRAP* "Yes" "No") ">: "))) (cond ((wcmatch (strcase (vl-princ-to-string ans)) "Y*") (setq NB*WRAP* T)) ((wcmatch (strcase (vl-princ-to-string ans)) "N*") (setq NB*WRAP* NIL))) (princ (strcat "\nWrap enabled: " (if NB*WRAP* "Yes" "No"))) (princ) ) (prompt "\nLoaded: LNEXT / LPREV / LGOTO / LTABS (LSETMODEL, LSETWRAP to tweak).") (princ)
  11. Yesterday
  12. leonucadomi

    dimjogline plus in dimension ... help

    I love this, it's excellent, thank you
  13. leonucadomi

    dimjogline plus in dimension ... help

  14. Hello, I have AutoCAD LT and created a new template this week, but I'm having an issue when saving .dxf files to be sent to our laser cutter. When the drawings are converted from inches to mm and saved, they are over 2000 KB, and the drawings do not appear on the laser computer. Our usual file size after converting and saving is around 200 KB. I am able to save the same drawings in our previous templates and send them to the laser, no problem. I have done PURGE, AUDIT, and selected all to make sure there are no unaccounted-for objects. All the save and plot settings under OPTIONS match up with the template that saves the .dxf correctly. What am I overlooking? An issue that occurs when adjusting the DWGUNITS? A preference for saving formatting?
  15. Nikon

    Multi offset - drawing stairs

    I would add: ; Original by Emmanuel Delay + additions (defun c:MuOffLay ( / ss pt3 i off_dst obj elast pickset1 old_dst str_prompt) ;; creating a new layer (if (not (tblsearch "LAYER" "OffsetLines")) (command "_-layer" "_make" "OffsetLines" "_color" "1" "OffsetLines" "") ) ;; memorizing the distance (setq old_dst (getenv "MULTIOFF_LASTDST")) (if old_dst (progn (setq str_prompt (strcat " Offset Distance <" old_dst ">: ")) (setq off_dst (getreal str_prompt)) (if (not off_dst) (setq off_dst (atof old_dst)) ) ) (setq off_dst (getdist " Offset Distance: ")) ) (setenv "MULTIOFF_LASTDST" (rtos off_dst 2 3)) (setq pt3 (getpoint " Offset point: ")) (setq pickset1 (ssadd)) (princ " Select objects: ") (setq ss (ssget)) (setq i 0) (while (< i (sslength ss)) (setq obj (ssname ss i)) (command "_.offset" off_dst obj pt3 "") (setq elast (entlast)) (command "_.chprop" elast "" "_la" "OffsetLines" "_color" "1" "") (ssadd elast pickset1) (setq i (1+ i)) ) (sssetfirst nil pickset1) (princ) )
  16. GLAVCVS

    dimjogline plus in dimension ... help

    And this is the small variation that best fits what @leonucadomi is asking for, I think. With the peculiarity that the "jog" will be placed where the selection is made with the pickbox. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ e o s le to l) (setvar "cmdecho" 0) (command "._undo" "_be") (while (and (setq e (car (setq l (entsel "\rSelect a TEXT, MTEXT or DIMENSION...")))) (wcmatch (cdr (assoc 0 (setq le (entget e)))) "*TEXT,DIMENSION")) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" (setq to (cdr (assoc 0 le)))) (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o)) ) ) ) ) ((= "MTEXT" to) (vla-put-textstring o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textstring o)) ) ) ) ) ((= "DIMENSION" to) (if (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (entmod (append le (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 (cadr l))))))) (if (= (vla-get-textoverride o) "") (vla-put-textoverride o "\\O<>") (vla-put-textoverride o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textoverride o)) ) ) ) ) ) ) ) (command "._undo" "_end") (setvar "cmdecho" 1) (princ) )
  17. GLAVCVS

    dimjogline plus in dimension ... help

    This will do what you want by selecting multiple objects in the selection set. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ o s le to p1 p2 pIns) (setvar "cmdecho" 0) (command "._undo" "_be") (if (setq s (ssget ":L" '((0 . "*TEXT,DIMENSION")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" (setq to (cdr (assoc 0 (setq le (entget e)))))) (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o)) ) ) ) ) ((= "MTEXT" to) (vla-put-textstring o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textstring o)) ) ) ) ) ((= "DIMENSION" to) (if (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (setq p1 (cdr (assoc 13 le)) p2 (cdr (assoc 14 le)) pIns (polar (cdr (assoc 10 le)) (angle p2 p1) (* (distance p1 p2) 0.8)) x (entmod (append (entget e) (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 pIns)))))) ) (if (= (vla-get-textoverride o) "") (vla-put-textoverride o "\\O<>") (vla-put-textoverride o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textoverride o)) ) ) ) ) ) ) ) ) (command "._undo" "_end") (setvar "cmdecho" 1) (princ) )
  18. Change if to while. (if (setq s (ssget ""_+.:E:S" '((0 . "*TEXT,DIMENSION")))) .. runs once ) (while (setq s (ssget "_+.:E:S" '((0 . "*TEXT,DIMENSION")))) ... repeats while you have an entity selected. have to right click or enter to exit loop )
  19. leonucadomi

    dimjogline plus in dimension ... help

    I have already managed to change the selection to individual and cancel the zoom but to repeat the routine I use repeat 100 (....) I don't know any other way
  20. Its incomplete code and only uses vla-object names showing best practice for using cond. Use the original code setting e type outside the cond to check instead of using enget for each cond check. with dimensions you use entget three times, mtext two times. its probably only saving ms of time. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ o s pt i p1 p2 le typ) (setvar "cmdecho" 0) (command "._undo" "_be") (if (setq s (ssget ":L" '((0 . "*TEXT,DIMENSION")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq typ (cdr (assoc 0 (entget e)))) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" typ) ... ) Every time you are using enget its returning something like this. ( (0 . "MTEXT") ; saving this bit (5 . "1F2") (330 . <owner>) (100 . "AcDbEntity") (67 . 0) (8 . "TextLayer") (100 . "AcDbMText") (10 100.0 200.0 0.0) (40 . 2.5) (41 . 50.0) (71 . 1) (72 . 5) (1 . "This is a multiline text") (7 . "Standard") (210 0.0 0.0 1.0) (11 100.0 200.0 0.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (73 . 1) (44 . 0.0) (45 . 0.0) (90 . 0) (91 . 1) (92 . 0) (93 . 0) (94 . 0) (95 . 0) )
  21. leonucadomi

    dimjogline plus in dimension ... help

    This is what I need, I just would like it to be for selecting a single selection (entsel) and not zoom, Just select a dimension and a point for the jogline and repeat the routine.
  22. leonucadomi

    dimjogline plus in dimension ... help

    a default location near any arrow
  23. leonucadomi

    dimjogline plus in dimension ... help

    something is wrong
  24. Is it possible not to specify breakpoints, but just make a break to the right of the text?
  25. Just sharing a simple script I just wrote, I don't have a question When drawing the hidden lines of stairs steps (the overlap of the lower step hidden under the step above) I thought: I would like to select all the steps; multi offset them; the offset lines should be selected and gripped, so that I can set them in a different layer (a layer with LType Hidden) ... But feel free to comment, improve, ... ;; Multi Offset. New objects get selected and gripped. ;; For example to make the hidden stairs steps... Select all (defun c:moff ( / sel ss pt3 i off_dst obj elast pickset1) (setq off_dst (getdist "\nOffset Distanct: ")) (setq pt3 (getpoint "\nOffset point: ")) (setq pickset1 (ssadd)) (princ "\nSelect objects: ") (setq ss (ssget)) (setq i 0) (repeat (sslength ss) (setq obj (ssname ss i)) (command "offset" off_dst obj pt3 "") (setq elast (entlast)) ;; (ssadd elast pickset1) (setq i (+ i 1)) ) ;; now grip the pickset (the newly made objects) (sssetfirst nil pickset1) )
  26. GLAVCVS

    dimjogline plus in dimension ... help

    I think I forgot something important: when there are multiple selections, it's necessary to show the user which object will be modified in each case. Below, I've included the complete code with a zoom utility to show the user the next object to modify. ; Original by RonJonP, edited by P. Kenewell and GLAVCVS (defun c:ltx (/ o s pt i p1 p2 le) (setvar "cmdecho" 0) (command "._undo" "_be") (if (setq s (ssget ":L" '((0 . "*TEXT,DIMENSION")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" (cdr (assoc 0 (entget e)))) (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o)) ) ) ) ) ((= "MTEXT" (cdr (assoc 0 (entget e)))) (vla-put-textstring o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textstring o)) ) ) ) ) ((= "DIMENSION" (cdr (assoc 0 (entget e)))) (if (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (command "_zoom" "_w" (setq i (cdr (assoc 10 (setq le (entget e))))) (polar i (angle (setq p2 (cdr (assoc 14 le))) (setq p1 (cdr (assoc 13 le)))) (distance p1 p2))) (if (setq pt (getpoint "\rJOG: Pick a point on the DIMENSION line")) (entmod (append (entget e) (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 pt)))))) ) (if (= (vla-get-textoverride o) "") (vla-put-textoverride o "\\O<>") (vla-put-textoverride o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textoverride o)) ) ) ) ) ) ) ) ) (command "._undo" "_end") (setvar "cmdecho" 1) (princ) )
  27. GLAVCVS

    dimjogline plus in dimension ... help

    To indicate the 'jog' position 1 to 1, insert this code after the clause ((= "DIMENSION"... (entget e) )))) (if (not (tblsearch "APPID" "ACAD_DSTYLE_DIMJAG_POSITION")) (regapp "ACAD_DSTYLE_DIMJAG_POSITION") ) (if (setq pt (getpoint "\nJOG: Pick a point on the DIMENSION line")) (entmod (append (entget e) (list (list -3 (list "ACAD_DSTYLE_DIMJAG_POSITION" '(1070 . 387) '(1070 . 3) '(1070 . 389) (cons 1010 pt)))))) )
  1. Load more activity
×
×
  • Create New...