乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: Small Fish

[编程交流] entsel过滤器

[复制链接]

55

主题

243

帖子

188

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 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.
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 12:59:38 | 显示全部楼层
 
 
 
  1. (and (setq ent (car (entsel)))    (setq vp (cdr (assoc 330 (entget ent))))    )
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 13:06:56 | 显示全部楼层
Using AT:Entsel:
 
  1. (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")
回复

使用道具 举报

55

主题

243

帖子

188

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
275
发表于 2022-7-6 13:07:57 | 显示全部楼层
eureka - I have it now many thanks
 
 
  1. (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))
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 13:13:54 | 显示全部楼层
 
 
or
 
  1. (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.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-5 10:21 , Processed in 0.540043 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表