乐筑天下

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

[编程交流] Selecting a unique object (tri

[复制链接]

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 23:25:29 | 显示全部楼层
Replace this .
 
  1. (setq sstri(ssadd (entget sn) sstri))
With this.
 
  1. (ssadd sn sstri)
 
And this is enough .
 
and this .
  1. (if (eval ss)
 
With this .
  1. (if ss
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 23:27:28 | 显示全部楼层
With your two changes I get:
 
 
and no lines change color.
 
Below still works:
  1. Command: (colorgray (ssget))
 
I added eval because it seemed to fix an issue that doesn't exist anymore.
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 23:32:15 | 显示全部楼层
Could it be a scope issue?
 
will sstri still exist when used in this context?  
 
I would think it is returning the list as a "value"
 
I come more from a C environment.  LISP has been something else so far.
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 23:33:38 | 显示全部楼层
Got it to work, but i don't really understand why.  I added (eval sstri) at end of function instead of just (sstri).
 
  1. (defun GetMTriangle (/ ss i sn l )( setq sstri (ssadd)) (if (setq ss (ssget "_X" '((0 . "LINE"))))        (repeat (setq i (sslength ss))                (setq sn (ssname ss (setq i (1- i))))                (setq l (distance        (cdr (assoc 10 (entget sn)))                                        (cdr (assoc 11 (entget sn)))                                )                )                (if (or (equal l 0.1876 1e- (equal l 0.1875 1e-4))                        (ssadd sn sstri)                                      )        ))(eval sstri))
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 23:38:19 | 显示全部楼层
Explain what you are trying to do to avoid tons of questions and wasting of time .
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 23:42:10 | 显示全部楼层
  1. ColorGray( ss)

Modify color attribute of all entities in a selection set to pen 8
 
  1. (defun GetMTriangle (/ ss i sn l )
  Return all lines in drawing of length 0.1876 or 0.1875 as  a selection set
 
 
 
My code works.  Just didn't understand why you need to use (eval ss) to return selection set instead of just (ss).  
 
If I am wasting your time, don't bother.  Just trying to learn, maybe I am on the wrong forum.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 23:44:39 | 显示全部楼层
 
What was wrong with my previous post HERE ?
 
Not needed .
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-5 23:48:11 | 显示全部楼层
I should of started a new thread, because my question is unrelated to the initial thread.  I will.  My goal is to learn how to return a selection set for more than this  only purpose. I have got it to work.  I think the eval is required because there is an extra set of () around the set.
 
Nothing, code works great and taught me a lot.
 
I disagree I think it is more clear to be able to write code like below even though it is less efficient.  Obviously just an opinion.
 
  1. (Color Gray GetMTriangle)(Color Gray GetBendLines)(Color Blue GetWeldMarkers)(Color Blue GetEtchText)
 
Gray = no cut  Blue = etch  in my CAM software.
 
Thank you for your help.  I have read through your other posts and you have a lot of knowledge.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 23:52:02 | 显示全部楼层
 
You're welcome , and hope you understand that when I said to avoid wasting of time in post # 15 , that was to save time for you and to get the best reply when you explain your aim clearly to allow more users to participate with their knowledge as well and nothing's more .
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 03:09 , Processed in 0.811838 second(s), 68 queries .

© 2020-2025 乐筑天下

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