Searching a list for . . .

Discussion in 'AutoCAD' started by j.buzbee, Sep 30, 2004.

  1. j.buzbee

    j.buzbee Guest

    .. . . a particular combination. I have a list returned by enget, the entity
    being a dictionary. I want to find a certain sequence of dxf values:

    (100 . "AecScheduleTableStyleColumn")
    (102 . "{AEC_NULLOBJECT}")
    (1 . "Width") <-- cdr value changes but not important
    (340 . <Entity name: 7ed5b970>) <-- this is what I want

    BUT: the 340 value must be preceded by (100 . "AecScheduleTableStyleColumn")

    How do a search and return the value for 340 based on the above parameters?

    Thanks for any help!!

    jb
     
    j.buzbee, Sep 30, 2004
    #1
  2. j.buzbee

    BillZ Guest

    (entget (cdr (assoc 340 EntityList)))


    Bill
     
    BillZ, Sep 30, 2004
    #2
  3. note - if there are two or more elements with same dxf value you would have
    to loop (while) thru the list to find the additional elements (for example
    the points in a lwpolyline).
     
    Alan Henderson @ A'cad Solutions, Sep 30, 2004
    #3
  4. j.buzbee

    MP Guest

    (while
    (not
    (=
    (100 . "AecScheduleTableStyleColumn")
    (car lst)
    )
    )
    (setq lst (cdr lst))
    )
    (setq thisone(assoc 340 lst))
    ???
    just a thought, didn't test

    hth
    Mark Propst
     
    MP, Sep 30, 2004
    #4
  5. j.buzbee

    Jeff Mishler Guest

    (if (setq partial (member (100 . "AecScheduleTableStyleColumn") entlist))
    (setq desired (assoc 340 partial))
    )
     
    Jeff Mishler, Sep 30, 2004
    #5
  6. j.buzbee

    j.buzbee Guest

    Thankyou everyone.

    Since there are several "items" in the list I had to get that followed this
    sequence I had to loop through it like this: dict is the list like ((-1 .
    <Entity name: 7ed2dd90>) (0 . "AEC_SCHEDULE_TABLE_STYLE") (5 . "21A") (102 .
    "{ACAD_XDICTIONARY") . . . .)

    (foreach
    i dict
    (if (= (car i) 341)
    (if (equal (nth (- (vl-position i dict) 4) dict);check 4
    items back
    (cons 100 "AecScheduleTableStyleColumn"))
    (setq obj (vlax-ename->vla-object (cdr i))
    name (vlax-get-name obj)
    aply (vlax-safearray->list
    (vlax-variant-value(vlax-get obj
    'appliesto)))
    prop-list (append prop-list (list (cons name
    aply)))))))

    Thanks for all the replies.

    jb
     
    j.buzbee, Oct 1, 2004
    #6
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.