broncos15 发表于 2022-7-5 16:40:09

Lee Mac Steal Routine - Using

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
(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?

Lee Mac 发表于 2022-7-5 17:00:25

Per this explanation -

(if (not (tblsearch "layer" dlayc))   (Steal "C:\\My Folder\\MyDrawing.dwg" (list (list "Layers" (list dlayc)))))

broncos15 发表于 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.

BIGAL 发表于 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.

tombu 发表于 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:
^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:
^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!

Lee Mac 发表于 2022-7-5 17:42:24

Thank you all for the positive feedback - I'm glad it's proving useful!
页: [1]
查看完整版本: Lee Mac Steal Routine - Using