乐筑天下

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

[编程交流] Lee Mac Steal Routine - Using

[复制链接]

95

主题

477

帖子

383

银币

后起之秀

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

铜币
475
发表于 2022-7-5 16:40:09 | 显示全部楼层 |阅读模式
First off, Lee Mac's routine has been extremely useful, and I have made use of it in many of my routines (http://www.lee-mac.com/steal.html). My question is in regards to how to use his routine to search for a layer using a variable, and if that layer doesn't exist in the template file, then to create it. My code section for this so far is
  1. (setq layc (vla-get-layer (setq obj (vlax-ename->vla-object (ssname ss cnt)))))(setq dlayc (strcat "V" (substr layc 2)))(if (not (tblsearch "layer" dlayc))  (Steal    "C:\\My Folder\\MyDrawing.dwg"    '(      (       "Layers"       (dlayc)      )     )  ))
. I haven't figured out how to have it search for the variable. I have tried removing the apostrophe, but this doesn't work. Also, would I make use of the vl-catch-all-apply function to see if the steal function errors out?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 17:00:25 | 显示全部楼层
Per this explanation -
  1. (if (not (tblsearch "layer" dlayc))   (Steal "C:\\My Folder\\MyDrawing.dwg" (list (list "Layers" (list dlayc)))))
回复

使用道具 举报

95

主题

477

帖子

383

银币

后起之秀

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

铜币
475
发表于 2022-7-5 17:07:42 | 显示全部楼层
Thanks Lee! I need to read up more on using the list function and apostrophe, so think you so much for your online resources! I am now fiddling around with the vl-catch-all-error-p and vl-catch-all-apply functions to catch if the steal function can't find something.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:21:27 | 显示全部楼层
Thanks Lee had the need to steal some blocks into about 30 dwgs just did a little 2 line script rather than the 8 steps.
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

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

铜币
260
发表于 2022-7-5 17:30:52 | 显示全部楼层
Cool!  I can use that as well.  I've still got my copies of 1.4 & 1.6 versions as well.
 
I've had a drop-down in my menus and now my Ribbon with macros for adding layouts from my "Layout.dwt" file using macros like:
  1. ^C^C^P(or C:Steal (load "StealV1-6.lsp"))(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "Layout.dwt") '(("Layouts" "11×17"))) .regen
Finally dawned on me with the 1.8 version to use lists of things to Steal instead:
  1. ^C^C^P(or C:Steal (load "StealV1-8.lsp"))(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "Templates.dwt") (list (list "Layouts" (list "11×17")))) .regen
 
Now to add a few more drop downs to my Ribbon.
Thanks again Lee!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 17:42:24 | 显示全部楼层
Thank you all for the positive feedback - I'm glad it's proving useful!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 14:15 , Processed in 0.714553 second(s), 64 queries .

© 2020-2025 乐筑天下

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