乐筑天下

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

[编程交流] 按顺序编号并插入

[复制链接]

1

主题

6

帖子

5

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 10:20:55 | 显示全部楼层
大家好,
修改此例程以搜索所有打开的图形中的前缀,而不是仅搜索当前图形,是否可以在正确的方向上获得一些帮助或推动?
我一直在尝试以下代码。
 
(defun c:示例(/OpenDwgs eachDwg)
(setq OpenDwgs(vla get documents(vlax get acad object)))
(每个HDWG OpenDWG的vlax
(普林斯“Count”)
(普林斯)
) ;_ 结束vlax for
) ;_ 结束defun
 
阅读相关帖子我相信这只会有效地计算打开的图纸,而不会使它们在全选中处于活动状态。
感谢您的帮助。
当做
约翰
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 10:22:45 | 显示全部楼层
回复

使用道具 举报

1

主题

6

帖子

5

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 10:25:57 | 显示全部楼层
Yes, it's what i want.
Thank you very much   again
回复

使用道具 举报

3

主题

13

帖子

11

银币

初来乍到

Rank: 1

铜币
14
发表于 2022-7-6 10:31:24 | 显示全部楼层
Hello everyone,
I really like this lisp code and use it all the time for our ventilation parts , I just wondered if one of you clever people could help me tweak it alittle.
After selecting the Prefix I would like the code to search the drawing for all blocks called “ID” check the prefix selected “for ensample A” and find the last tag value used for example A12” and prompt the user to use the next value “A13” or enter there own number to start from
I currently have to do this manually
This is what I have so far
(if (ssget "x" '((2 . "ID")))
(progn
(setq ent (ssname (ssget "x" '((2 . "ID"))) 0))
 
(while (not (eq '"REV" (cdr (assoc 2 (setq attlst (entget ent))))))
(setq ent (entnext ent))
)
 
(if (= 1 (setq rev# (+ 1 (ascii (cdr (assoc 1 attlst))))))
(setq rev# 65)
)
My block is "ID" and theattribute tag name is "REV"
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 10:33:06 | 显示全部楼层
 
See if this works for you

[code](defun getlastattrib  (blockname tagname prefix / atstr lng num osset revlist) (or (vl-load-com)) (setq lng (1+ (strlen prefix))num nil) (if (setq osset (ssget "X"   (list     (cons 0 "INSERT")     (cons 2 blockname)     (cons 66 1)))    )   (progn     (foreach blkobj  (mapcar 'vlax-ename->vla-object         (vl-remove-if 'listp (mapcar 'cadr (ssnamex osset))))(foreach att  (vlax-invoke blkobj 'getattributes)  (if (eq (vlax-get att 'tagstring) tagname)    (setq atstr (vlax-get att 'textstring))))(if (wcmatch atstr (strcat prefix "*"))  (setq revlist (cons (substr atstr lng) revlist))))     )   ) (setq num (car      (vl-sort revlist        (function (lambda (a b) (> (atof a) (atof b))))))) num );Call this function inside the main programm like this:(setq lastnum (getlastattrib "ID" "REV" "A"));
回复

使用道具 举报

3

主题

13

帖子

11

银币

初来乍到

Rank: 1

铜币
14
发表于 2022-7-6 10:36:39 | 显示全部楼层
That’s great!
Works fine
Much better than I was expecting really like the window message
Thanks again
John
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 10:39:19 | 显示全部楼层
You're welcome
Cheers
回复

使用道具 举报

3

主题

13

帖子

11

银币

初来乍到

Rank: 1

铜币
14
发表于 2022-7-6 10:43:06 | 显示全部楼层
Hi all,
Would it be possible to have a little help or nudge in the right direction amending this routine to search all open drawings for the prefix rather than only the current drawing?
I’ve been experimenting with the following code.
 
(defun c:sample ( / OpenDwgs eachDwg)
(setq OpenDwgs (vla-get-documents (vlax-get-acad-object)))
(vlax-for eachDwg OpenDwgs
(princ "Count")
(princ)
) ;_ end vlax-for
) ;_ end defun
 
Reading associated posts I believe this will only effectively count the open drawings not make them active for the select all.
Any help gratefully received.
Regards
John
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-7 03:17 , Processed in 0.502904 second(s), 66 queries .

© 2020-2025 乐筑天下

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