Leaderboard
Popular Content
Showing content with the highest reputation on 08/05/2022 in all areas
-
Oh yes, good point. ;; execute command, save with a new name, close drawing (defun autoload ( / new_name) (c:XrefBind) ;; save as. New name: (setq new_name (strcat ;; path (getvar "dwgprefix") ;; dwg name, but cut off the ".dwg" (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4) ) ;; add a postfix (strcat "_bound.dwg") ;; feel free to change this postfix ) ) (command "_saveas" "" new_name) ;;(command "Qsave") (command "close") )2 points
-
2 points
-
Try this .. does not check for locked layers: (defun c:foo (/ s) (foreach l (layoutlist) (and (setq s (ssget "_X" (list (cons 410 l)))) (= 2 (sslength s)) (setq s (mapcar 'cadr (ssnamex s))) (= "VIEWPORT" (cdr (assoc 0 (entget (car s)))) (cdr (assoc 0 (entget (cadr s))))) (mapcar 'vla-delete (mapcar 'vlax-ename->vla-object s)) ) ) (princ) )1 point
-
Just to note, xrefbind doesn't save the bound drawing as a new drawing, it might be convenient to change the qsave at the end to 'save as' with a file name "Drawing_Number_Bound.Dwg" ?1 point
-
This seems to work fine for binding. To make it even faster you can auto-execute the command. See the end of the script. It executes the command. Autoloads. Closes the drawing. (EDIT: Look at my next reply. You may not want a quick save, rather a save as with a different name) It doesn't ask questions, it just binds everything. (vla-Bind tmpObj :vlax-true) does bind->insert. Perhaps you want false (bind->bind); depending on preferences. ;; slightly modified from: ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-and-bind-all-xrefs-in-modelspace/td-p/3651968 (defun c:XrefBind (/ tmpObj) (vl-load-com) (vlax-for objs (vla-get-ModelSpace (vla-get-activedocument (vlax-get-acad-object)) ) (if (and ;; block insert (= (vla-get-ObjectName objs) "AcDbBlockReference") ;; blocks with a path are xrefs (vlax-property-available-p objs 'Path) ;; make a temporary object (setq tmpObj (vla-Item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-Acad-Object)) ) (vla-get-Name objs) ) ) (not (assoc 71 (entget (tblobjname "block" (vla-get-Name objs))))) ) ;; bind xref (progn (vla-Bind tmpObj :vlax-true) ) ) ) (princ) ) ;; execute command, quick save, close drawing (defun autoload ( / ) (c:XrefBind) (command "Qsave") (command "close") ) (autoload) ---- e-transmit, with autoload at the end. It saves a .zip with the same name and in the same folder as the drawing you run it on ;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-etransmit-all-open-file/td-p/6063206 (DEFUN c:etra () (command "_qsave") (command "_etransmit" "_c" (strcat (getvar "dwgprefix") (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 3) ) "ZIP" ) ) (command "_close" "Y") ) ;; autoload (c:etra)1 point
-
Not something I often do so can't help with the specifics, but 3 days for 100+ drawings sounds like a very long time, how are you doing this? Mostly my work is single drawing sheets, no xrefs, the client gets PDF and DWG file copied straight from our system. It might be possible to do this a bit quicker with a LISP and using something like Sctipt Pro (https://www.cadig.com/products/autocad-script-pro.php) to do all the drawings as a batch - so long as each drawing is set up to plot, publish, or e-transmit as needed, depends what you are doing now. I often use a batch and script (similar to Script Pro) to plot PDFs, mine is a bit slow (just the way it is designed), but will plot PDFs in about 4 seconds a drawing, If you had a LISP to bind a drawing it shouldn't take much longer for each drawing (10 minutes for 100 drawings.. and this is slow, slow enough to have make a cup of tea, multitasking!!). Do you do anything apart from hitting the 'bind' button for each drawing? (might be your answer is along the lines of "Oh, yeah, we have to open each drawing first to purge them, then save-as to a new location and then bind them" ), am sure that something in your process is slowing you down and am sure that could be automated to speed things up.. but I am not an expert on binding things simply because we don't do that a lot. And I am not sure if this link is any use, test it out on a temporary drawing and see what it does -there is a bit to read in there1 point
-
I normally use this at work... When prompting points in AutoCAD, AutoCAD supports ".X", ".Y" and ".Z" filters that allows you to click a point that fixes the X, Y or Z depending on what's picked. What you're looking for is MX and MY (Move along X) and (Move along Y), but I had other command like COPY, STRETCH and LINE: (defun c:lx nil (CommandDirection (list "_LINE" pause) ".Y")) (defun c:ly nil (CommandDirection (list "_LINE" pause) ".X")) (defun c:cx (/ ss) (if (setq ss (ssget "_:L")) (CommandDirection (list "_COPY" ss "" pause) ".Y"))) (defun c:cy (/ ss) (if (setq ss (ssget "_:L")) (CommandDirection (list "_COPY" ss "" pause) ".X"))) (defun c:mx (/ ss) (if (setq ss (ssget "_:L")) (CommandDirection (list "_MOVE" ss "" pause) ".Y"))) (defun c:my (/ ss) (if (setq ss (ssget "_:L")) (CommandDirection (list "_MOVE" ss "" pause) ".X"))) (defun c:sx (/ ss) (if (setq ss (ssget "_:L")) (CommandDirection (list "_STRETCH" ss "" pause) ".Y"))) (defun c:sy (/ ss) (if (setq ss (ssget "_:L")) (CommandDirection (list "_STRETCH" ss "" pause) ".X"))) ;; Command Direction - Jonathan Handojo ;; Creates a command that constraints point prompts to X, Y or Z axis. ;; cmd - a list of strings to pass into the AutoCAD command function. ;; => The last string in the list must be a point selection. ;; dir - a string of either ".X", ".Y" or ".Z" (defun CommandDirection (cmd dir) (apply 'command cmd) (while (not (zerop (getvar "cmdactive"))) (command dir "@0,0,0" pause) ) )1 point
-
dimitarr please put a comment in about using my Multi radio buttons code, its a recognition of where you got code from. See Mhupp code. ; Multi radio Buttons by Alanh Consulting. There is more Multi Toggles, Multi getvals, Muti Radios 2col. You can avoid putting multi in your code altogether, just make sure its saved in a support path directory. (if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already1 point
-
Anything after a '( is a fixed list, CAD will take it as it is, anything after (list and CAD will try to calculate this list For example '( 1 2 3 4 5) is a list, 1 2 3 4 5 '(1 (+ 8 9) 3 4 5) is also a list 1 (+ 8 9) 3 4 5, and will probably be an error since it thinks the + is text, and wants it as "+" (list 1 2 3 4 5) is also a list 1 2 3 4 5 (list 1 (+ 8 9) 3 4 5 is a list 1 17 3 4 5, noting that the 8+9 has been calculated now That's the basic difference Remember to define any lists within your list as a list too In your case '( "" (strcat (getenv "userprofile") "\\OneDrive\\....\\01_Profiles\\") (strcat (getenv "userprofile") "\\OneDrive\\....\\02_Gaskets\\") ) this list is seen as all text items, errors for example (strcat CAD wants that to be a text string "(strcat....) Make it up as (list "" (strcat (getenv "userprofile") "\\OneDrive\\....\\01_Profiles\\") (strcat (getenv "userprofile") "\\OneDrive\\....\\02_Gaskets\\") ) and it should work it all out. Lee Macs description is better than mine1 point
-
¾" isn't the same as 3/4" that is whats causing the 0 finds. ¾ is one font char 3/4 is three font char's search for this use \P for next line 3"x¾" RECTANGULAR\PSTEEL TUBE --edit to type ¾ hold alt and type 0190 on numbpad1 point
-
Put inside the while statement before or after the mapcar. (vla-put-dimensionlineweight obj 0.1)1 point
-
1 point