乐筑天下

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

[编程交流] LISP例程选择linewei

[复制链接]

9

主题

36

帖子

30

银币

初来乍到

Rank: 1

铜币
42
发表于 2022-7-5 17:27:37 | 显示全部楼层
 
 
 
Hi, thanks for trying that but it didn't quite work (it brings up a message in the command line saying 'too many items to intersect'. It then runs the routine but puts the lineweight 0.50mm onto the "0" layer and doesn't delete the 'Cyan' colours or move the colour 35 lines onto "0".
Please don't worry though as the previous one almost does everything that I am looking for so that is still a big help!
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 17:32:39 | 显示全部楼层
I may messed up (cond) Try this one:

[code](defun C:test ( / lyr1 lyr0 acDoc emakeLay SSX i e enx ce )(setq lyr1 "Layer 1");
回复

使用道具 举报

5

主题

23

帖子

18

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 17:36:35 | 显示全部楼层
I would have used the SELECTSIMILAR for most of this. For almost every single thing you need  you could have set your settings to your requirements and simply changed the layer/color and what not.
回复

使用道具 举报

9

主题

36

帖子

30

银币

初来乍到

Rank: 1

铜币
42
发表于 2022-7-5 17:37:17 | 显示全部楼层
 
 
Thanks again, that is almost there!
The only thing is it puts the Colour 35 items onto the "0existing" layer instead of the "0" layer but apart from that it does everything I need!
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 17:40:48 | 显示全部楼层
 
Corrected the code in my last post. Sorry, it was confusing with these "0" and "0existing" layer names.
回复

使用道具 举报

9

主题

36

帖子

30

银币

初来乍到

Rank: 1

铜币
42
发表于 2022-7-5 17:46:12 | 显示全部楼层
 
Wow thank you, that is everything that I need. Hopefully you won't here from me again!
回复

使用道具 举报

76

主题

312

帖子

254

银币

后起之秀

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

铜币
390
发表于 2022-7-5 17:48:38 | 显示全部楼层
I was following this topic, and i need a similair LISP, but instead of checking for lineweights, i need a check for linetypes.
Im trying to edit the code above myself, but i dont understand how you check for lineweight properties... i just cant find the logic in the code.
 
Is is easy to edit this code to:
- check all objects in the drawing...
- if something has the property : Linetype Hidden...
- change it so : Linetype Hidden2.
- and if its dashed, change it to dashed2...
 
entire drawing, including blocks etc... so hidden and dashed can be purged...
I need a specific check on the 'properties' part, not a check on the layermanager. (got that one solved already. :-))
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 17:52:33 | 显示全部楼层
Not sure will this work, please reply after testing it:
  1. (defun C:test ( / blkdef e enx i lckd ssx subent subenx )(vlax-for x (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))         (if (= (vla-get-Lock x) :vlax-true)                 (progn                        (vla-put-Lock x :vlax-false)                        (setq lckd (cons x lckd))                )        ))(while (setq blkdef (tblnext "BLOCK" (not blkdef)))        (setq subEnt (cdr (assoc -2 blkdef)))        (while subEnt                (setq subEnx (entget subEnt))                (if (assoc 6 [color="red"]subEnx[/color])                        (cond                                ((= (strcase (cdr (assoc 6 subEnx))) "HIDDEN")                                        (setq subEnx (subst (cons 6 "HIDDEN2") (assoc 6 subEnx) subEnx))                                        (entupd (cdr (assoc -1 (entmod subEnx))))                                )                                ((= (strcase (cdr (assoc 6 subEnx))) "DASHED")                                        (setq subEnx (subst (cons 6 "DASHED2") (assoc 6 subEnx) subEnx))                                        (entupd (cdr (assoc -1 (entmod subEnx))))                                )                        ); cond                )                (setq subEnt (entnext subEnt))        )               (entupd (tblobjname "BLOCK" (cdr (assoc 2 blkdef)))))(if (setq SSX (ssget "_X"))        (repeat (setq i (sslength SSX))                (setq e (ssname SSX (setq i (1- i))))                (setq enx (entget e))                (if (assoc 6 enx)                        (cond                                ((= (strcase (cdr (assoc 6 enx))) "HIDDEN")                                        (setq enx (subst (cons 6 "HIDDEN2") (assoc 6 enx) enx))                                        (entupd (cdr (assoc -1 (entmod enx))))                                )                                ((= (strcase (cdr (assoc 6 enx))) "DASHED")                                        (setq enx (subst (cons 6 "DASHED2") (assoc 6 enx) enx))                                        (entupd (cdr (assoc -1 (entmod enx))))                                )                        ); cond                )        ))(if lckd (mapcar '(lambda (x)(vla-put-Lock x :vlax-true) ) lckd))(vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) [color="red"]acAllViewports[/color])(vla-ZoomExtents (vlax-get-acad-object))(princ))
回复

使用道具 举报

76

主题

312

帖子

254

银币

后起之秀

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

铜币
390
发表于 2022-7-5 17:52:54 | 显示全部楼层
Thanks for the code Grrr!
The part of the code where the linetypes get replaced seems to work fine.
Tho... the part where it checks the contents of BLOCKS doent nothing. But doenst give an error message.
It just does not change the linetype inside the blocks.
 
Hope this can be fixed. :-)
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

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

铜币
325
发表于 2022-7-5 17:57:50 | 显示全部楼层
 
Hmm, I can't seem to find the problem, edited the code to regen All viewports (the red text). If it still doesn't work I will try to re-write the block iteration with visual lisp.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-14 13:11 , Processed in 0.601067 second(s), 70 queries .

© 2020-2025 乐筑天下

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