Nikon Posted February 2 Author Posted February 2 18 hours ago, pkenewell said: (startapp "explorer" "/e,\"C:\\Users\\Username\\Drawings24\\Office3.dwg\"") 15 hours ago, pkenewell said: ;;Test (opendwg "C:\\Users\\Username\\Drawings24\\Office3.dwg") Unfortunately, these 2 codes don't work... 8 hours ago, BIGAL said: ^c^COpen "C:\\Users\\Username\\Drawings24\\Office3.dwg" AutoCAD freezes on this macro... Quote
pkenewell Posted February 2 Posted February 2 (edited) 5 hours ago, Nikon said: Unfortunately, these 2 codes don't work... Did you load the function (opendwg) before running the test? By that I mean did you copy the function below to the command line, or copy it into a .lsp file and load it with APPLOAD? I tested the function and it worked without issue. Try it again. EDIT: In my original post - I neglected to comment out the argument description with a semi-colon, which probably caused it to fail to load. Please try it again now that it is properly commented. My apologies! ;; OPENDWG ;; Argument: dwg = string; the full path and file name of the drawing, ;; or just the file name if in the search path. (defun opendwg (dwg) (vl-load-com) (vla-open (vla-get-activedocument (vlax-get-acad-object)) dwg) ) Edited February 2 by pkenewell Quote
Nikon Posted February 2 Author Posted February 2 (edited) 2 hours ago, pkenewell said: ;; OPENDWG ;; Argument: dwg = string; the full path and file name of the drawing, ;; or just the file name if in the search path. Thanks, but the code gives an error error: too few arguments. this code works, it's enough for me: (defun c:opendwg( / ) ;; open dwg (startapp "explorer" "/e,\"C:\\Users\\Username\\Drawings24\\Office3.dwg\"") (princ) ) or I can use a macro: ^C^C(startapp "explorer.exe" (findfile "c:/Users/username/Desktop/Drawings24/Office3.dwg")) Edited February 2 by Nikon Quote
pkenewell Posted February 2 Posted February 2 (edited) 1 hour ago, Nikon said: Thanks, but the code gives an error error: too few arguments. this code works, it's enough for me: That's fine, but I am just trying to educate you. The (opendwg) is a function, not a command. You have to use it inside a command (defun C:...), or directly in a macro like this: ;; OPENDWG ;; Argument: dwg = string; the full path and file name of the drawing, ;; or just the file name if in the search path. (defun opendwg (dwg) (vl-load-com) (vla-open (vla-get-activedocument (vlax-get-acad-object)) dwg) ) (defun c:Openit () (opendwg "C:\\Users\\Username\\Drawings24\\Office3.dwg") ) AND this in a macro: ^C^COpenit OR this directly: ^C^C(opendwg "C:\\Users\\Username\\Drawings24\\Office3.dwg") Edited February 2 by pkenewell 1 Quote
BIGAL Posted February 2 Posted February 2 (edited) An image pop menu example using same method as Pkenewell has suggested. Used for years. **PIPES [PIPES] [COGGSLD(SD201,SUBSOIL)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG201") [COGGSLD(SD202,FLUSHOUT)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG202") [COGGSLD(SD203,CATCH)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG203") [COGGSLD(SD204,HOUSE)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG204") [COGGSLD(SD205,STREET)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG205") [COGGSLD(SD206,EASEMENT)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG206") [COGGSLD(SD207,ANCHOR)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG207") Edited February 2 by BIGAL 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.