I am having trouble transforming a point from inside a block to the current ucs. Ultimately my block insertion will be nested several levels deep, but to get my head wrapped around what I need to do I have simplified it to a single block, but still can't get it to work.
Given a simple block insertion with a nested circle. If I use nentsel to select the block I get the circle entity. I then get the center of the circle (assoc 10) and want to translate that point back to the current ucs. Help, on the lisp trans function, tells me: "If you use an entity name for the "from" or "to" argument, it must be passed in the format returned by the entnext, entlast, entsel, nentsel, and ssname functions." When I try to do this I get an error, thus:
(setq ent (nentsel))
(<Entity name: 7ed08660> (13.8573 10.5027 0.0) ((1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0) (13.8074 10.3804 0.0)) (<Entity name: 7ed0a978>))
_$ (setq elist (entget (car ent)))
((-1 . <Entity name: 7ed08660>) (0 . "CIRCLE") (330 . <Entity name: 7ed08620>) (5 . "237B0590C") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbCircle") (10 2.08167e-017 -4.16334e-017 0.0) (40 . 0.125) (210 0.0 0.0 1.0))
_$ (setq p0 (cdr (assoc 10 elist)))
(2.08167e-017 -4.16334e-017 0.0)
_$ (trans p0 ent 1)
; error: bad argument type: coordinate system specification: (<Entity name: 7ed08660> (13.8573 10.5027 0.0) ((1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0) (13.8074 10.3804 0.0)) (<Entity name: 7ed0a978>))
When I reduce the from argument to a simple entity name, trans returns nil:
(trans p0 (car ent) 1)
nil
Using a simple entity name doesn't make sense to me since all insertions of this block will have the same entity name for the circle and I don't see how the trans function will know which insertion I'm translating from.
I have used the trans function before without problem, but can't seem to get it to work now.
Suggestions are welcome.