Jump to content

Recommended Posts

Posted

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?

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

Posted

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?

Posted
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.

Posted

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") 

Posted

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? :)

Posted

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.

Posted

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 :)

Posted

Did you try the code in my last post?

Posted

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

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

 

Happy to help. :beer:

Posted
Why not set them up on a tool palette?

 

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

Posted

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.

Posted

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

Posted

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 :)

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...