I wanted entsel because I wanted to pick a single entity ie the viewport.
I guess I could use (ssget ":s" '((0 . "viewport")))
to get the same result as entsel
It seems to me the only possible answer is to use Alan's suggestion
Although I have not figured out how to do it yet.
This problem seems to be much harder to achieve than I first thought.
(and (setq ent (car (entsel))) (setq vp (cdr (assoc 330 (entget ent)))) ) Using AT:Entsel:
(and (setq ent (car (at:entsel nil nil '((0 . "LWPOLYLINE")(102 . "{ACAD_REACTORS")) nil))) (setq vp (cdr (assoc 330 (entget ent)))) )
Not perfect, I'd still check that the assoc 330 matches (0 . "VIEWPORT") eureka - I have it now many thanks
(if (setq ss (ssget ":s" '((0 . "viewport")))) (setq enname (ssname ss 0)) (setq enname nil))(setq VptObj (vlax-ename->vla-object enname ))(setq VpScaleRatio(vla-get-customscale VptObj))
or
(and (setq ent (car (entsel))) (eq "VIEWPORT" (cdr (assoc 0 (entget ent)))) (setq obj (vlax-ename->vla-object ent)) (setq scl (vla-get-customscale obj)) )
BTW, with what you have, if you object is not a viewport it will error when trying to convert nil to a vla-object.
页:
1
[2]