Small Fish 发表于 2022-7-6 12:54:59

Thanks guys
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.

alanjt 发表于 2022-7-6 12:59:38

 
 
 

(and (setq ent (car (entsel)))    (setq vp (cdr (assoc 330 (entget ent))))    )

alanjt 发表于 2022-7-6 13:06:56

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")

Small Fish 发表于 2022-7-6 13:07:57

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))

alanjt 发表于 2022-7-6 13:13:54

 
 
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]
查看完整版本: entsel过滤器