Print Page | Close Window

insert block command

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=10698
Printed Date: 07.Sep.2026 at 08:59


Topic: insert block command
Posted By: decastro31
Subject: insert block command
Date Posted: 25.Sep.2014 at 17:36
Hi, I'm trying to create an icon for my ribbon that I will be able to click and it will insert a certain block. I think that I need to create a command that will get the block that I need and insert it where I need it to go as for an example, I have created a block for a pipe going down. I would like to click the icon and to place the elbow of this pipe to show a pipe going down on plan.

thank you in advance for the help.



Replies:
Posted By: John Connor
Date Posted: 25.Sep.2014 at 17:54
It could be accomplish with a macro that invokes the INSERT command.  The macro would include the path to and name of the block. 

Will you be entering the same block multiple times in succession?

Will you be changing the X scale factor?

Will you be changing the Y scale factor?

Will you be changing the angle of rotation?


-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: decastro31
Date Posted: 25.Sep.2014 at 18:14
I would like to click the icon to insert 1 block, so if I need to insert 2 or 3 I would need to click every time I need that specific block. for the x and y factor I would like it to scale together, so that if I scale to 100, they will both scale to 100 but I think I can fix that directly in the block. and for the rotation I would like set it every time I insert the block.


Posted By: John Connor
Date Posted: 25.Sep.2014 at 18:29
The macro could be made to be self-repeating.

The default is if the X scale factor is changed then AutoCAD assumes the Y scale factor will be changed to the same value.

Rotation could be changed upon insertion too.

Your macro might look similar to this....

*^C^C-INSERT;yourblockname;\;;;


-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: decastro31
Date Posted: 25.Sep.2014 at 19:01
and for this to work, do I need to insert the block once in the drawing or do I need to put it in a certain folder of autodesk for it to find it. or do I need to mark the path of the block in this macro ? and thank you very much for your time and help.


Posted By: decastro31
Date Posted: 25.Sep.2014 at 19:21
I have found the problem, I added the Block folder on the path options and the macro you gave me works like a charm! it inserts right away ! now is there a way to make me ask after I give it an insert point what scale I want ? I can set it in properties but it will make the command that much more perfect for me :)


Posted By: John Connor
Date Posted: 25.Sep.2014 at 19:43
The < \ > symbol is a pause for user input whereas the < ; > symbol acts like a return (i.e. - hitting the Enter key).  I'm pretty sure that's correct.


-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>



Posted By: Kent Cooper
Date Posted: 26.Sep.2014 at 15:33
Originally posted by decastro31 decastro31 wrote:

... is there a way to make me ask after I give it an insert point what scale I want ? I can set it in properties but it will make the command that much more perfect for me :)
 
The first backslash in that macro is the pause for the User to specify the insertion point.  The first semicolon after that is an Enter to accept the default X scale factor of 1.  If you just change that semicolon to a backslash, it will ask the User for the X scale factor, and will follow with Enters accepting the defaults for the Y scale factor and Rotation.
 
Alternatively, you can use the Scale option, which will apply the same factor in all axes, and since it is an option you use before the insertion point, it has the advantage that you get to drag the Block into position with it showing already scaled:
 
*^C^C-INSERT;yourblockname;S;\\;
 
The first backslash is for User input of the Scale factor, the second is for the insertion point, and the final semicolon is an Enter for the default Rotation of 0.  If you also want to specify the Rotation each time, and have it already rotated as well as scaled while you drag it into position, also use the Rotation option:
 
*^C^C-INSERT;yourblockname;S;\R;\\
 
In fact, you can shortcut that, and have it simply leave you in the command to finish up with the rotation and insertion, rather than having the pauses explicitly built into the macro for those:
 
*^C^C-INSERT;yourblockname;S;\R


Posted By: decastro31
Date Posted: 26.Sep.2014 at 16:49
I have used *^C^C-INSERT;block name;S; so I click on my icon I decide on the scale then I click where I need the block then I rotate. exactly what I needed to do. this will cut the time of making my plans in half. I couldn't  of done without both of your help. thank you so much this makes my life a lot easier and I always love to learn new stuff :)

thank you again ! 


Posted By: decastro31
Date Posted: 26.Sep.2014 at 16:51
Now what is left to do is to find a way to create an image for those small icons :)



Print Page | Close Window