Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Add values to attributes

  1. #1
    Active Member todd.mackay's Avatar
    Join Date
    2003-03
    Posts
    74
    Login to Give a bone
    0

    Default Add values to attributes

    I am looking for help on a lisp routine to add values (signatures) to attributes in the companies Title Blocks.

    I have one of three different types of drawings, C size, D size, and F size. The only difference is the block name per drawing. C size (Block name) = “CSHEET1,” D size = “DSHEET1,” and F size = “FSHEET1.” The attributes that need values added to them are all the same within these blocks.

    Let’s say I have a D size drawing opened, I would like to run the routine and have it do:

    Select DSHEET1
    Get attribute “ENGINEER” - add value “ABC (s)”
    Get attribute “ENGDATE” – add value “05-28-08”

    I have 9 more attributes (11 total) that get the same treatment. I could list them all if you’d like.

    Then save drawing and close.

    I could provide a dwg with one of the blocks, if that might help anyone, but I figured it’s pretty straight forward.

    Also, I would like to change these attribute values every time I have different initials and dates.

    Thank you in advance!!!

    Todd

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,089
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Have you thought about using FIELDS linked to the drawing's properties (DWGPROPS) for this problem?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Active Member todd.mackay's Avatar
    Join Date
    2003-03
    Posts
    74
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Quote Originally Posted by Opie View Post
    Have you thought about using FIELDS linked to the drawing's properties (DWGPROPS) for this problem?
    Sorry, but I don't know how to do that.

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,089
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Have you used FIELDS before?

    Try the DWGPROPS command to add custom properties to the drawing. Within the appropriate attribute, add a FIELD that is linked to one of these custom drawing properties.

    Then, instead of editing the block's attributes, you edit the drawing's properties and then regen the drawing (depending on the FIELDEVAL system variable) to update the fields.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Active Member todd.mackay's Avatar
    Join Date
    2003-03
    Posts
    74
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Quote Originally Posted by Opie View Post
    Have you used FIELDS before?

    Try the DWGPROPS command to add custom properties to the drawing. Within the appropriate attribute, add a FIELD that is linked to one of these custom drawing properties.

    Then, instead of editing the block's attributes, you edit the drawing's properties and then regen the drawing (depending on the FIELDEVAL system variable) to update the fields.
    I was looking for help to set up a lisp so I can run the same lisp for hundreds of drawings over the next couple of days for a big drawing delivery. The next time a new delivery comes around (6 months, next year, whenever) I can go back into that same lisp and change the values for the new dates and initials.

    It kinda sounds like I would have to set this DWGPROPS up for everyone of the existing drawings that I have. And my customer wants to keep the integrity of the existing blocks the way they gave them to us. These blocks were given to us from the customer.

    I'm not trying say that this DWGPROPS thing does not have a hidden beauty, but I just don't know enough about it to see how it will help me right now.

    Thanks

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,089
    Login to Give a bone
    0

    Default Re: Add values to attributes

    With the extra information provided, your reasoning for an automatic routine makes sense.

    Where will the values come from? Will the values be added to existing text within an attribute? There are probably other questions as well, but those are a start.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  7. #7
    Active Member todd.mackay's Avatar
    Join Date
    2003-03
    Posts
    74
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Quote Originally Posted by Opie View Post
    With the extra information provided, your reasoning for an automatic routine makes sense.

    Where will the values come from? Will the values be added to existing text within an attribute? There are probably other questions as well, but those are a start.
    All the values of concern, for all the drawings, are blank at the moment. To explain (and to use the example in my original thread), the block named "DSHEET1 (for D size)" has the typical title block attributes. Drawing Number, Drawing Title, Scale, etc. Those have values to them per drawing. The signature attributes and dates are blank. The customer had given us the go ahead to sign and date all the drawing with specific initials and dates that have been given to us.

    So, the “ENGINEER” attribute tag needs a new value of “MJH (s)” ... the (s) is the electronic signature symbol that they want.
    The “ENGDATE” attribute tag needs a new value of “05-28-08”
    This needs to repeat a total of 11 times to different attribute tages. Then save, close and on to the next drawing.

    I realize that something like VB could run as a batch for a whole directory. But I'm taking small steps and need a quick lisp code for now and deal with that after our delivery.

    I'm trying to explain things clearly, forgive me if I'm leaving important stuff out.

    Thanks - Todd

  8. #8
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,089
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Maybe this thread, "Using lisp to Edit Attributes in a Title Block," can help you.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  9. #9
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,504
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Quote Originally Posted by todd.mackay View Post
    All the values of concern, for all the drawings, are blank at the moment. To explain (and to use the example in my original thread), the block named "DSHEET1 (for D size)" has the typical title block attributes. Drawing Number, Drawing Title, Scale, etc. Those have values to them per drawing. The signature attributes and dates are blank. The customer had given us the go ahead to sign and date all the drawing with specific initials and dates that have been given to us.

    So, the “ENGINEER” attribute tag needs a new value of “MJH (s)” ... the (s) is the electronic signature symbol that they want.
    The “ENGDATE” attribute tag needs a new value of “05-28-08”
    This needs to repeat a total of 11 times to different attribute tages. Then save, close and on to the next drawing.

    I realize that something like VB could run as a batch for a whole directory. But I'm taking small steps and need a quick lisp code for now and deal with that after our delivery.

    I'm trying to explain things clearly, forgive me if I'm leaving important stuff out.

    Thanks - Todd
    Well I've dubbed around with a routine that kind of works, the problem is I can't seem to make it "replace" the values, just fill them in. So if you have something in there already it adds to it.

    ** But if the existing value is constant and you know what it is, this will work fine.
    that info just needs to be added in the routine in the "value to be replaced" spot.

    Maybe someone else can help us figure out why it won't replace the current values.

    This is just an example using some of your info:
    Code:
    (defun c:fillatt ()
    (command "-attedit" "n" "n" "DSHEET1 "ENGINEER" "" "" "MJH (s)" "") 
    (command "-attedit" "n" "n" "DSHEET1" "ENGDATE" "" "" “05-28-08” "")
    (graphscr)
    (princ) 
    )
    This one prompts you for the info on the command line (not practical for your use):
    Code:
    (defun c:fillatt ()
    (setq ENG (getstring "\nENGINEER NAME "))
    (setq DTE (getstring "\nENG DATE  "))
    (command "-attedit" "n" "n" "DSHEET1 "ENGINEER" "" "" ENG "") 
    (command "-attedit" "n" "n" "DSHEET1" "ENGDATE" "" "" DTE "")
    (graphscr)
    (princ) 
    )
    I'd be interested to know why I can't get it to replace existing values, I tried wild cards (*) but it didn't work.

    ~shrug~
    Last edited by tedg; 2008-05-28 at 07:11 PM. Reason: added info **

  10. #10
    Active Member todd.mackay's Avatar
    Join Date
    2003-03
    Posts
    74
    Login to Give a bone
    0

    Default Re: Add values to attributes

    Quote Originally Posted by Opie View Post
    Maybe this thread, "Using lisp to Edit Attributes in a Title Block," can help you.
    Thank you, that thread looks like what I need!

    I tried, I think, 2 searches before I started this thread but didn't get any hits. Guess I have to get better at wording my searches.

    Thanks again!

    - Todd

Page 1 of 2 12 LastLast

Similar Threads

  1. Summing values from attributes
    By architect3d in forum AutoLISP
    Replies: 15
    Last Post: 2019-10-12, 12:48 PM
  2. Block Count via attributes values
    By cadconcepts in forum AutoLISP
    Replies: 21
    Last Post: 2015-02-10, 06:35 PM
  3. Getting Block Attributes/Values (for dummies)
    By stusic in forum AutoLISP
    Replies: 7
    Last Post: 2012-09-22, 03:56 PM
  4. Replies: 13
    Last Post: 2009-12-14, 12:39 AM
  5. Using VBA to pull values from Excel and into attributes
    By tyoung in forum VBA/COM Interop
    Replies: 10
    Last Post: 2005-04-29, 05:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •