SteveK Posted October 1, 2009 Posted October 1, 2009 That said, I'm beginning to wonder whether to cut out the middle man (fields). Using Alan's code, if you know the block and tag, why bother with fields! Faster? Quote
alanjt Posted October 1, 2009 Posted October 1, 2009 That said, I'm beginning to wonder whether to cut out the middle man (fields). Using Alan's code, if you know the block and tag, why bother with fields! Faster? I'd still default the total pages attribute with a diesel expression field $(getvar,userr1), that way you can use it on any style titleblock. Quote
SteveK Posted October 1, 2009 Posted October 1, 2009 I'd still default the total pages attribute with a diesel expression field $(getvar,userr1), that way you can use it on any style titleblock. True. . Quote
alanjt Posted October 2, 2009 Posted October 2, 2009 I forgot, it needs to be a string, not a real number, try this: (vl-load-com) (if (not *CommandReactors-PlotSheetCount*) (setq *CommandReactors-PlotSheetCount* (vlr-command-reactor nil '((:vlr-commandWillStart . StrtCMD-PlotSheetCount) ) ) ;_ vlr-command-reactor ) ;_ setq ) ;_ if (defun StrtCMD-PlotSheetCount (calling-reactor StrtCMD-PlotSheetCountInfo / theCMDStrt) (setq theCMDStrt (strcase (car StrtCMD-PlotSheetCountInfo))) (cond ((wcmatch theCMDStrt "*PLOT*,*PUBLISH*") (setvar "users1" (vl-princ-to-string (length (layoutlist)))) ) ) ;_ cond ) ;_ defun and call it by Diesel with $(getvar,users1) Quote
SteveK Posted October 2, 2009 Posted October 2, 2009 I forgot, it needs to be a string, not a real number, try this: (vl-load-com) (if (not *CommandReactors-PlotSheetCount*) (setq *CommandReactors-PlotSheetCount* (vlr-command-reactor nil '((:vlr-commandWillStart . StrtCMD-PlotSheetCount) ) ) ;_ vlr-command-reactor ) ;_ setq ) ;_ if (defun StrtCMD-PlotSheetCount (calling-reactor StrtCMD-PlotSheetCountInfo / theCMDStrt) (setq theCMDStrt (strcase (car StrtCMD-PlotSheetCountInfo))) (cond ((wcmatch theCMDStrt "*PLOT*,*PUBLISH*") (setvar "[color=Blue]users1[/color]" (vl-princ-to-string (length (layoutlist)))) ) ) ;_ cond ) ;_ defun and call it by Diesel with $(getvar,users1) Three things; - I think it's userr1 not users1 - why does it need to be a string? Real & integers seem to be recognized in fields. - and lastly, I've been using a LispVariable but now that I look for userrX system variables I can't find them in the list within the field table...? Quote
alanjt Posted October 2, 2009 Posted October 2, 2009 Three things;- I think it's userr1 not users1 - why does it need to be a string? Real & integers seem to be recognized in fields. - and lastly, I've been using a LispVariable but now that I look for userrX system variables I can't find them in the list within the field table...? userr# is for real numbers useri# is for integers users# is for strings Attributes need strings. Since it's not technically a system variable, it's probably ignored. Calling it with Diesel should work. This is all proof of concept, I've not had a chance to test it. Quote
alanjt Posted October 2, 2009 Posted October 2, 2009 SUCCESS! I just tried it and it works perfectly. Here's an update with the addition of the Preview command. (if (not *CommandReactors-PlotSheetCount*) (setq *CommandReactors-PlotSheetCount* (vlr-command-reactor nil '((:vlr-commandWillStart . StrtCMD-PlotSheetCount) ) ) ;_ vlr-command-reactor ) ;_ setq ) ;_ if (defun StrtCMD-PlotSheetCount (calling-reactor StrtCMD-PlotSheetCountInfo / theCMDStrt) (setq theCMDStrt (strcase (car StrtCMD-PlotSheetCountInfo))) (cond ((wcmatch theCMDStrt "*PLOT*,*PUBLISH*,*PREVIEW*") (setvar "users1" (vl-princ-to-string (length (layoutlist)))) ) ) ;_ cond ) ;_ defun Here the example I used, just a piece of MText: Total Layouts: %<\AcDiesel $(getvar,users1)>% Quote
SteveK Posted October 2, 2009 Posted October 2, 2009 userr# is for real numbersuseri# is for integers users# is for strings Attributes need strings. Since it's not technically a system variable, it's probably ignored. Calling it with Diesel should work. Sorry I should have looked at those sysvariables a bit closer. SUCCESS! I just tried it and it works perfectly. Here's an update with the addition of the Preview command. Indeed, it works well! Thanks Alan. And preview is a good addition. Quote
alanjt Posted October 2, 2009 Posted October 2, 2009 Sorry I should have looked at those sysvariables a bit closer. Indeed, it works well! Thanks Alan. And preview is a good addition. No problem. I really like this, I'll be incorporating this into my sheets from now on. Quote
alanjt Posted October 2, 2009 Posted October 2, 2009 Here it is using a Lisp variable, instead utilizing the user*# variables. I think this is a better option: Example: Total Layouts: %<\AcVar.17.0 Lisp.plotsheetcount:value>% The reason I have it setq it, on startup, as "", is to enable the user to select the variable in the Field Lisp Variable list. Code updated and move here: http://www.cadtutor.net/forum/showthread.php?t=40653 Quote
Fatrus Posted October 9, 2009 Posted October 9, 2009 hoook! Hi to all! Right now Im trying to do that... and I just dont know where to put this code.....? can someone could show me where to past this... or just send me to a post in the forum... Tks a lot!!! Quote
alanjt Posted October 9, 2009 Posted October 9, 2009 hoook! Hi to all! Right now Im trying to do that... and I just dont know where to put this code.....? can someone could show me where to past this... or just send me to a post in the forum... Tks a lot!!! Save the file then appload or put posted load code in acaddoc.lsp file (I posted info. for this option in the other thread). Quote
Fatrus Posted October 9, 2009 Posted October 9, 2009 ..sorry i dont get it.. Im not very good in lisp diesel thing... im talking about your big code.... and tks for your reply Quote
alanjt Posted October 9, 2009 Posted October 9, 2009 ..sorry i dont get it.. Im not very good in lisp diesel thing... im talking about your big code.... and tks for your reply No problem. Probably the best thing is to put the lisp in a directory and type appload then load it into the Startup Suite (briefcase at bottom). Look here, if you still need help, give a shout: http://www.cadtutor.net/faq/questions/28/How+do+I+use+an+AutoLISP+routine%3F http://www.cadtutor.net/faq/questions/53/How+do+I+automatically+load+variables%3F Quote
Fatrus Posted October 9, 2009 Posted October 9, 2009 cool tanks... and if I send the drawing to someone else, did he need the lisp? Quote
alanjt Posted October 9, 2009 Posted October 9, 2009 cool tanks... and if I send the drawing to someone else, did he need the lisp? I'm not telling you to send anything, but it won't work without it. Quote
internecio Posted May 9, 2013 Posted May 9, 2013 SUCCESS! I just tried it and it works perfectly. Here's an update with the addition of the Preview command. (if (not *CommandReactors-PlotSheetCount*) (setq *CommandReactors-PlotSheetCount* (vlr-command-reactor nil '((:vlr-commandWillStart . StrtCMD-PlotSheetCount) ) ) ;_ vlr-command-reactor ) ;_ setq ) ;_ if (defun StrtCMD-PlotSheetCount (calling-reactor StrtCMD-PlotSheetCountInfo / theCMDStrt) (setq theCMDStrt (strcase (car StrtCMD-PlotSheetCountInfo))) (cond ((wcmatch theCMDStrt "*PLOT*,*PUBLISH*,*PREVIEW*") (setvar "users1" (vl-princ-to-string (length (layoutlist)))) ) ) ;_ cond ) ;_ defun Here the example I used, just a piece of MText: Total Layouts: %<\AcDiesel $(getvar,users1)>% Hi Alan, I tried to use this code by copying and pasting to a text file storing the one lsp extension, when I enter the command autocad APPLOAD use to read the new lisp, lisp when reading this message appears: APPLOAD tabs.lsp number successfully loaded. Command:, error: invalid reaction name: VLR-COMMANDWILLSTART I ask you please tell me what to do, could you help me, please. As not load the lisp then there if you really active command is this "plotsheetcount" I think this is the command but I have not so clear. Excuse my bad grammar I speak Spanish and my English is very poor. Greetings. Quote
BlackBox Posted May 9, 2013 Posted May 9, 2013 Try entering this at the Command Line, and try Alan's code again: (vl-load-com) 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.