Jump to content

Lee Mac Steal Routine - Using Variables


broncos15

Recommended Posts

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?

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...