tblsearch attribute

Discussion in 'AutoCAD' started by Marcel Janmaat, Feb 8, 2005.

  1. I have an attribute in a drawing wich I want to modify without having to
    select it.

    (setq a (entget (car (entsel)))) wil result in;

    ((-1 . <Entity name: 4009fd60>) (0 . "ATTDEF") (330 . <Entity name:
    4009fc10>)
    (5 . "2C") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1)
    (6
    .. "Continuous") (100 . "AcDbText") (10 1168.0 88.0 0.0) (40 . 2.5) (1 .
    "00100") (50 . 0.0) (41 . 0.75) (51 . 0.0) (7 . "STH-1") (71 . 0) (72 . 0)
    (11
    0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttributeDefinition") (3 . "HE")
    (2
    .. "STH") (70 . 11) (73 . 0) (74 . 0))

    How can I get it with the tblsearch command?

    I thought if (tblsearch "layer" "0") works (tblsearch "attdef" "STH") should
    work aswell, but it doesn't.

    Or should I run through the entire dwg-database with tblnext?

    M
     
    Marcel Janmaat, Feb 8, 2005
    #1
  2. I thought so. Thanx. Just wanted to be sure.

     
    Marcel Janmaat, Feb 8, 2005
    #2
  3. Marcel Janmaat

    Don Butler Guest

    I have a block comprised of a circle and and ATTDEF's.

    The block name is "CUTSHTFAB1".

    Command: (setq blk (tblobjname "BLOCK" "CutshtFab1"))
    <Entity name: 7edde0e8>

    Command: (setq cir (entnext blk))
    <Entity name: 7edde058>

    Command: (entget cir)
    ((-1 . <Entity name: 7edde058>) (0 . "CIRCLE") (330 . <Entity name:
    7edde050>)
    (5 . "6364B") (100 . "AcDbEntity") (67 . 0) (8 . "0") (390 . <Entity name:
    7efd2d40>) (100 . "AcDbCircle") (10 0.0 0.0 0.0) (40 . 0.104803) (210 0.0
    0.0
    1.0))

    Command: (setq att (entnext cir))
    <Entity name: 7edde060>

    Command: (entget att)
    ((-1 . <Entity name: 7edde060>) (0 . "ATTDEF") (330 . <Entity name:
    7edde050>)
    (5 . "6364C") (100 . "AcDbEntity") (67 . 0) (8 . "0") (370 . 9) (390 .
    <Entity
    name: 7efd2d40>) (100 . "AcDbText") (10 -0.0052381 -0.044 0.0) (40 . 0.088)
    (1
    .. "1") (50 . 0.0) (41 . 0.5) (51 . 0.0) (7 . "SIMPLEX") (71 . 0) (72 . 1)
    (11
    0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttributeDefinition") (3 . "Enter
    Number For This Piece...") (2 . "PIECE") (70 . 0) (73 . 0) (74 . 2))

    <<< You can also use ActiveX >>>

    Command: (setq docblocks (vla-get-blocks (vla-get-activedocument
    (vlax-get-acad-object))))
    #<VLA-OBJECT IAcadBlocks 010ad494>

    Command: (setq blk (vla-item docblocks "Cutshtfab1"))
    #<VLA-OBJECT IAcadBlock2 05b39984>

    Command: (setq cir (vla-item blk 0))
    #<VLA-OBJECT IAcadCircle 05b3a2b4>

    Command: (setq att (vla-item blk 1))
    #<VLA-OBJECT IAcadAttribute 05b3a024>

    Command: (vlax-dump-object att nil)
    ; IAcadAttribute: AutoCAD Attribute Interface
    ; Property values:
    ; Alignment = 10
    ; Application (RO) = #<VLA-OBJECT IAcadApplication 00b9d604>
    ; Backward = 0
    ; Constant = 0
    ; Document (RO) = #<VLA-OBJECT IAcadDocument 05697ab0>
    ; FieldLength = 0
    ; Handle (RO) = "6364C"
    ; HasExtensionDictionary (RO) = 0
    ; Height = 0.088
    ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 05b3edb4>
    ; InsertionPoint = (-0.0052381 -0.044 0.0)
    ; Invisible = 0
    ; Layer = "0"
    ; Linetype = "ByLayer"
    ; LinetypeScale = 1.0
    ; Lineweight = 9
    ; Mode = 0
    ; Normal = (0.0 0.0 1.0)
    ; ObjectID (RO) = 2128470112
    ; ObjectName (RO) = "AcDbAttributeDefinition"
    ; ObliqueAngle = 0.0
    ; OwnerID (RO) = 2128470096
    ; PlotStyleName = "Light"
    ; Preset = 0
    ; PromptString = "Enter Number For This Piece..."
    ; Rotation = 0.0
    ; ScaleFactor = 0.5
    ; StyleName = "SIMPLEX"
    ; TagString = "PIECE"
    ; TextAlignmentPoint = (0.0 0.0 0.0)
    ; TextGenerationFlag = 0
    ; TextString = "1"
    ; Thickness = 0.0
    ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 05b3bce0>
    ; UpsideDown = 0
    ; Verify = 0
    ; Visible = -1

    HTH

    Don
     
    Don Butler, Feb 8, 2005
    #3
  4. Marcel Janmaat

    Doug Broad Guest

    Marcel,
    Attdef's are intended to be parts of block definitions only. Once they
    are part of a block, they are used to create attributes. An attdef
    can be changed by changing the block definition that it resides in.

    To change attributes that are part of block references, you can use
    the find command or to do as Don suggested or to use activeX
    access via (vla-get-attributes...)

    Hope that helps. In either case, tblsearch won't help.
     
    Doug Broad, Feb 8, 2005
    #4
  5. Marcel Janmaat

    ECCAD Guest

    (setq blks (ssget "X" (list (cons 2 blockname))))
    ...... get just the blocks that contain the attribute definition
    Then, foreach blk blks....entget/entnext..
    grab the 'tagname', and modify that entity.

    Bob
     
    ECCAD, Feb 8, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.