Re: lisp page numbering

Jul 16, 2003 8 Replies


I would like to add a line to a title block routine that would insert


> the drawing name as the page name in the title block (minus the ".dwg"
> extension) any suggestions?
> TIA

RTEXT? No routine needed.



This is a snippett of code I use in a routine to determine the drawing name and insert it into the drawing. Basically, if the drawing was created using a earlier version of Acad, the drawing name is formatted differently that with R14, which is what I use. Most of this is concerned with parsing the variable "dwgname" which comes in various flavors depending on the version of Acad the drawing was created in. When all is said and done, the variable "dwg2" in this snippett holds the drawing name without the path or the extension. This works for all versions up to R14.01

(if (< (getvar "acadver") "14") (setq dwg (getvar "dwgname")) (setq dwg (strcat (getvar "dwgprefix") (getvar "dwgname")))) (setq dwgl (strlen dwg)) (if (< (getvar "acadver") "14") (setq dwg dwg) (setq dwg (substr dwg 1 (- dwgl 4)))) (setq dwgl (strlen dwg)) (setq pos "t" ct -1) (while pos (setq ct (+ ct 1)) (setq name (strcase (substr dwg (- dwgl ct) 1))) (if (or (= name "\\") (= name "")) (setq pos nil)) (setq dwg2 (substr dwg (- dwgl (- ct 1))))) (setq dwg2 (strcase dwg2))

R. Wink

I've done it with Rtext before, the problem with Rtext is that it only works with 2000+ full and not LT. Had a problem with a customer not being able to see the page numbers. But thanks for the suggestion.

Ahhhhhhhhhhhhh, ok.

If R.Wink's post doesn't help, email me, I'm sure that could be done simply enough.

Thanks much! was just what I was looking for!

Here's another question along the same lines Lets say I wanted to make a routine that would change the date and or the total number of pages on all title blocks (even if just opening them one at a time) so they all have the same date and quantity of pages. Any ideas? TIA!

and insert it into the

Acad, the drawing name is

concerned with parsing

of Acad the drawing

snippett holds the drawing

Since you insist I ask, may I please have a copy of your VB routine to change instances of the title blocks across multiple drawings? And could you please explain how VB differs from a script? I'm just getting started in scripts and have no experience in VB.

R. W>Brand Z wrote:

instances of the title

from a script? I'm

It's not that I insist you ask. I don't like posting info nobody wants to the NG, as it wastes bandwidth. I don't generally email people without them asking. Some people are terribly irritated by unsolicited emails. Think before you start being a wise-ass.

A script is simply a series of commands. They can generally be written by copy/pasting out of Acad's textscreen, and removing the "Command:"s and other such text.

Lisp and VBA are programming languages, which offer much more flexibility and power. They provide a means of interracting with the user. As to the difference between lisp and VBA.........they're entirely different, though they have similar abilities.

IMO, VBA has the following two advantages:

  1. Dialog boxes are much easier to make and control.
  2. VBA is a subset of VB, and can be used in other apps, as well as ASP (Active Server Pages on the internet/intranet).

IMO, AutoLisp's biggest advantage is that it is easier to learn, particularly for someone with solid Acad skills. The lisp language was originally created as a list processing language, so it does handle lists of information MUCH easier than VBA does.

If you're just starting, dabble in both. My guess is that AutoLisp will give you more impressive results much quicker.

I'll be emailing you the VBA macro.

instances of the title

from a script? I'm

on occation..or so my

I'm a little cranky, this week. ;)

(various flavors),

languages and don't

the screen and forcing

So you know where I'm coming from, I was taught BASIC basics in 8th grade (early 80's), and have learned lisp, VBA, etc. from books and the web. I'm more of a hack than a programmer. I write quick & dirty functional tools for myself, generally speaking.

a VB routine, in or

Not sure what type of thing you're referring to. Re-post specifics and I'm sure you could get a good answer here. Adesk's customization group(s) also have some excellent regulars for programming.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required