Jump to content
tomhamlet

So we meet again!

Recommended Posts

tomhamlet

What an extended absence :). But of course there is more to this post.

 

A while back I made an icon so that the drafters in my company could put the right border in the right spot with a click of the mouse. here was my macro:

 

(command ".insert" "I:/borders/11x17" "0,0" "1" "1" "0")

 

This inserts the border on the drawing at coordinates 0,0 at a scale of 1 and a rotation of 0 degrees. But if i wanted to make this where you had to choose an insertion point, how would i go about doing that? my first thought is:

 

(command ".insert" "I:/borders/11x17" "0" "1" "0")

 

is this close?

Share this post


Link to post
Share on other sites
BlackBox
(command ".insert" "I:/borders/11x17" [color="red"]pause [/color]"1" "1" "0") 

Share this post


Link to post
Share on other sites
tomhamlet

thank you!

Share this post


Link to post
Share on other sites
BlackBox
thank you!

 

You're welcome. :)

Share this post


Link to post
Share on other sites
tomhamlet

one more question. If i have a layer named DIMENSION and I would like the tag to come in on that layer no matter what layer I am currently using, can this be done through a macro or does that exceed its limitations?

Share this post


Link to post
Share on other sites
BlackBox
one more question. If i have a layer named DIMENSION and I would like the tag to come in on that layer no matter what layer I am currently using, can this be done through a macro or does that exceed its limitations?

 

This is a common request... You essentially have two options:

 

You can use Command calls in your macro to store the existing layer, set the desired layer, and restore when done, but this lacks error handling if the user hits escape, etc..

 

Or, you can use a LISP routine (macros can call LISP instead of using Diesel), which includes the appropriate error handling.

 

Last, you can use a Visual LISP Reactor, which always set the desired layer based on the use of a specific Command... Not sure if this is good for you here, but I use this for XREFs, Images, etc.. The benefit here, is that no custome command, or macro is required, the user can use Ribbon, Menu, or Keyboard Alias.

Share this post


Link to post
Share on other sites
tomhamlet

so if i was going to go ahead and add it into my macro, would this work:

 

(command ".clayer" "dimension") (command ".insert" "I:/borders/11x17" [color=red]pause [/color]"1" "1" "0") 

Share this post


Link to post
Share on other sites
BlackBox

so if i was going to go ahead and add it into my macro, would this work:

 

(command ".clayer" "dimension") (command ".insert" "I:/borders/11x17" [color=red]pause [/color]"1" "1" "0") 

 

What happens when you try it for yourself? :)

Share this post


Link to post
Share on other sites
BlackBox

If I were going to do this with a Macro, I'd load this LISP code:

 

(defun c:Insert11x17Border (/ *error* layerName oldClayer)
 
 (defun *error* (msg)
    (and oldClayer (setvar 'clayer oldClayer))
    (cond ((not msg))                                                  ; Normal exit
          ((member msg '("Function cancelled" "quit / exit abort")))   ; <esc> or (quit)
          ((princ (strcat "\n** Error: " msg " ** ")))                 ; Fatal error, display it
    )
    (princ)
  )

 (if (tblsearch "layer" (setq layerName "Dimension"))
   (progn
     (setq oldClayer (getvar 'clayer))
     (setvar 'clayer layerName)
     (command "._insert" "I:/borders/11x17" pause "1.0" "1.0" "0.0")
   )
   (*error* (strcat "\"" layerName "\" layer not found"))
 )
 (*error* nil)
)

 

... And use one of the following Macros... This if the LISP file is loaded at Drawing open:

^C^C^PInsert11x17Border ^P

 

... This if demand loading the LISP file the first time the button is hit:

^C^C^P(if (not c:Insert11x17Border)(load "Insert11x17Border.lsp")) Insert11x17Border ^P

 

... Presuming the LISP file name is "Insert11x17Border.lsp" and resides within the SFSP.

Share this post


Link to post
Share on other sites
tomhamlet

i really used it for a set of tags. my company has 9 tags, the tag is a hexagon with a callout number inside 8 of which have arrows in directions in 45 degree intervals. so i made this pallette to make it easier to insert these without having to go through windows explorer everytime. I used the border example because they were closely related with the insert command and i felt using that would be easier to explain, then just associated the "pause" with these new commands.

 

tags.jpg

 

so now they can just hit the button associated with the desired tag.

 

I did try the other macro to change the layer and it works! the only negative side is that the layer stays on dimension, though it is still much easier then what we have been doing, i foresee complaints from these old men :)

Share this post


Link to post
Share on other sites
BlackBox

Did you try the code in my last post?

Share this post


Link to post
Share on other sites
tomhamlet

yes, thank you, with the changes that works perfectly.

Share this post


Link to post
Share on other sites
BlackBox
yes, thank you, with the changes that works perfectly.

 

Happy to help. :beer:

Share this post


Link to post
Share on other sites
SLW210

Why not set them up on a tool palette?

Share this post


Link to post
Share on other sites
tomhamlet
Why not set them up on a tool palette?

 

i did. thats what the picture is of, its the tool palette up close.

Share this post


Link to post
Share on other sites
SLW210

Yes, you set the buttons to insert them on the tool palette, I meant set the blocks up on the tool palette, you can pick the layer to insert on and other properties.

Share this post


Link to post
Share on other sites
BlackBox

Great reminder; I always forget how capable Tool Palettes are.

Share this post


Link to post
Share on other sites
tomhamlet

Oh, yeah that would be a great idea! But like i stated earlier, old men will complain. I gave them the palette, but we decided it needs to be better. :) I think now what we are going with is the an dynamic block. My new task is to make the tag come in on an icon kind of like the icons BlackBox helped me with by providing the lisp. So I can do that, but now they are asking me to add the following: they want to be able to click on the viewport they are working in to set the scale. I see a lot of research in my future :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×