Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/12/2019 in all areas

  1. If you make the attribute multiline, a background mask can be applied similar to MText.
    1 point
  2. I will provide an answer when I can successfully log in next time. The Forum is having problem, but you must use both of Lee-Mac's functions, get and set.
    1 point
  3. Are you using the "plot object lineweights" and/or "plot with plot styles" toggles in the Plot|Plot Options pane? Does the issue occur with certain layers or certain objects? Are you overriding the Lineweight property on any objects? What Lineweights are you assigning to your layers? What Lineweights are assigned to the pens in your Color Table (assuming you're not using a Style Table)? As SLW210 says, more information would help. Plotting is one of the most complex operations in AutoCAD.
    1 point
  4. Have you Purged and Audited the file? Also, see here: https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Error-Cannot-find-specified-drawing-file-Please-verify-that-the-file-exists-when-opening-a-DWG-file-in-AutoCAD.html
    1 point
  5. I think the OP wants to append to the existing attribute value.
    1 point
  6. A little more information would help. What are you plotting to? A dwg and some screen shots might help. Generally if the preview is correct, the issue is in the plotter settings.
    1 point
  7. I'm not entirely sure what you are trying to achieve, but try this ;blockV - STR (defun Read:ATT (blockV / blk) (setq ss (ssget '((0 . "INSERT")(66 . 1)))) (repeat (setq i (sslength ss)) (setq blk (ssname ss (setq i (1- i)))) (LM:vl-SetAttributeValue (vlax-ename->vla-object blk) "REL" blockV) ) (princ) ) (defun c:+ATT (/ lst idx a) (setq str "i1" lst (list "i2" "i3" "i4") idx 0 ) (initget "i1 i2 i3 i4") (setq a (cond ((getkword "\n[i1/i2/i3/i4] <i1>:")) ("i1"))) (cond ( (= a "i2") (setq idx 1)) ( (= a "i3") (setq idx 2)) ( (= a "i4") (setq idx 3)) ) (setq a "i1") (if (not (zerop idx)) (repeat idx (setq a (strcat a ";" (car lst)) lst (cdr lst) ) ) ) ;(Read:ATT a) (princ) )
    1 point
  8. This may not transpire to be the source of the regeneration issue that you are encountering, but you needn't set/reset so many system variables for each use of the program - you need only store/reset the values of those system variables being modified by the program. Here is an example for you to try, based loosely on my Polyline Join program: (defun c:pj ( / ent enx sel val var ) (if (setq sel (ssget "_+.:E:S:L" '( (-4 . "<OR") (0 . "LINE,ARC") (-4 . "<AND") (0 . "LWPOLYLINE") (-4 . "<NOT") (-4 . "&=") (70 . 1) (-4 . "NOT>") (-4 . "AND>") (-4 . "OR>") ) ) ) (progn (setq var '(cmdecho peditaccept) val (mapcar 'getvar var) ent (entlast) ) (mapcar '(lambda ( a b c ) (if b (setvar a c))) var val '(0 1)) (command "_.pedit" sel "_j" "_all" "" "") (mapcar '(lambda ( a b ) (if b (setvar a b))) var val) (if (and (not (eq ent (setq ent (entlast)))) (setq enx (entget ent))) (princ (strcat "\nPolyline: " (nth (logand 1 (cdr (assoc 70 enx))) '("OPEN" "CLOSED")) "\tVerices: " (itoa (cdr (assoc 90 enx))) ) ) (princ "\nUnable to create polyline from selection.") ) ) ) (princ) )
    1 point
  9. 1 point
  10. For that I use an old and useful Lisp routine, Script Creator (Coomand prompt is "SCRS"). you appload the scrs lisp file (paste in notepad and save as .lsp) and also place the scrs dcl file (save as .dcl) in the same folder. Ensure that you add that file path to trusted sources under your AutoCAD options "Files" Tab and it runs smoothly. You can run a lot of commands on an entire directory of DWGs as long as you only have one dwg open and it automatically navigates to the working folder. It's even faster than batch plotting if you have a PDF lisp command.It requires no editing and it's very fast!Can put a lot of commands in one line by adding spaces in between them or seperate commands in each line, easy breezy! Cheers... scrs.lsp ;------------------------------------------------------------------------------- ; c:Scrs - Script Creator ;------------------------------------------------------------------------------- (defun c:Scrs (/ Dcl_Id% DwgName$ DxfName$ Filename% First FolderDwgs@ FolderDxfs@ Index# Item Loop Option PathFilename$ Return# Set_Vars: Var0$ Var1$ Var2$ Var3$ Var4$ Var5$ Var6$) (if (> (length (GetDwgsList)) 1) (alert (strcat "The Script Options for Folders can only be run\n" "in a Single Document Interface. For this option\n" "close all other open drawings and try again.") );alert );if ;----------------------------------------------------------------------------- ; Set_Vars: - Set dialog tiles and variables ;----------------------------------------------------------------------------- (defun Set_Vars: (VarName$) (set (read VarName$) $value) (if (and (/= Var2$ "") (/= Var3$ "") (/= Var4$ "") (/= Var5$ "")(/= Var6$ "")) (mode_tile "Next" 0) (mode_tile "Next" 1) );if (set_tile "Toggle0" Var0$) (if (= Var0$ "1") (progn (setq Var0$ "0") (setq Var2$ "" Var3$ "" Var4$ "" Var5$ "" Var6$ "" Index# 0) (setq *Script@ (list Var1$ Var2$ Var3$ Var4$ Var5$ Var6$)) (set_tile "Text1" (strcat "Page " (itoa (/ (+ Index# 5) 5)) " of " (itoa (/ (length *Script@) 5)))) (set_tile "Edit2" Var2$) (set_tile "Edit3" Var3$) (set_tile "Edit4" Var4$) (set_tile "Edit5" Var5$) (set_tile "Edit6" Var6$) (mode_tile "Back" 1) (mode_tile "Next" 1) );progn );if );defun Set_Vars: ;----------------------------------------------------------------------------- ; Set Default Variables and List Values ;----------------------------------------------------------------------------- (if (= (length (GetDwgsList)) 1) (setq Option "2") (setq Option "1") );if (if (not *Script@) (setq *Script@ (list Option "" "" "" "" "")) );if (setq Var0$ "0" Var1$ (nth 0 *Script@) Var2$ (nth 1 *Script@) Var3$ (nth 2 *Script@) Var4$ (nth 3 *Script@) Var5$ (nth 4 *Script@) Var6$ (nth 5 *Script@) Loop t Index# 0 );setq ;----------------------------------------------------------------------------- ; Load Dialog ;----------------------------------------------------------------------------- (while Loop (if (= (length *Script@)(1+ Index#)) (setq *Script@ (append *Script@ (list "" "" "" "" ""))) );if (setq Var1$ (nth 0 *Script@) Var2$ (nth (+ Index# 1) *Script@) Var3$ (nth (+ Index# 2) *Script@) Var4$ (nth (+ Index# 3) *Script@) Var5$ (nth (+ Index# 4) *Script@) Var6$ (nth (+ Index# 5) *Script@) );setq (setq Dcl_Id% (load_dialog "Scrs.dcl")) (new_dialog "Scrs" Dcl_Id%) ;--------------------------------------------------------------------------- ; Set Dialog Initial Settings ;--------------------------------------------------------------------------- (set_tile "Title" " Script Creator") (set_tile "Radio1" Var1$) (set_tile "Text1" (strcat "Page " (itoa (/ (+ Index# 5) 5)) " of " (itoa (/ (length *Script@) 5)))) (set_tile "Edit2" Var2$) (set_tile "Edit3" Var3$) (set_tile "Edit4" Var4$) (set_tile "Edit5" Var5$) (set_tile "Edit6" Var6$) (if (= Index# 0) (mode_tile "Back" 1) );if (if (and (= Var2$ "") (= Var3$ "") (= Var4$ "") (= Var5$ "")(= Var6$ "")) (mode_tile "Next" 1) );if (if (> (length (GetDwgsList)) 1) (progn (mode_tile "2" 1) (mode_tile "3" 1) );progn );if ;--------------------------------------------------------------------------- ; Dialog Actions ;--------------------------------------------------------------------------- (action_tile "Toggle0" "(Set_Vars: \"Var0$\")") (action_tile "Radio1" "(Set_Vars: \"Var1$\")") (action_tile "Edit2" "(Set_Vars: \"Var2$\")") (action_tile "Edit3" "(Set_Vars: \"Var3$\")") (action_tile "Edit4" "(Set_Vars: \"Var4$\")") (action_tile "Edit5" "(Set_Vars: \"Var5$\")") (action_tile "Edit6" "(Set_Vars: \"Var6$\")") (action_tile "Back" "(done_dialog 2)") (action_tile "Next" "(done_dialog 3)") (setq Return# (start_dialog)) (unload_dialog Dcl_Id%) (if (= Return# 0) (exit) );if (if (= Return# 1) (if (and (= Var2$ "") (= Var3$ "") (= Var4$ "") (= Var5$ "")(= Var6$ "")) (progn (alert "Enter information for Script Commands!") (setq Loop t) );progn (setq Loop nil) );if );if (setq *Script@ (change_nth 0 Var1$ *Script@)) (setq *Script@ (change_nth (+ Index# 1) Var2$ *Script@)) (setq *Script@ (change_nth (+ Index# 2) Var3$ *Script@)) (setq *Script@ (change_nth (+ Index# 3) Var4$ *Script@)) (setq *Script@ (change_nth (+ Index# 4) Var5$ *Script@)) (setq *Script@ (change_nth (+ Index# 5) Var6$ *Script@)) (if (and Loop (= Return# 2));Back (setq Index# (- Index# 5)) );if (if (and Loop (= Return# 3));Next (setq Index# (+ Index# 5)) );if );while (if (not (findfile "C:\\Temp\\Temp.scr")) (progn (vl-load-com)(vl-mkdir "C:\\Temp")) );if (if (or (= Var1$ "2")(= Var1$ "3")) (progn (if (>= (atoi (getvar "ACADVER")) 15) (if (/= (getvar "CTAB") "Model") (command "PSPACE") );if );if (if (not *Pathname$) (setq *Pathname$ (getvar "DWGPREFIX")) );if (if (= (getvar "DWGTITLED") 0) (progn (setq DwgName$ "C:\\Temp\\Temp.dwg");Optional name (if (findfile DwgName$) (command ".SAVEAS" "" DwgName$ "Y") (command ".SAVEAS" "" DwgName$) );if );progn (if (/= (getvar "DBMOD") 0) (command ".QSAVE") );if );if );progn );if (setq First t) (if (= Var1$ "1"); This Drawing only (progn (setq Filename% (open "C:\\Temp\\Temp.scr" "w")) (foreach Item *Script@ (if First (setq First nil) (if (/= Item "") (write-line Item Filename%) );if );if );foreach );progn );if (if (= Var1$ "2"); Drawings in Folder (if (setq PathFilename$ (getfiled " Select a drawing in a folder to run Script" *Pathname$ "dwg" 2)) (progn (setq *Pathname$ (getpath PathFilename$)) (setq FolderDwgs@ (vl-directory-files *Pathname$ "*.dwg" 1)) (setq Filename% (open "C:\\Temp\\Temp.scr" "w")) (foreach DwgName$ FolderDwgs@ (write-line "FileOpen" Filename%) (write-line (strcat "\"" *Pathname$ DwgName$ "\"") Filename%) (setq First t) (foreach Item *Script@ (if First (setq First nil) (if (/= Item "") (write-line Item Filename%) );if );if );foreach (write-line "(if(/=(getvar\"DBMOD\")0)(command\"QSAVE\"))" Filename%) );foreach (if (findfile (strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))) (progn (write-line "FileOpen" Filename%) (write-line (strcat "\"" (getvar "DWGPREFIX") (getvar "DWGNAME") "\"") Filename%) );progn );if );progn (exit) );if );if (if (= Var1$ "3"); DXF files in Folder (if (setq PathFilename$ (getfiled " Select a DXF file in a folder to run Script" *Pathname$ "dxf" 2)) (progn (setq *Pathname$ (getpath PathFilename$)) (setq FolderDxfs@ (vl-directory-files *Pathname$ "*.dxf" 1)) (setq Filename% (open "C:\\Temp\\Temp.scr" "w")) (foreach DxfName$ FolderDxfs@ (write-line "FileOpen" Filename%) (write-line (strcat "\"" *Pathname$ DxfName$ "\"") Filename%) (setq First t) (foreach Item *Script@ (if First (setq First nil) (if (/= Item "") (write-line Item Filename%) );if );if );foreach (write-line "SaveAs dxf 16" Filename%) (write-line (strcat "\"" *Pathname$ DxfName$ "\"") Filename%) (write-line "Y" Filename%) );foreach (if (findfile (strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))) (progn (write-line "FileOpen" Filename%) (write-line (strcat "\"" (getvar "DWGPREFIX") (getvar "DWGNAME") "\"") Filename%) );progn );if );progn (exit) );if );if (write-line "(princ \"\\n \\n \")(princ)" Filename%) (close Filename%) (command "SCRIPT" "C:\\Temp\\Temp.scr") (princ) );defun c:Scrs ;------------------------------------------------------------------------------- ; Start of Scrs Support Utility Functions ;------------------------------------------------------------------------------- ; Change_nth - Changes the nth item in a list with a new item value. ; Arguments: 3 ; Num# = Nth number in list to change ; Value = New item value to change to ; OldList@ = List to change item value ; Returns: A list with the nth item value changed. ;------------------------------------------------------------------------------- (defun Change_nth (Num# Value OldList@) (if (<= 0 Num# (1- (length OldList@))) (if (> Num# 0) (cons (car OldList@) (Change_nth (1- Num#) Value (cdr OldList@))) (cons Value (cdr OldList@)) );if OldList@ );if );defun Change_nth ;------------------------------------------------------------------------------- ; GetDwgsList - Returns a list of open drawings ; Use (length (GetDwgsList)) for the number of open drawings. ;------------------------------------------------------------------------------- (defun GetDwgsList (/ AcadOBJ DocsOBJ DwgsList@) (if (>= (atoi (getvar "ACADVER")) 15) (progn (setq AcadOBJ (vlax-get-acad-object) DocsOBJ (vlax-get-property AcadOBJ "Documents") DwgsList@ nil );setq (vlax-for ForItem DocsOBJ (setq DwgsList@ (cons (strcat (vlax-get-property ForItem "Path") "\\" (vlax-get-property ForItem "Name")) DwgsList@)) );vlax-for (setq DwgsList@ (reverse DwgsList@)) );progn (setq DwgsList@ (list (strcat (getvar "DWGPREFIX") (getvar "DWGNAME")))) );if DwgsList@ );defun GetDwgsList ;------------------------------------------------------------------------------- ; GetPath - Used to get the path from the path and filename. ; Arguments: 1 ; PathFilename$ = Path and filename string ; Returns: Pathname string. ;------------------------------------------------------------------------------- (defun GetPath (PathFilename$) (strcat (vl-filename-directory PathFilename$) "\\") );defun GetPath ;------------------------------------------------------------------------------- ; GetLayoutList - Returns a list of layouts in the drawing in tab order ;------------------------------------------------------------------------------- (defun GetLayoutList (/ Layouts@) (vlax-map-collection (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) '(lambda (x) (setq Layouts@ (cons x Layouts@))) );vlax-map-collection (setq Layouts@ (vl-sort Layouts@ '(lambda (x y) (< (vla-get-taborder x) (vla-get-taborder y))))) (vl-remove "Model" (mapcar '(lambda (x) (vla-get-name x)) Layouts@)) );defun GetLayoutList ;------------------------------------------------------------------------------- ; c:ZoomE - Zoom extents in all layouts ;------------------------------------------------------------------------------- (defun c:ZoomE (/ Layout$) (command "LAYOUT" "S" "Model") (command "ZOOM" "E") (foreach Layout$ (GetLayoutList) (command "PSPACE") (command "ZOOM" "E") );foreach (command "LAYOUT" "S" (nth 0 (GetLayoutList))) (princ) );defun c:ZoomE ;------------------------------------------------------------------------------- ; c:Purged - Purges All including null strings ;------------------------------------------------------------------------------- (defun c:Purged (/ SS&) (command ".LAYER" "T" "0" "U" "0" "ON" "0" "S" "0" "") (setq SS& (ssget "X" '( (-4 . "<OR") ;(0 . "POINT");Optional (-4 . "<AND") (0 . "TEXT") (-4 . "<OR") (1 . "") (1 . " ") (-4 . "OR>") (-4 . "AND>") (-4 . "<AND") (0 . "MTEXT") (-4 . "<OR") (1 . "") (1 . " ") (1 . " ") (1 . "\\A1;") (1 . "\\A1; ") (1 . "\\A1; ") (-4 . "OR>") (-4 . "AND>") (-4 . "OR>") ) );ssget );setq (if SS& (command "ERASE" SS& "")) (repeat 4 (command "PURGE" "A" "*" "N")) (princ "\n \n \n \n \n \n \nPurged including null strings") (princ) );defun c:Purged ;------------------------------------------------------------------------------- (princ);End of Scrs.lsp scrs.dcl dcl_settings : default_dcl_settings { audit_level = 3; } //------------------------------------------------------------------------------ // Scrs - Script Creator [Scrs R3] //------------------------------------------------------------------------------ Scrs : dialog { key = "Title"; initial_focus = "Edit2"; : spacer { height = 0.1; } : boxed_column { label = "Script Options"; : radio_column { key = "Radio1"; width = 21; : radio_button { key = "1"; label = "This Drawing only"; } : radio_button { key = "2"; label = "Drawings in Folder"; } : radio_button { key = "3"; label = "DXF files in Folder"; } } : toggle { key = "Toggle0"; label = "Clear Script"; } : spacer { height = 0.1; } } : text { key = "Text1"; label = ""; alignment = centered; } : boxed_column { label = "Script Commands"; : edit_box { key = "Edit2"; edit_width = 21; fixed_width = true; } : edit_box { key = "Edit3"; edit_width = 21; fixed_width = true; } : edit_box { key = "Edit4"; edit_width = 21; fixed_width = true; } : edit_box { key = "Edit5"; edit_width = 21; fixed_width = true; } : edit_box { key = "Edit6"; edit_width = 21; fixed_width = true; } : spacer { height = 0.1; } } : spacer { height = 0.1; } : row { : column { : button { key = "Back"; label = "< &Back"; alignment = right; width = 11; fixed_width = true; } } : column { : button { key = "Next"; label = "&Next >"; alignment = left; width = 11; fixed_width = true; } } } : row { : column { : ok_button { alignment = right; width = 11; } } : column { : cancel_button { alignment = left; width = 11; } } } }//Scrs //------------------------------------------------------------------------------
    1 point
×
×
  • Create New...