Author Topic: Need some help with a macro  (Read 2462 times)

0 Members and 2 Guests are viewing this topic.

craigr

  • Guest
Need some help with a macro
« on: August 23, 2012, 10:17:50 AM »
I want to create a macro to change an EXISTING Rectangle to a width of .02 then change it to an EXISTING Layer called 'RED'.

I can make a macro to change a NEW Rectangle, but cannot make one to work on an Existing Rectangle.

Here is what I have so far - ^C^C_pedit;\w;.02;;change;Previous;;p;la;red;;

It doesn't error out, but all it does is change the Rectangle to .02 width.

I also tried the word 'Last' in place of 'Previous' and it still doesn't work.

Do any of you see what I am missing?

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Need some help with a macro
« Reply #1 on: August 23, 2012, 10:29:50 AM »
It's working for me in MEP 2011.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

craigr

  • Guest
Re: Need some help with a macro
« Reply #2 on: August 23, 2012, 10:32:14 AM »
Well!!

I just now closed CAD and opened another file then tried it and it still only does the changing to .02.

I don't get it.

M-dub

  • Guest
Re: Need some help with a macro
« Reply #3 on: August 23, 2012, 11:04:14 AM »
when you click on your button and AutoCAD finishes doing what it does... hit F2 and copy and paste into here, everything up to the point where you clicked the button (_pedit).

craigr

  • Guest
Re: Need some help with a macro
« Reply #4 on: August 23, 2012, 11:10:24 AM »
I see that. I use that to trouble shoot macros before. But with the 'Last' in the macro, it doesn't error out.

It's like the macro runs fine, but it doesn't change the Layer.

I've run into problems with the 'Last' and 'Previous' parts before on another macro, a LONG time ago, but don't remember how I solved it. Nor do I remember the macro that I can borrow it from.

M-dub

  • Guest
Re: Need some help with a macro
« Reply #5 on: August 23, 2012, 11:15:10 AM »
The layer is called RED (and I'm sure the colour of that layer is red as well), but when you select the rectangle, is the colour set to BYLAYER or to some other colour?

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Need some help with a macro
« Reply #6 on: August 23, 2012, 11:15:40 AM »
Try this Craig:

Code: [Select]
^C^C_.select;\_.change;_p;;_p;_la;red;;_.pedit;_m;_p;;_w;0.02;;

craigr

  • Guest
Re: Need some help with a macro
« Reply #7 on: August 23, 2012, 11:35:49 AM »
MDub, the color is ByLayer. At the end of my Review Process, I set everything in the Dwg to Bylayer Color thru a Batch Routine. So, If I want something to stay Red, I put it on a Layer called RED.

Lee Mac - Thanks for the Macro, it is ALMOST perfect for me. The only thing I would like to get rid of is having to right-click after I select the Rectangle. Like in the following OLD Macro that I have -

*^C^C_snap;off;Change;\;p;c;Red;;

I don't understand what the '  .  ' is in your macro, what is it for?

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Need some help with a macro
« Reply #8 on: August 23, 2012, 11:42:49 AM »
Lee Mac - Thanks for the Macro, it is ALMOST perfect for me. The only thing I would like to get rid of is having to right-click after I select the Rectangle.

You're welcome Craig  :-)

The macro I posted previously allows you to change multiple polylines via a window selection, but if you are instead looking for a single pick selection, try:

Code: [Select]
^C^C_.change;\;_p;_la;red;;_.pedit;_m;_p;;_w;0.02;;
I don't understand what the '  .  ' is in your macro, what is it for?

The point "." prefix ensures that the standard version of a command is used and not a possible redefinition of the command.

craigr

  • Guest
Re: Need some help with a macro
« Reply #9 on: August 23, 2012, 11:45:37 AM »
Ding, Ding, Ding!!!

That's perfect! Thanks alot for doing this for me.

I'll buy you a donut next time you are in Omaha, NE

craigr

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Need some help with a macro
« Reply #10 on: August 23, 2012, 12:15:51 PM »
I'll buy you a donut next time you are in Omaha, NE

I look forward to it  :lol:

Will you also pay for my flight across the pond?  :evil:

craigr

  • Guest
Re: Need some help with a macro
« Reply #11 on: August 23, 2012, 12:18:00 PM »
I always love the way you folks call it a 'Pond'.

Being in the Middle of the U.S., to ME it's an OCEAN!!

:)

Where are you over there?

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Need some help with a macro
« Reply #12 on: August 24, 2012, 07:46:50 AM »
I always love the way you folks call it a 'Pond'.

Being in the Middle of the U.S., to ME it's an OCEAN!!

:)

 :-D

Where are you over there?

I'm based on the outskirts of London, England  :-)

craigr

  • Guest
Re: Need some help with a macro
« Reply #13 on: August 24, 2012, 07:56:55 AM »
Isn't this Internet thingy GREAT!!

I'm soooo Glad that Al Gore invented it!!!

:)