Author Topic: Set attributes when inserting block?  (Read 5128 times)

0 Members and 1 Guest are viewing this topic.

Darryl

  • Guest
Set attributes when inserting block?
« on: November 19, 2004, 04:05:04 PM »
We use a special pull-down menu to insert our various size title blocks at different scales.  The menu calls a LISP routine which scales the title block accordingly (2X for half scale, etc.) and also sets the proper dimscale, ltscale, zooms extents, etc.  (BTW, we insert our title blocks in model space.)  Of course, the dialog box appears first - to fill out the attributes such as drawing number, designed by, drawn by, date, scale, etc.

Is it possible to have the LISP routine set up some of the attributes prior to the dialog box prompting you to fill them in?  If so, any ideas on how to do it would be appreciated.  Since we have 2 different engineering groups that use different tolerances in the title block, it would be very nice for the proper tolerances to be already set up when you insert a title block.

Thank a bunch!  Y'all have a good weekend - see ya Monday.

SPDCad

  • Bull Frog
  • Posts: 453
Set attributes when inserting block?
« Reply #1 on: November 19, 2004, 06:27:03 PM »
Yes it is possible to pass variable to attributes when inserting a block.
What I use to do, was pass the variable to the attributes I wanted the computer to fill in and then have the lisp pause for user input.
The blocks where set up in a way that all the automatically set attributes where prompted for first and then the user filled ones latter on.

Code: [Select]
;|for the following example code
Given:
XSCALE = Xscale factor
YSCALE = YScale factor
the title block is a drawing file named "TITLEBLOCK"  and it has 5 attributes
|;


;.....setup code
(set A (getvar "DWGNAME")
     B (getvar "DDATE")
     C (getstring "Drawn by: ")
     D (getstring "Project number: ")
     E (getstring "Drawing number: ")
);
(command "_.Insert" "TITLEBLOCK" "0,0" XSCALE YSCALE "" "0" A B C D E)
;....continue code



I know its quick and dirty code , but it should give you a staring point.
When I get home I will see if I have my old title block insertion routine lying around and I will post it. My old title block lisp sounds similar to what you are looking for.

Hope it helps  :lol:
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs

ronjonp

  • Needs a day job
  • Posts: 7527
Set attributes when inserting block?
« Reply #2 on: November 19, 2004, 06:40:41 PM »
You will also have to set ATTDIA to 0 so the dialogue box doesn't pop up or the code will break.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CADaver

  • Guest
Set attributes when inserting block?
« Reply #3 on: November 22, 2004, 10:02:55 AM »
Another option is PRESET the attribs when defining them.

Darryl

  • Guest
Set attributes when inserting block?
« Reply #4 on: November 22, 2004, 11:40:31 AM »
Thanks for the input everyone.

CADaver - Yes, we do preset a few of the attributes (which are common to everyone) when they are defined.  But for the attributes that are different for various users, I would like to set them at the time the block is inserted.  Your suggestion would be fine if we used different title blocks for everyone, but we would like to use a standard title block for all.

ronjonp - Thanks for the reminder.

SPDCad - I'll probably do it as you suggest - then after the title block is inserted, I can bring up the dialog box for the user to fill in the remaining attributes.  (I was hoping that I could use the dialog box and preset some attributes just before inserting the block.)