Hello I have a template that already has all the blocks that i need in it. But I don't to copy paste each block to different multiple location because of the size of the work. Sometimes i have a ten miles job and everytime i got to insert a block i have to go back to begining of my drawing then copy that block and paste on the different location.
What I need is Lisp command that I can just type like FH in the command box and it will insert that block to the point where i want it to be. Any help will be appreciated
If it's the most recently-Inserted Block, Insert + Enter to accept the default Block name will do.
But there are several ways to do it otherwise. You could make an icon/button that contains a macro:
^C^C-INSERT YourBlockName
which would leave you at the insertion-point prompt in the Insert command [with the other available options if you want any]. It could be expanded to take you to a specific Layer, build in scale factors and/or rotation if appropriate, etc.
And a command could be defined -- in simplest terms:
(defun C:FH ()
(command "_.insert" "YourBlockName")
)
which [as with the macro] would likewise leave you at the insertion-point prompt, but could also be made fancier.
no it could be any block because i work with a lot of block that is why i want to someone to help creating this. all want it to be able to do is type FH for one block and select where it goes instead of either coping that block from the beginning or typing insert then select the block then clicking ok
@Anonymous wrote:
no it could be any block because i work with a lot of block that is why i want to someone to help creating this. all want it to be able to do is type FH for one block and select where it goes instead of either coping that block from the beginning or typing insert then select the block then clicking ok
I think I edited my reply to include a command definition while you were writing/posting the above -- check the (defun C:FH ... suggestion there now.
omg thanks that did work i have 1 more questions after i do that i have block to 3 different scales i use 30, 50, and 100 scale i'm not able to make it the right scale is there a way so i can bring to any of the scales
@Anonymous wrote:
omg thanks that did work i have 1 more questions after i do that i have block to 3 different scales i use 30, 50, and 100 scale i'm not able to make it the right scale is there a way so i can bring to any of the scales
If the Blocks are drawn at a scale of 1 representing their plotted-on-paper size, and those scales are used in different drawings in which they are [typically] in the DIMSCALE System Variable, then you can do this:
(defun C:YourCommandName ()
(command "_.insert" "YourBlockName" "_scale" (getvar 'dimscale))
)
Others could help you better than I if an annotative-scaled Block is appropriate [I haven't had a newer version with that possibility long enough to have gotten used to how it works yet].
explore ADCENTER command
it will show you a small image of your block (at your current position) and let you insert it
Hi again,
I have another question. I got the first part good i'm able to insert a block just by typing that FH. Now I wanted to know how can i make to block to come in in 1 scale because right now it comes to 0 scale?
Also is there a way that i can tell it which layer the block to be under?
Thanks
@Anonymous wrote:
.... Now I wanted to know how can i make to block to come in in 1 scale because right now it comes to 0 scale?
Also is there a way that i can tell it which layer the block to be under?
....
If you are using the one that uses the DIMSCALE System Variable to scale the Block, and that can sometimes be zero, you can do it this way, to force it to 1 in that case, but otherwise use whatever the non-zero value is:
(defun C:YourCommandName ()
(command "_.insert" "YourBlockName"
"_scale" (if (= (getvar 'dimscale) 0) 1 (getvar 'dimscale))
); command
); defun
For the Layer, there are several ways you can do that. Perhaps the simplest, if you're using a (command) function anyway for the Insert, is to include a Layer command inside that first:
(defun C:YourCommandName ()
(command
"_.layer" "_set" "YourLayerName" ""
"_.insert" "YourBlockName" "_scale" (if (= (getvar 'dimscale) 0) 1 (getvar 'dimscale))
); command
); defun
But there are other ways, too, such as to use (setvar 'clayer ....) instead of a Layer command, or to Insert the thing and afterwards change its Layer with CHANGE or CHPROP, or if you don't need to visually drag it into place, use (entmake) instead of an Insert command, which can include a Layer name, even other than the current one.
The above leaves you in that Layer. You will find multitudinous routines on these Forums that will save the current Layer name first, set it to what's appropriate for the routine, and when finished, reset it to what it was before. Poke around a little.
thanks that work perfectly you have no idea how long i look, now i will do this for my other commands thank you very much