broncos15 Posted February 21, 2017 Share Posted February 21, 2017 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? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 21, 2017 Share Posted February 21, 2017 Per this explanation - (if (not (tblsearch "layer" dlayc)) (Steal "C:\\My Folder\\MyDrawing.dwg" (list (list "Layers" (list dlayc)))) ) Quote Link to comment Share on other sites More sharing options...
broncos15 Posted February 21, 2017 Author Share Posted February 21, 2017 Per this explanation - (if (not (tblsearch "layer" dlayc)) (Steal "C:\\My Folder\\MyDrawing.dwg" (list (list "Layers" (list dlayc)))) ) 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 22, 2017 Share Posted February 22, 2017 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. Quote Link to comment Share on other sites More sharing options...
tombu Posted February 22, 2017 Share Posted February 22, 2017 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! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 22, 2017 Share Posted February 22, 2017 Thank you all for the positive feedback - I'm glad it's proving useful! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.