need macro code

need macro code

Anonymous
Not applicable
392 Views
6 Replies
Message 1 of 7

need macro code

Anonymous
Not applicable
Hi, Since Autocad has not seen fit to add a macro recorder to their program, I was wondering if anyone could give me a little help writing one. I'm using Autocad 2007.

What I have is a grid of blocks (269 of them) on one layer. Each block is 10m by 10m by 12m deep. Each block is identical except for a unique integer in the attribute 'NO'. On other layers are other objects (sample location blocks, underground pipes and foundations, etc.) left on the site.

Once I have the proper layers turned on and everything else off, what I would like when running the macro is to have a dialog box come up with the following:

Initially, a label at the top with instructions ("Select grids to move then hit Enter.") Beside this a command button to send the user to the drawing. Here the user will select all the grid blocks to perform a 3D Move (by displacement) on, then will hit Enter. If none are selected before Enter then exit sub.

Once done and the user hits Enter, the dialog box re-appears.

Below the label a text box displaying all the grid blocks selected.

Next the user is asked to select the color to change the selected grid blocks. A command button to bring up the Select Color box.

Next will be a label asking for the distance to move the grid blocks and an input textbox to type in the number.

Finally at the bottom an OK and Cancel buttons. The OK button will then transfer control back to the code to perform the tasks. Oh, any of the objects on the other layers that fall within the selected grid blocks should also be moved (but not re-colored) when the grid blocks are moved.

I am a little familiar with VB code but not in relation to Autocad. And Lisp looks like total Greek to me.

Thanks.
0 Likes
393 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
create your user form with whatever controls you want
create subs or functions to carry out the actions you need
call the subs / function in your click_events or other appropriate events
look at the acad object model under help|additional Resources| Developer
Help
that will give you all the info on the com api acad exposes and should get
you going
look up Selection sets for user selection issues
don't forget error trapping on all user input
when you get stuck post back with specific questions and I'm sure someone
will be able to help

hth
mark

wrote in message news:5981954@discussion.autodesk.com...
Hi, Since Autocad has not seen fit to add a macro recorder to their program,
I was wondering if anyone could give me a little help writing one. I'm using
Autocad 2007.

What I have is a grid of blocks (269 of them) on one layer. Each block is
10m by 10m by 12m deep. Each block is identical except for a unique integer
in the attribute 'NO'. On other layers are other objects (sample location
blocks, underground pipes and foundations, etc.) left on the site.

Once I have the proper layers turned on and everything else off, what I
would like when running the macro is to have a dialog box come up with the
following:

Initially, a label at the top with instructions ("Select grids to move then
hit Enter.") Beside this a command button to send the user to the drawing.
Here the user will select all the grid blocks to perform a 3D Move (by
displacement) on, then will hit Enter. If none are selected before Enter
then exit sub.

Once done and the user hits Enter, the dialog box re-appears.

Below the label a text box displaying all the grid blocks selected.

Next the user is asked to select the color to change the selected grid
blocks. A command button to bring up the Select Color box.

Next will be a label asking for the distance to move the grid blocks and an
input textbox to type in the number.

Finally at the bottom an OK and Cancel buttons. The OK button will then
transfer control back to the code to perform the tasks. Oh, any of the
objects on the other layers that fall within the selected grid blocks should
also be moved (but not re-colored) when the grid blocks are moved.

I am a little familiar with VB code but not in relation to Autocad. And Lisp
looks like total Greek to me.

Thanks.
0 Likes
Message 3 of 7

Anonymous
Not applicable
"MP" wrote in message
news:5982028@discussion.autodesk.com...
create your user form with whatever controls you want
create subs or functions to carry out the actions you need
call the subs / function in your click_events or other appropriate events
look at the acad object model under help|additional Resources| Developer
Help
that will give you all the info on the com api acad exposes and should get
you going
look up Selection sets for user selection issues
don't forget error trapping on all user input
when you get stuck post back with specific questions and I'm sure someone
will be able to help

hth
mark

wrote in message news:5981954@discussion.autodesk.com...
Hi, Since Autocad has not seen fit to add a macro recorder to their program,
I was wondering if anyone could give me a little help writing one. I'm using
Autocad 2007.

What I have is a grid of blocks (269 of them) on one layer. Each block is
10m by 10m by 12m deep. Each block is identical except for a unique integer
in the attribute 'NO'. On other layers are other objects (sample location
blocks, underground pipes and foundations, etc.) left on the site.

Once I have the proper layers turned on and everything else off, what I
would like when running the macro is to have a dialog box come up with the
following:

Initially, a label at the top with instructions ("Select grids to move then
hit Enter.") Beside this a command button to send the user to the drawing.
Here the user will select all the grid blocks to perform a 3D Move (by
displacement) on, then will hit Enter. If none are selected before Enter
then exit sub.

Once done and the user hits Enter, the dialog box re-appears.

Below the label a text box displaying all the grid blocks selected.

Next the user is asked to select the color to change the selected grid
blocks. A command button to bring up the Select Color box.

Next will be a label asking for the distance to move the grid blocks and an
input textbox to type in the number.

Finally at the bottom an OK and Cancel buttons. The OK button will then
transfer control back to the code to perform the tasks. Oh, any of the
objects on the other layers that fall within the selected grid blocks should
also be moved (but not re-colored) when the grid blocks are moved.

I am a little familiar with VB code but not in relation to Autocad. And Lisp
looks like total Greek to me.

Thanks.
0 Likes
Message 4 of 7

Anonymous
Not applicable
Ok, I'll see what I can do.
0 Likes
Message 5 of 7

Anonymous
Not applicable
I've tried your macro recorder by both running it and going through it in step mode.

In run mode nothing appears to happen. It doesn't ask me for input or give any indication that something is happening.

In step mode I see it go through the initializing steps then the yellow highlight goes away. There's nothing on the code screen or the drawing window that indicates anything. If I step one more time it starts over from the beginning with initializing.

There aren't any comments or instructions specifying what to do. What am I missing? I'd like to make it work. TIA.

bc
0 Likes
Message 6 of 7

Anonymous
Not applicable
Load the application, then run the Record method. Then draw an entity [i.e.
circle, line, etc] You will be prompted to enter a name for the macro that
is generated. Then look in the "NewMacros" module for your macro to create
the entity you just drew.

Joe ...


wrote in message news:5982212@discussion.autodesk.com...
Ok, I'll see what I can do.
0 Likes
Message 7 of 7

Anonymous
Not applicable
Yes, it works fine if I want to draw a circle or line but it only does what you've pre-defined it to do (ie, circle, line, arc, ellipse, point, polyline, ray, spline, MText or text).

Plus I don't think it's recording code at all. You've got all the code already written as text strings that your macro just copies over into a new module and uses coordinates the user clicks on the screen.

To do as I've described above it doesn't seem to work. I was hoping for something that actually would record "whatever" the user did on screen. A lot of the time using the help file is confusing so studying actions recorded helps to make things like syntax and allowed code a lot clearer.

bc
0 Likes