jt6572 Posted December 8, 2016 Share Posted December 8, 2016 Hey all, i have been trying to get this to work for a day or so now, and im at the point where i have no hair left! ive found macro code (okay, "borrowed"...) and opening the current directory is easy. what i would like to do is have buttons for different projects opening its specified project's drawings folder. open in current directory: (startapp "explorer" (strcat "/e, "(getvar "dwgprefix"))) open in subfolder "projects" of the R drive: (startapp "explorer" (strcat "/e, R:\\projects")) using ^C^C_(startapp "explorer" (strcat "/e, F:\Jobs\B16000\B16007\Drawings") this is what i get. (using double backslashes just makes me press enter every time i get to that backslash). Command: _(startapp LISP command is not available. Command: "explorer" Unknown command ""EXPLORER"". Press F1 for help. Command: (strcat "/e, F: ("_> Jobs ("_> B16000 ("_> B16007 ("_> Drawings") "/e, F:\nJobs\nB16000\nB16007\nDrawings" and nothing happens. i dont know Lisp, so for a start i dont know where to get "startapp.lsp" from. or if it even exists? would really appreciate help with my Noobness.... thank you. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 8, 2016 Share Posted December 8, 2016 You can have a directory as an icon on your windows taskbar, just google for info. Then just double click the drawing you want. http://www.digitalcitizen.life/how-pin-any-folder-windows-7-taskbar Mine are set up as project drive, lisps so I can drag and drop lisps outside of normal library, project time logging and last is what you want 1 project directory. Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 8, 2016 Author Share Posted December 8, 2016 thanks Big Al, but i would like to be able to have this through the autocad interface. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 8, 2016 Share Posted December 8, 2016 This worked for me (startapp "explorer" "P:\\2016 projects\\2016033") Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 8, 2016 Author Share Posted December 8, 2016 (edited) thanks BigAl, i will keep playing with it, but replicating your code to my filepath isnt working. i am getting " _(startapp LISP command is not available. Command: "explorer" Unknown command ""EXPLORER"". Press F1 for help. do you know how i can make startapp lisp available?! is this a .lsp i just dont have? thanks again. Edited December 8, 2016 by jt6572 Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 8, 2016 Author Share Posted December 8, 2016 got it! http://forums.augi.com/archive/index.php/t-162038.html not sure about forum ethics or whatever, but basically, what i had to do was create a simple lisp and then have the macro call that lisp. my example is: Lisp: (defun B16007 () (STARTAPP (strcat "EXPLORER /e," "F:\\Jobs\\B16000\\B16007\\Drawings")) ) macro assigned to button: ^C^C(B16007) I looked for this a lot, so hopefully this will help anyone else with the same issue. thanks for all your help again BigAl - i know youve helped me a lot on here in the past as well. Quote Link to comment Share on other sites More sharing options...
mostafa badran Posted December 8, 2016 Share Posted December 8, 2016 got it! http://forums.augi.com/archive/index.php/t-162038.html not sure about forum ethics or whatever, but basically, what i had to do was create a simple lisp and then have the macro call that lisp. my example is: Lisp: (defun B16007 () (STARTAPP (strcat "EXPLORER /e," "F:\\Jobs\\B16000\\B16007\\Drawings")) ) macro assigned to button: ^C^C(B16007) I looked for this a lot, so hopefully this will help anyone else with the same issue. thanks for all your help again BigAl - i know youve helped me a lot on here in the past as well. You can modify your code as below. (defun c:B16007 () (STARTAPP (strcat "EXPLORER /e," "D:\\Jobs\\B16000\\B16007\\Drawings")) (princ) ) and your macro to: ^C^C B16007; Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 8, 2016 Author Share Posted December 8, 2016 excellent - thank you. tbh, i was hoping to be able to type in the project number as well. Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted December 8, 2016 Share Posted December 8, 2016 (vl-cmdf [color="red"]"shell"[/color] "explorer \"F:\\Jobs\\B16000\\B16007\\Drawings\"") Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 8, 2016 Author Share Posted December 8, 2016 thank you. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 8, 2016 Share Posted December 8, 2016 (edited) jt6572 there is a way to type any combo of B1234 B456 b789123 etc this causes an error as "command is unknown" but if you always have a consistent "B" as 1st character and the directory structure is always the same you can make it work with 1 Library function rather than multiple defuns for each project. Here is the code for Fillet Offset & Circle typed directly basicly cutting out one or two steps F123 means a fillet with radius 123. It uses a command has errored but looks at what was typed and pulls it apart then executes the correct command. Code revised see post further down that meets the request. Edited December 10, 2016 by BIGAL Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 8, 2016 Author Share Posted December 8, 2016 wow, this is getting good! if i am able to get this cracking it would be awesome, as B is simply the prefix for all our Brisbane projects. Cryptic. im not a lisp expert by any stretch, so if i step through, could you please help me? could take a bit of patience...and i am happy with my progress already. from the code, it looks like i might be able to use just one of the wcmatch...paragraphs (told you im no coder!!) and replace the C with a B? i dont know how to mix this with what i have already though. but i have a little time to work on this at the moment, so will wreak some lisp havoc! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 9, 2016 Share Posted December 9, 2016 Your correct add the "B" and make a new defun name say "openex" and use what you have for the startapp. If you look at the variable com this will return project number, its an interesting idea may have a go myself as our projects are based on the year+project number 2016123 This code is autoloaded from our company lisp library, try the fillet circle etc remember a decimal is a "-" f12-5 Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 9, 2016 Author Share Posted December 9, 2016 finished with the text, now on to this!! Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 9, 2016 Author Share Posted December 9, 2016 Nope. no idea what i am doing. btw, for some reason, the first time i click on a button for a directory it repeats the last command. is there a space or "" or \ somewhere it shouldnt be in my existing lisp? (defun jobs () (STARTAPP (strcat "EXPLORER /e," "F:\\Jobs")) ) ; Enter the filet radius as part of a command line entry f100 offset O234 circle c123-45 ; note - is used for decimal point ; original code and methology by Alan H ; assistance and code that worked by Lee-Mac ; OCT 2015 ( (lambda nil (vl-load-com) (foreach obj (cdar (vlr-reactors :vlr-command-reactor)) (if (= "openx" (vlr-data obj)) (vlr-remove obj) ) ) (vlr-command-reactor "openx" '((:vlr-unknowncommand . openx-callback))) ) ) (defun openx ( obj com ) (setq com (vl-string-translate "-" "." (strcase (car com)))) (cond ( (and (wcmatch com "~*[~B.0-9]*") (wcmatch com "B*") (wcmatch com "~B*B*") (wcmatch com "~*.*.*") ) ; and (openx) ) ) ; master cond ) ; defun (STARTAPP (strcat "EXPLORER /e," "F:\\Jobs\\B16000\\B16007\\Drawings")) ) (princ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 9, 2016 Share Posted December 9, 2016 (edited) You need to go back a bit your mixing up the defuns and have put openx into like a repeating defun. I am using defun openx and "D" the code will auto reuse the Dproject number "123345" etc so no individual hard coded filename is required. You must have a rigid directory structure for it to work. ( (lambda nil (vl-load-com) (foreach obj (cdar (vlr-reactors :vlr-command-reactor)) (if (= "fillet-reactor" (vlr-data obj)) (vlr-remove obj) ) ) (vlr-command-reactor "fillet-reactor" '((:vlr-unknowncommand . fillet-reactor-callback))) ) ) ; open a project that is 3 directory deep just by project number ; my example c:\2016 projects\2016123\design (defun openx ( / Proj) (setq projno (strcat "EXPLORER C:\\" (substr com 2 4) " Projects\\" (substr com 2) "\\Design\\")) (vla-sendcommand fillet-reactor-acdoc (STARTAPP projno)) ) ; calls the fillet command with the radius f123 (defun filletrad ( / rad) (setq rad (distof (substr com 2) 2)) (if (<= 0.0 rad) (progn (setvar 'filletrad rad) (vla-sendcommand fillet-reactor-acdoc "_.fillet ") ) ) ) ;calls the circle command with radius c123 (defun makecirc ( / rad radd) (setq rad (distof (substr com 2) 2)) (if (<= 0.0 rad) (progn (setvar 'circlerad rad) (setq pt (getpoint "Pick centre pt")) (vla-sendcommand fillet-reactor-acdoc "_.Circle !pt ") ) ) ) ;calls offset with a distance + or - for left and right O123 (defun offdist ( / dist) (setq dist (distof (substr com 2) 2)) (if (<= 0.0 dist) (progn (setvar 'offsetdist dist) (vla-sendcommand fillet-reactor-acdoc "_.Offset ") ) ) ) ; calls a lisp program (defun pipeoff ( / dist) (setq dist (distof (substr com 2) 2)) (if (<= 0.0 dist) (progn (setq poff (strcat "P" (rtos dist 2 0))) (if (not poff)(load "Pipe offsets")) (vla-sendcommand fillet-reactor-acdoc poff) ) ) ) ; start of call back F O P D as 1st character (defun fillet-reactor-callback ( obj com ) (setq com (vl-string-translate "-" "." (strcase (car com)))) (cond ; open explorer ( (and (wcmatch com "~*[~D.0-9]*") (wcmatch com "D*") (wcmatch com "~D*D*") (wcmatch com "~*.*.*") ) ; and (openx) ) ; fillet ( (and (wcmatch com "~*[~F.0-9]*") (wcmatch com "F*") (wcmatch com "~F*F*") (wcmatch com "~*.*.*") ) ; and (filletrad) ) ; circle ( (and (wcmatch com "~*[~C.0-9]*") (wcmatch com "C*") (wcmatch com "~C*C*") (wcmatch com "~*.*.*") ) ;and (makecirc) ) ; offset ( (and (wcmatch com "~*[~O.0-9]*") (wcmatch com "O*") (wcmatch com "~O*O*") (wcmatch com "~*.*.*") ) ; and (offdist) ) ; pipe ( (and (wcmatch com "~*[~P.0-9]*") (wcmatch com "P*") (wcmatch com "~P*P*") (wcmatch com "~*.*.*") ) ; and (pipeoff) ) ) ; master cond ) ; defun Edited December 10, 2016 by BIGAL Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 10, 2016 Share Posted December 10, 2016 All done now and works if you dont want the other routines you must remove the 2 groups of code be a bit careful. Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 21, 2016 Author Share Posted December 21, 2016 wow, im a bit too lost trying to work with this. i have just been trying to open a folder that is within the current drawing's folder with very poor results! within the same folder as all the drawings is a folder for all the pdfs, as well as the xrefs, etc. is there a way to do a sort of "relative" open to open folder "pdf"? i actually tried to modify this! ^C^C(startapp "explorer" (findfile "Drawing Register.xlsm")) to ^C^C(startapp "explorer" (findfolder "PDF")) in an amazing show of ignorance... oh well... had a go!! at least i am not a man who never made anything hey?! Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted December 21, 2016 Share Posted December 21, 2016 (findfile "pdf") (strcat (getvar 'dwgprefix) "PDF") Quote Link to comment Share on other sites More sharing options...
jt6572 Posted December 21, 2016 Author Share Posted December 21, 2016 (findfile "pdf") (strcat (getvar 'dwgprefix) "PDF") ha ha... thanks very much Roy! (any closer it would've bitten me?!) Quote Link to comment Share on other sites More sharing options...
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.