Jump to content

Recommended Posts

Posted

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? :huh:

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    12

  • SteveK

    11

  • chulse

    7

  • Fatrus

    3

Top Posters In This Topic

Posted
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? :huh:

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.

Posted
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. .

Posted

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)

Posted
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...?

Posted
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.

Posted

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)>%

Posted
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.

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.

Posted
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.

Posted

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

Posted

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!!!

Posted
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).

Posted

..sorry i dont get it.. Im not very good in lisp diesel thing...

im talking about your big code....

 

and tks for your reply ;)

Posted
..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

Posted

cool tanks... and if I send the drawing to someone else, did he need the lisp?

Posted
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.

  • 3 years later...
Posted
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.

Posted

Try entering this at the Command Line, and try Alan's code again:

 

(vl-load-com)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...