ASSOC question

Discussion in 'AutoCAD' started by ChrisW, Apr 27, 2004.

  1. ChrisW

    ChrisW Guest

    How do i use assoc to retrive a blocks insert point? i guess i am not
    understaing how it works becuase what i have doesn't work. Here is what i
    have been trying (term is a block ent):

    (setq inp (assoc term 10))
     
    ChrisW, Apr 27, 2004
    #1
  2. ChrisW

    Jeff Mishler Guest

    try: (setq inp (cdr (assoc 10 term)))

    Jeff
     
    Jeff Mishler, Apr 27, 2004
    #2
  3. ChrisW

    ChrisW Guest

    Thanks its always the simple things that get me

     
    ChrisW, Apr 27, 2004
    #3
  4. ChrisW

    liftedaxis Guest

    and don't forget, you'll always want to do point translation whenever you access the drawing database. I've found it helpful to search for "(cdr (assoc 10" throughout old code, because this:
    (setq p1 (cdr (assoc 10 entx)))
    will result in the wrong point if you feed it back to some acad command if the user has changed the UCS. thus, you want:
    (setq p1 (trans (cdr (assoc 10 entx)) 0 1))

    --Jeremiah
     
    liftedaxis, Apr 28, 2004
    #4
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.