AutoCAD 2010/2011/2012

AutoCAD 2010/2011/2012

Reply
Distinguished Mentor
steven-g
Posts: 576
Registered: ‎05-11-2009
Message 11 of 17 (225 Views)

Re: Align a block with 2 points on a line

09-04-2012 10:44 PM in reply to: MarianoAiello6402

How about a macro

^C^Ci;"Block Name";\;1;;0;ro;l;;$M=$(getvar,lastpoint);r;$(getvar,lastpoint);\\

This will insert the named block with the base point at the point you select it will then rotate the block to align the second point you pick (on the block) with a third point (on the object you wish to align with).

 

If you change the above to

^C^Ci;\\;1;;0;ro;l;;$M=$(getvar,lastpoint);r;$(getvar,lastpoint);\\

Then at the start it will ask you for the block name - no dialogue box - names with spaces will need entering with quotes.

 

This might not be your ideal solution but hopefully will give you something to work with as an alternative to dynamic blocks

Regards Steven Gray
Setting Out (Joinery Manufacturing)
Autocad 2013LT
Windows 7 professional
Active Member
MarianoAiello6402
Posts: 7
Registered: ‎12-08-2010
Message 12 of 17 (180 Views)

Re: Align a block with 2 points on a line

09-27-2012 04:33 AM in reply to: steven-g

Hi guys,

 

I've bean out off the office.

I've tried to make this macro but I keep getting error messages.

Can you tell me how I have to make this makro.

 

thanks

Distinguished Mentor
steven-g
Posts: 576
Registered: ‎05-11-2009
Message 13 of 17 (176 Views)

Re: Align a block with 2 points on a line

09-27-2012 05:24 AM in reply to: MarianoAiello6402

First off, what are you doing and what are the error messages you get.

Regards Steven Gray
Setting Out (Joinery Manufacturing)
Autocad 2013LT
Windows 7 professional
Active Member
MarianoAiello6402
Posts: 7
Registered: ‎12-08-2010
Message 14 of 17 (173 Views)

Re: Align a block with 2 points on a line

09-27-2012 05:32 AM in reply to: steven-g

I have copied the text from earlier message and pasted it in.

 

Menu / Manege / VBA manager / I choose Macro and create a new one / now I get the visual basic editor that begins

with  

Sub nameofmacro()

here is where I have pasted the text
End Sub

 

I get errors : compile error

Distinguished Mentor
steven-g
Posts: 576
Registered: ‎05-11-2009
Message 15 of 17 (161 Views)

Re: Align a block with 2 points on a line

09-27-2012 10:16 PM in reply to: MarianoAiello6402

I use Autocad LT so no VBA, but I think that is something else, anyway without going into a long post on creating a new command with the CUI, here is a quick and dirty method just to see if it works. In your toolpallete right click on any tool and pick copy, then right click in an empty area on your toolpalette and choose paste, next right click on the new tool and select properties, in the tool properties box fill in a new name then copy the macro into the 'command string' section replacing what is already there. Click on ok then just click on the new tool to try it out. Don't forget to change the Block Name.

If it works as you would like then, it would be a good idea to look up creating a new command using CUI

Regards Steven Gray
Setting Out (Joinery Manufacturing)
Autocad 2013LT
Windows 7 professional
Active Member
MarianoAiello6402
Posts: 7
Registered: ‎12-08-2010
Message 16 of 17 (156 Views)

Re: Align a block with 2 points on a line

09-28-2012 12:30 AM in reply to: steven-g

Thanks that works, now I just have to find the correct macro :smileyfrustrated:

Distinguished Mentor
steven-g
Posts: 576
Registered: ‎05-11-2009
Message 17 of 17 (153 Views)

Re: Align a block with 2 points on a line

09-28-2012 12:39 AM in reply to: MarianoAiello6402

If it works as you want, then the next question is how do you want to use it. What method do you want to use to start the command.

Regards Steven Gray
Setting Out (Joinery Manufacturing)
Autocad 2013LT
Windows 7 professional
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.