Results 1 to 8 of 8

Thread: editing attributes that are not a part of a block?

  1. #1
    I could stop if I wanted to
    Join Date
    2008-03
    Location
    Columbia/Jefferson City, MO
    Posts
    224
    Login to Give a bone
    0

    Question editing attributes that are not a part of a block?

    greetings all!

    i wrote a program that utilized our company's title mark block to fill in the mark number, drawing title, & scale using a dialog box. Originally their were two blocks inside the title mark drawing that I had my program edit the attributes of; now my CAD manager has changed the title mark drawing to not have any blocks, just the attributes. I am having considerable trouble trying to find how i edit these attributes that are no longer part of a block in my LISP program. any ideas? thank you all in adavance for any help you can lend.

    here is my original program:
    Code:
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------
    (defun C:TLMK ( / TLMK_LEN PT1)
      (setvar "CMDECHO" 0)
      (setq tempunits (getvar "insunits"))
      
    ;======================================================================================================================================== LOADS DIALOG BOX
    (defun TLMK(/ DCL_ID)
     (setq DCL_ID (load_dialog "n:/tuterj/AutoLISP/TL-MK.DCL"))
     (if (not (new_dialog "TLMK" DCL_ID)) (exit))
     (setq mark_n nil)
     (setq title_n nil)
     (setq scale_n nil)
     (action_tile "mark_n" "(setq mark_n $value)")
     (action_tile "title_n" "(setq title_n $value)")
     (action_tile "scale_n" "(setq scale_n $value)") 
      
     (start_dialog)
     (unload_dialog DCL_ID)
     (princ)
    ) ;defun TLMK
     (TLMK)
    ;======================================================================================================================================== End of Dialog BOx
    (setq PT1 (getpoint "\nselect insertion point: "))
    (setvar "ATTDIA" 0)
    (setq title_u (strcase title_n))   ;declaring additional variable to change case for title_n
    (setq scale_u (strcase scale_n))   ;declaring additional variable to change case for scale_n
    (setvar "insunits" 0)  ;setting insertion units to unitless for proper scale of inserted block
      
    (command "insert" "*N:/Tuterj/AutoLISP/TitleMark.dwg" PT1 "" "")
    (command "-attedit" "N" "N" "" "NUMBER" "*" "#" mark_n)
    (command "-attedit" "N" "N" "" "TITLE" "*" "Title" title_u)
    (command "-attedit" "N" "N" "" "SCALE" "*" "Scale" scale_u)
      
    (setvar "ATTDIA" 1)
    (setvar "CMDECHO" 1)
    (setvar "insunits" tempunits)
    ) ;defun C:TLMK

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

    Default Re: editing attributes that are not a part of a block?

    Quote Originally Posted by tntdraftsol View Post
    greetings all!

    i wrote a program that utilized our company's title mark block to fill in the mark number, drawing title, & scale using a dialog box. Originally their were two blocks inside the title mark drawing that I had my program edit the attributes of; now my CAD manager has changed the title mark drawing to not have any blocks, just the attributes. I am having considerable trouble trying to find how i edit these attributes that are no longer part of a block in my LISP program. any ideas? thank you all in adavance for any help you can lend.
    Are you sure they are attrubutes?
    Or do you mean attribute definitions (raw attribute tags that will become attributes within a block)?

    As far as I know, an "attribute" must live within a block, even if it has no other graphics besides the attribute, it will be in a named block.

    Can you post an example of the "title mark " drawing you're trying to manipulate with this lisp?

    That would help us help you

    *Edit...
    Reading your original post, it "sounds like" you have a title block with raw attribute definitions, that become a "block" when you insert it into another drawing. And if so, THAT is your block name, and if your attribute tags have the same name as they did before, you simply change the name of the block the lisp routine is looking for.

    Just a guess though..
    Last edited by tedg; 2013-12-26 at 08:10 PM. Reason: added a second thought

  3. #3
    I could stop if I wanted to
    Join Date
    2008-03
    Location
    Columbia/Jefferson City, MO
    Posts
    224
    Login to Give a bone
    0

    Default Re: editing attributes that are not a part of a block?

    Ted, thank you for your reply!

    Quote Originally Posted by tedg View Post
    Are you sure they are attrubutes?
    Or do you mean attribute definitions (raw attribute tags that will become attributes within a block)?

    As far as I know, an "attribute" must live within a block, even if it has no other graphics besides the attribute, it will be in a named block.
    Yes, you are correct. They are attribute definitions. Three of them, one for the Mark Number, one for the Title, and one for the Scale.

    Quote Originally Posted by tedg View Post
    Can you post an example of the "title mark " drawing you're trying to manipulate with this lisp?

    That would help us help you
    I have attached a screen shot of the block with the attribute definitions.

    Quote Originally Posted by tedg View Post
    *Edit...
    Reading your original post, it "sounds like" you have a title block with raw attribute definitions, that become a "block" when you insert it into another drawing. And if so, THAT is your block name, and if your attribute tags have the same name as they did before, you simply change the name of the block the lisp routine is looking for.

    Just a guess though..
    I tried your suggestion in your edit and my program was able to finish and insert the block, BUT none of the attribute definitions changed to the information I put in my dialog box at the beginning of the routine. Here is the revised code:

    Code:
     (defun C:TLMK ( / TLMK_LEN PT1)
      (setvar "CMDECHO" 0)
      (setq tempunits (getvar "insunits"))
      
    ;======================================================================================================================================== LOADS DIALOG BOX
    (defun TLMK(/ DCL_ID)
     (setq DCL_ID (load_dialog "n:/tuterj/AutoLISP/TL-MK.DCL"))
     (if (not (new_dialog "TLMK" DCL_ID)) (exit))
    
     (setq mark_n nil)
     (setq title_n nil)
     (setq scale_n nil)
    
     (action_tile "mark_n" "(setq mark_n $value)")
     (action_tile "title_n" "(setq title_n $value)")
     (action_tile "scale_n" "(setq scale_n $value)") 
      
     (start_dialog)
     (unload_dialog DCL_ID)
     (princ)
    ) ;defun TLMK
     (TLMK)
    
    ;======================================================================================================================================== End of Dialog BOx
    
    (setq PT1 (getpoint "\nselect insertion point: "))
    (setvar "ATTDIA" 0)
    
    (setq title_u (strcase title_n))   ;declaring additional variable to change case for title_n
    (setq scale_u (strcase scale_n))   ;declaring additional variable to change case for scale_n
    
    (setvar "insunits" 0)  ;setting insertion units to unitless for proper scale of inserted block
      
    (command "insert" "*N:/Tuterj/AutoLISP/TitleMark.dwg" PT1 "" "")
    (command "-attedit" "N" "N" "TitleMark" "NUMBER" "*" "#" mark_n)
    (command "-attedit" "N" "N" "TitleMark" "TITLE" "*" "Title" title_u)
    (command "-attedit" "N" "N" "TitleMark" "SCALE" "*" "Scale" scale_u)
      
    (setvar "ATTDIA" 1)
    (setvar "CMDECHO" 1)
    (setvar "insunits" tempunits)
    
    ) ;defun C:TLMK
    Attached Images Attached Images

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

    Default Re: editing attributes that are not a part of a block?

    Quote Originally Posted by tntdraftsol View Post
    Ted, thank you for your reply!
    Your welcome.

    Quote Originally Posted by tntdraftsol View Post
    Yes, you are correct. They are attribute definitions. Three of them, one for the Mark Number, one for the Title, and one for the Scale.

    I have attached a screen shot of the block with the attribute definitions.

    I tried your suggestion in your edit and my program was able to finish and insert the block, BUT none of the attribute definitions changed to the information I put in my dialog box at the beginning of the routine. Here is the revised code:
    It looks like it should work, I don't have the DCL nor am I an expert in them.

    I assume this drawing with the raw attributes that you are inserting is actually named "TitleMark.dwg" and lives in the path you have in your routine?
    And the attrubute tags are properly named to match up with your routine? (it appears that is the case based on your screen shot, but I'm just asking)

    You said this worked before your cad manager made it "without blocks", what was the block named before?

  5. #5
    I could stop if I wanted to
    Join Date
    2008-03
    Location
    Columbia/Jefferson City, MO
    Posts
    224
    Login to Give a bone
    0

    Default Re: editing attributes that are not a part of a block?

    Quote Originally Posted by tedg View Post
    I assume this drawing with the raw attributes that you are inserting is actually named "TitleMark.dwg" and lives in the path you have in your routine?
    you would be correct.

    Code:
     (command "insert" "*N:/Tuterj/AutoLISP/TitleMark.dwg" PT1 "" "")
    Quote Originally Posted by tedg View Post
    And the attrubute tags are properly named to match up with your routine? (it appears that is the case based on your screen shot, but I'm just asking)
    Yes, also correct. Per your previous suggestion I changed the block name from the two separate blocks it used to be to the block name that it is inserting it under, but the attribute definition tags are the same when i check them under properties.

    Code:
    (command "-attedit" "N" "N" "TitleMark" "NUMBER" "*" "#" mark_n)
    (command "-attedit" "N" "N" "TitleMark" "TITLE" "*" "Title" title_u)
    (command "-attedit" "N" "N" "TitleMark" "SCALE" "*" "Scale" scale_u)
    Quote Originally Posted by tedg View Post
    You said this worked before your cad manager made it "without blocks", what was the block named before?
    there were two blocks in the TitleMark drawing before they were exploded and purged. One block was solely for the Mark Number called 1det with the tag of NUMBER. The second block was called Title and had two attributes with the tags of Title and scale.

    Should I be using a different command to edit these attribute definitions? OR should we not have left them as attribute definitions?

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

    Default Re: editing attributes that are not a part of a block?

    Quote Originally Posted by tntdraftsol View Post

    Should I be using a different command to edit these attribute definitions? OR should we not have left them as attribute definitions?
    It's hard for me to say, some of your code is over my head, maybe someone else can chime in.
    It "looks" to me like it should work.
    What happens if you try the program in a new drawing (make sure the block doesn't exist in the drawing file already)?
    Can you post the actual DCL and dwg file?

    You say the program inserts the drawing but doesn't fill in the attributes per your dialog?
    I think if your drawing and attribute definitions with proper tag names are good, it has something to do with the code.

    Sorry I wasn't much help.

  7. #7
    I could stop if I wanted to
    Join Date
    2008-03
    Location
    Columbia/Jefferson City, MO
    Posts
    224
    Login to Give a bone
    0

    Cool Re: editing attributes that are not a part of a block?

    Eureka!

    I found a solution! The first thing I did was remove the asterisk from in front of the address for the location of the block I was inserting (see image). Before my CAD manager removed the blocks I needed to explode the block that was inserted so I could get at the nested blocks that had the attributes. Once I removed the asterisk the block inserted without the tag prompts, but not with my infromation from the dialog box. What I noticed was that it was taking the first three non-reserved words after the insertion command and putting them in for the attributes. I then tried putting my variables in with the insertion sequence (see image) to see if that would populate the block properly and viola! I could then remove the attribute edit commands that followed. Ted, thank you for your help.
    Attached Images Attached Images

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

    Default Re: editing attributes that are not a part of a block?

    Quote Originally Posted by tntdraftsol View Post
    Eureka!
    ....Ted, thank you for your help.
    You're welcome, although I don't know I actually "helped".
    That makes sense, the asterisk inserts the block and explodes it (I remember that from AutoCAD 101.. forgot about it).

    Glad you figured it out and posted the solution.

Similar Threads

  1. 2009: Need help: Batch editing block with attributes
    By J. Grouchy in forum AutoCAD 3D (2007 and above)
    Replies: 3
    Last Post: 2011-10-13, 04:25 PM
  2. 2012: Autocad 2012 - Editing block attributes
    By nimrodisease in forum AutoCAD General
    Replies: 6
    Last Post: 2011-05-06, 02:36 PM
  3. ADT Mutli-view Block: Editing Attributes
    By c.mcmahon in forum ACA General
    Replies: 4
    Last Post: 2008-12-19, 04:21 PM
  4. Replies: 21
    Last Post: 2007-03-20, 02:03 PM
  5. Part Feature Deletion Without Editing Part
    By inventor.wishlist1738 in forum Inventor Wish List
    Replies: 0
    Last Post: 2006-04-19, 04:35 AM

Tags for this Thread

Posting Permissions

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