Attribute Association List

Discussion in 'AutoCAD' started by crrussell3, Oct 20, 2004.

  1. crrussell3

    crrussell3 Guest

    Yes,
    I am trying to find a code snipplet that will do the following for me:

    What I have:

    A program that is called from a Menu that inserts a specified block. This block contains two attributes, nil by default. The attributes are named the following:

    1. case-name1
    2. case-name2

    Based on rotation of the block, will determine which attribute needs to be filled in with a variable that was set from the menu call:

    (SETQ CaseTag "C2XLGE-12")

    What I need:

    The program so far sets all variables, etc. I am having problems figuring this out:

    I am using (ENTLAST) to obtain the entity name of the block. Then I need to be able to step through the association list, through the attributes until I hit the predetermined attribute tag name which was passed from a variable based on the rotation of the block. This attribute then needs to be (ENTMOD) with the CaseTag variable and updated on the graphics screen.

    I am looking for a solution preferrably in AutoLISP. I am pretty new at digging into the association lists, so would like some any help that can be provided.

    Thanks in advance,
    Craig
     
    crrussell3, Oct 20, 2004
    #1
  2. crrussell3

    T.Willey Guest

    Do some research about (entnext) after you do your (entlast) to get the block.

    If you want more infor, or help with stepping through, post again, but it seems like you want to learn and research, so I will just point for now.

    Hope that helps.
    Tim
     
    T.Willey, Oct 20, 2004
    #2
  3. crrussell3

    CJ Follmer Guest

    I'm curious as to what you're doing. You have two attributes and only one
    gets text and this is based on the rotation.

    Is this so the text is not upside down? If this is so, you're other option
    is to rotate the attribute so it's not upside down.

    cj


    block contains two attributes, nil by default. The attributes are named the
    following:
    filled in with a variable that was set from the menu call:
    to be able to step through the association list, through the attributes
    until I hit the predetermined attribute tag name which was passed from a
    variable based on the rotation of the block. This attribute then needs to
    be (ENTMOD) with the CaseTag variable and updated on the graphics screen.
    digging into the association lists, so would like some any help that can be
    provided.
     
    CJ Follmer, Oct 20, 2004
    #3
  4. crrussell3

    crrussell3 Guest

    Tim,
    I have tried researching and looking at code that other people have written, but keep hitting a brick wall. So anymore info you can help or provide would be appriciated greatly.

    thanks
     
    crrussell3, Oct 20, 2004
    #4
  5. crrussell3

    crrussell3 Guest

    Cj,
    What we are doing is insert Refrigerated Cases for like grocery stores. One attribute is located in the upper left hand corner while the other is located in the lower right hand corner read upside-down, so yes, when you rotate, the attribute is in the same location read properly.

    As for just using a single attrib. and rotating, that would go against "company and customer" wishes, as its always been the way its been.
     
    crrussell3, Oct 20, 2004
    #5
  6. crrussell3

    T.Willey Guest

    Here is an example straight from acad. I inserted a block then grabbed it with entlast. Then I stepped through it with entnext until I hit an entity callled "SEQEND" which is the end of the block as inserted.
    tm1 = the block
    tm2 = the attribute (only one in this block)
    tm3 = the end entity of the block "SEQEND"

    Hope this helps.
    Tim

    Command: i DDINSERT
    Substituting [simplex.shx] for [architxt.shx].
    Specify insertion point or [Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]:
    Specify rotation angle <0>:

    Command: (setq tm1 (entlast))
    <Entity name: 7ef67df8>

    Command: !tm1
    <Entity name: 7ef67df8>

    Command: (entget tm1)
    ((-1 . <Entity name: 7ef67df8>) (0 . "INSERT") (330 . <Entity name: 7ef67d08>)
    (5 . "3F") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 .
    "AcDbBlockReference") (66 . 1) (2 . "CIR-NOTE") (10 7.02386 4.82368 0.0) (41 .
    1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0)
    (210 0.0 0.0 1.0))

    Command: (setq tm2 (entnext tm1))
    <Entity name: 7ef67e00>

    Command: (entget tm2)
    ((-1 . <Entity name: 7ef67e00>) (0 . "ATTRIB") (330 . <Entity name: 7ef67df8>)
    (5 . "40") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 2) (6
    "ByBlock") (370 . -3) (100 . "AcDbText") (10 6.90482 4.32368 0.0) (40 . 1.0)
    (1 . "1") (50 . 0.0) (41 . 1.0) (51 . 0.0) (7 . "ADG-NOTES") (71 . 0) (72 . 4)
    (11 7.02386 4.82368 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (2 . "NOTE")
    (70 . 0) (73 . 0) (74 . 0))

    Command: (setq tm3 (entnext tm2))
    <Entity name: 7ef67e08>

    Command: (entget tm3)
    ((-1 . <Entity name: 7ef67e08>) (0 . "SEQEND") (330 . <Entity name: 7ef67df8>)
    (5 . "41") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (-2 .
    <Entity name: 7ef67df8>))
     
    T.Willey, Oct 20, 2004
    #6
  7. crrussell3

    crrussell3 Guest

    Tim,
    Thanks so much for your help. It worked like a charm. I pretty much had it, but mislabeled one of the variables so it didn't work right.

    Thanks again,
    Craig
     
    crrussell3, Oct 20, 2004
    #7
  8. crrussell3

    T.Willey Guest

    Craig,

    Your welcome, glad you got it to work.

    Tim
     
    T.Willey, Oct 21, 2004
    #8
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.