Thursday, July 15, 2010

A Quick Tip on Publishing Drawings into Individual PDF Files

Recently our designers came across a requirement of publishing drawings into individual PDF files. For those who don’t know, here is the main setting you have to remember while publishing PDF files.

  1. Click on ‘Publish Options’ button inside the Publish dialog box.
  2. Inside the Publish Options window, select type as ‘Single-sheet file’ instead of ‘Multi-sheet file’ in the ‘General DWF/PDF options’ as shown in the image below.

Publish_Single

Rest of the publish settings shall be same as publishing multiple PDF files. This tip might be familiar to most of you. Well, I have another tip for you to handle post publish PDF file names using windows command prompt. Using REN command with a combination of wildcard characters, you can easily rename the PDF files to standard names. For example, you would like to rename ‘Drawing_xxx-Model.pdf’ file to ‘Drawing_xxx.pdf’ format where xxx stands for unique characters. Here is the command for the above scenario.

REN *_???-Model.pdf *_???.pdf

CMD_01

As you can see in the above image, the file names have been modified using a single command line. The wildcard combination may vary from case to case. Have a look at windows commands and command prompt if you have not yet experimented with it. It will definitely help you to handle your day-to-day tasks easily and comfortably.

Thursday, July 8, 2010

A Macro for Aligning Text, MText and Block Entities Horizontally and Vertically in AutoCAD LT

It has been a long time since I made my last post here. I was seriously thinking of dropping the blogging activities, mainly due to lack of unique ideas. But when I received an email request from a AutoCAD LT user for a macro for aligning objects like Text entities, I couldn't resist trying it out and sharing it with you people. My sincere apologies to all readers for leaving such a long gap. That said, to be honest, I don’t have any idea when I am going to publish my next tip over here.

Back to our post topic. These macros can be used to align entities like Text, Mtext, Blocks and literally any object that comes with an insertion base point, both horizontally and vertically.That means you can use this macro to align a Text entity with an MText or Block Reference. The only limitation you will come across is that you will have to select the entities one by one as opposed to selecting all together in AutoLISP or VBA programs.

You have already seen the power of combining DIESEL with the CAL command (I call it DIECAL for ease of use). Once again, I am going to use the power of DIECAL to accomplish our task. Here goes the first macro, used for aligning entities vertically.

*^C^C$M=$(if,$(=,$(getvar,useri5),0),osmode;0;_id;\userr3;'cal;rxof(@);\)useri5;0;select;single;\lastpoint;'cal;ins;@;\userr4;'cal;ryof(@);\userr5;'cal;rzof(@);\useri5;1;_move;p;;'cal;@;'cal;xof([getvar(userr3),0,0])+yof([0,getvar(userr4),0])+zof([0,0,getvar(userr5)]);

For you to get an idea how it works, please find the image below consisting of different types of entities.

Vert_Pre_Align

The next picture illustrates what the align vertical macro can do with these entities.

Vert_Post_Align

With a small modification in the macro, you can use it to align these entities horizontally as well. Here is the modified macro for horizontal alignment.

*^C^C$M=$(if,$(=,$(getvar,useri5),0),osmode;0;_id;\userr4;'cal;ryof(@);\)useri5;0;select;single;\lastpoint;'cal;ins;@;\userr3;'cal;rxof(@);\userr5;'cal;rzof(@);\useri5;1;_move;p;;'cal;@;'cal;xof([getvar(userr3),0,0])+yof([0,getvar(userr4),0])+zof([0,0,getvar(userr5)]);

And here is the illustration of the macro functionality.

Before running the macro.

Horz_Pre_Align

After running the macro.

Horz_Post_Align

These macros have been tested in AutCAD LT 2011 and works fine over there. I hope it will work with previous versions also, at least in the recent versions of AutoCAD LT. If you come across any problems, please feel free to post it here.

Many thanks to Adam for inspiring me to develop this :-)