乐筑天下

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

[编程交流] Polyline change fra layer AM_0

[复制链接]

13

主题

46

帖子

33

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
65
发表于 2022-7-6 08:23:40 | 显示全部楼层 |阅读模式
I am trying to make a routine that could change all polylines in a drawing from layer AM_0 to 0. But i can't get i to work.
 
  1. (defun C:chgpllnul ( / pllist ) (setq pllist ((ssget '((8 . "AM_0") (0 . "Polyline")))(command "change" pllist "" "P" "LA" "0" "" ))))
Please help!
 
Thx in advance.
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 08:33:31 | 显示全部楼层
(0 . "Polyline")
or for both
(0 . "*POLYLINE")
 
(setq pllist ((ssget '((8 . "AM_0") (0 . "Polyline")))
回复

使用道具 举报

26

主题

149

帖子

127

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
135
发表于 2022-7-6 08:39:20 | 显示全部楼层
I think this work
 
  1. (defun C:chgpllnul (/ pllist slen sname entlst) (if (setq pllist (ssget '((8 . "AM_0") (0 . "*Polyline"))))   (repeat (setq slen (sslength pllist))     (setq sname (ssname pllist (setq slen (1- slen))))     (entmod (subst (cons 8 "0")                    (assoc 8 (setq entlst (entget sname)))                    entlst             )     )   ) ) (princ))
回复

使用道具 举报

6

主题

249

帖子

247

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-6 08:44:22 | 显示全部楼层
 
Neither #2 or #3 works.  (using A2008)   so ?
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 08:47:22 | 显示全部楼层
 
Without testing #3 myself (nothing jumps out to me as to why it wouldn't work?), you could always iterate the VLA ActiveSelectionSet Object, and use vla-put-layer Method as an alternative.
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 08:53:38 | 显示全部楼层
 
  1. (defun C:chgpllnul  (/ pllist)     (setq pllist (ssget '((8 . "AM_0") (0 . [b][color=darkolivegreen]"*Polyline"))))[/color][/b]     (command "change" pllist "" "P" "LA" "0" "")))
 
from
 
  1. (defun C:chgpllnul ( / pllist ) (setq pllist [b][color=#0000ff]([/color][/b](ssget '((8 . "AM_0") (0 . [b]"[/b][color=blue][b]Polyline"[/b])))[/color](command "change" pllist "" "P" "LA" "0" "" ))[b][color=blue])[/color][/b])
 
 
and while we're at it
  1. (defun C:chgpllnul  (/ pllist      (if (ssget '((8 . "AM_0") (0 . "*Polyline")))           (progn                 (vlax-for                        itm  (setq pllist                                        (vla-get-ActiveSelectionSet                                              (vla-get-ActiveDocument                                                    (vlax-get-acad-object))))                       (vla-put-layer itm "0")                       )                 (vla-delete pllist)                 )           )     )
回复

使用道具 举报

5

主题

1074

帖子

1088

银币

初来乍到

Rank: 1

铜币
9
发表于 2022-7-6 09:00:35 | 显示全部楼层
You could do this very easily with your action recorder, if you have your quick properties palette turned on to provide the POLYLINE filter selection, then just change the layer on the quick properties palette.  Not sexy, but it would work.
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 09:02:33 | 显示全部楼层
You could always use QSELECT also... Just saying. :wink:
 
092340oss29cu2u5jyaa25.jpg

                               
登录/注册后可看大图
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

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

铜币
211
发表于 2022-7-6 09:10:06 | 显示全部楼层
Point taken guys...
 
In fairness to the OP, he did ask for help why he cant get his code to work .. but then again it wouldnt hurt to know you can use  native commands for such a task.
回复

使用道具 举报

5

主题

1074

帖子

1088

银币

初来乍到

Rank: 1

铜币
9
发表于 2022-7-6 09:14:06 | 显示全部楼层
You make a good point RenderMan.  I have never used it before, have used FILTER though, looks pretty similar.  I always use my quick properties palette, so get an awful lot of handy information and limited selectivity there, but I will definitely start using this, good tool, I've seen it mentioned a lot, thanks.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-9 07:54 , Processed in 0.502978 second(s), 74 queries .

© 2020-2025 乐筑天下

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