Need macro to insert a block and rotate

Need macro to insert a block and rotate

Ajohnson0
Contributor Contributor
1,521 Views
6 Replies
Message 1 of 7

Need macro to insert a block and rotate

Ajohnson0
Contributor
Contributor

At my workplace we have custom toolbars and buttons to insert blocks and upon insertion I pick a point and then it has me rotate them. Basically I copied one of these buttons and changed the macro to the new layer and block name

 

Example

Old:

^C^C-LAYER;SET;hvMb11-6;;-INSERT;HVMB11-6;\;;

 

New:

^C^C-LAYER;SET;Column_lock;;-INSERT;COLUMN_LOCK;\;;

 

What I don't understand is why the the block even asks for me to rotate as I don't see it in the macro. YES I AM A INEXPERIENCED with macros.

 

I would like to be able to insert the block,pick the rotation and then possibly move (slide) the block along the axis of the new angle if possible.

 

This is my first time using screencast so hopefully it will demonstrate what I am trying to get across. In the first part of the video I insert the block with the rotation option and the second part is the one I am trying to create.

 

 

0 Likes
Accepted solutions (1)
1,522 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution

Open the blocks in block-editor to see whether is Scale-Uniformly property checked or not.

 

+1 for Screencast. But next time shrink the window a bit... Screencast can't capture so large screen and the video is then shrunk in resolution. See my video HERE  where I'm showing the difference between Scale-Uniformly yes/no. 

So am I having too large monitor, so I shrunk it a bit.

0 Likes
Message 3 of 7

Ajohnson0
Contributor
Contributor

I am not sure what you mean

0 Likes
Message 4 of 7

pendean
Community Legend
Community Legend
CTRL+F2 to see the macro actions wehat prompt if any you might not be seeing.

OR If you simply typed out what you wrote in your macro at the commandline to test, does it work? Looks like your layer and block names are the same too?
0 Likes
Message 5 of 7

Kent1Cooper
Consultant
Consultant

@Ajohnson0 wrote:

.... What I don't understand is why the the block even asks for me to rotate as I don't see it in the macro. ....


The two semicolons at the end of the macros are Enters, accepting the default X & Y scale factors of 1.  The macros then leave you in the command at that point, so it's just the rest of the Insert command's operation that is asking for the rotation, not the macro.

 

If you want to include more in the macro's operation, you could put a backslash-for-user-input after those semicolons, under which you will specify the rotation, and [assuming no Attributes for which values will then be wanted] then continue with something else, for example:

^C^C-LAYER;SET;Column_lock;;-INSERT;COLUMN_LOCK;\;;\MOVE;L;;

 

... and follow that with inputs about exactly how you want to Move it.  [There should be a way to set the Snap Angle to match the Block just Inserted, and turn Ortho on, to limit the Move direction for your sliding, but I'd need to work that out -- it would probably involve an AutoLisp expression, some but not all of which are usable in macros.  And you would need to be using full AutoCAD, not LT -- is that your situation?]

Kent Cooper, AIA
0 Likes
Message 6 of 7

Ajohnson0
Contributor
Contributor

I do have the full version

0 Likes
Message 7 of 7

Kent1Cooper
Consultant
Consultant

Then something like this may work:

 

^C^C-LAYER;SET;Column_lock;;-INSERT;COLUMN_LOCK;\;;\(setvar 'snapang (cdr (assoc 50 (entget (entlast)))));ORTHO;ON;MOVE;L;;@;\(setvar 'snapang 0)

 

I didn't set up the situation to test it.  It should : set the Snap angle to match the Block rotation; turn Ortho on; start a MOVE command selecting the Block, with its insertion point as the displacement base point, you give it the other end of the Move [the last \]; set the Snap angle [presumably back] to 0.

 

It doesn't turn Ortho off, because it may have been on already -- to get more sophisticated control of things like that [including saving and restoring not just Ortho but also the starting Snap angle and current Layer], an AutoLisp routine would probably be better.

 

That Ortho-on approach would let you Move it perpendicular to the Block-rotation direction as well as parallel to it.  If you want to limit it to only parallel, that can also be done, with some additional code [and wouldn't even require rotating the Snap angle].

Kent Cooper, AIA
0 Likes