How to find out the new "Insert point" for an object ?

Discussion in 'AutoCAD' started by Felix_yu, Nov 24, 2004.

  1. Felix_yu

    Felix_yu Guest

    Hi, EveryOne,

    I get an object but I can retiev its "Insert point". This object already is moved several times. I use the code As

    (if (= langue "e")
    (setq int (ssget "X" (list (cons 0 "INSERT") (cons 2 "INTE"))))
    (setq int (ssget "X" (list (cons 0 "INSERT") (cons 2 "INTF"))))
    (if (/= null int)
    (setq e1 (ssname int 0))


    (setq e2 (entnext e1))
    (setq e4 (entnext (entnext (entnext e1))))
    (setq e5 (entnext (entnext (entnext (entnext e1)))))
    (setq run (atoi (cdr (assoc '1 (entget e2)))))
    (setq name (cdr (assoc '1 (entget e4))))

    (setq ptbase (cdr (assoc '10 (entget e1))))

    It doesn't work. I got a message "Invalid point", WHY ??


    Felix_yu, Nov 24, 2004
  2. I believe you need to change

    (setq ptbase (cdr (assoc '10 (entget e1))))

    to just

    (setq ptbase (assoc '10 (entget e1)))

    Code 10 values are already points, so (cdr (assoc 10 (....))) will leave off
    the x coordinate. [Maybe you're confusing the case of (entsel), which
    returns an entity name and the point by which it was selected. In that
    case, you want to use (cdr) to get the point part separate from the entity
    Kent Cooper, AIA, Nov 24, 2004
  3. Felix_yu

    Paul Turvill Guest

    It appears that your code is incomplete, since there are no closing parens
    for your (if ... and (progn ... functions. However, you may find that the
    error lies in this line:

    (if (/= null int)
    (progn ...

    null isn't a variable, so it can't be used in this manner. Try

    (if int
    (progn ...
    Paul Turvill, Nov 24, 2004
  4. Felix_yu

    Paul Turvill Guest


    Command: (setq ent (entget(entlast)))
    ((-1 . <Entity name: 40814f0>) (0 . "LINE") (5 . "CAE") (100 . "AcDbEntity")
    (67 . 0) (8 . "MAIN") (100 . "AcDbLine") (10 514.5 232.5 0.0) (11 670.5
    0.0) (210 0.0 0.0 1.0))

    Command: (assoc 10 ent)
    (10 514.5 232.5 0.0) << complete group: WRONG

    Command: (cdr (assoc 10 ent))
    (514.5 232.5 0.0) << just the point: RIGHT

    Paul Turvill, Nov 24, 2004
  5. Oh, duh. I was forgetting that (assoc 10 ...) returns BOTH the 10 and the
    point, so yes, the cdr is appropriate to give you the point without the 10.
    Sorry to bother you....
    Kent Cooper, AIA, Nov 24, 2004
  6. Felix_yu

    LUCAS Guest

    message "Invalid point",maybe not this line (setq ptbase (cdr (assoc '10
    (entget e1))))
    LUCAS, Nov 25, 2004
  7. Felix_yu

    LUCAS Guest

    I think Paul is right
    (if int
    (progn ...

    you missing ----(setq E1 (ssname INT 0))
    LUCAS, Nov 25, 2004
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.