Tuesday, March 22, 2011

AutoCAD 2012: GIS/Pipeline People to Breathe a Sigh of Relief with Enhanced Raster File Support

If you have ever worked with heavy raster images in AutoCAD, you know very well how painful the experience is. Especially for those people working with huge aerial / satellite imagery, it is nearly impossible to use TIF image format to represent a large area due to huge image file size. This is why compressed image formats like ECW (Enhanced Compression Wavelet), MrSID (Multiresolution Seamless Image Database) etc. are highly popular among these people.

The compressed images files are comparatively very small in size and are easy to handle inside AutoCAD drawings. These images required additional installation of plug-ins/object enablers prior to AutoCAD release 2012. The good news is that from 2012 onwards, these file formats are natively supported in AutoCAD, thereby requiring no additional installations. Here is a complete list of newly supported raster files.




Monday, March 21, 2011

A Simple Macro for Switching Between Rectangular and Isometric Snaps

Have you had the habit of working on isometric drawings frequently? I do a lot of isometric drawings during my work. While doing these drawings, you may need to switch between rectangular and isometric snaps several times. Here is a simple macro to easily switch between these snap modes.

^C^C_setvar;SNAPSTYL;$M=$(if,$(=,$(getvar,SNAPSTYL),0),1,0)

I found a similar macro commented by Kate Morrical in her own blog LT Unlimited. Here goes Kate's version.

$M=$(if,$(=,$(getvar,SNAPSTYL),1),SNAPSTYL;0;;,SNAPSTYL;1;;)

Thanks Kate, for the handy macro.

Friday, November 26, 2010

Sharing Raster Files? Convert Them to Easily Viewable Formats Using Autodesk Design Review

Here is another reason for you to have Autodesk Design Review installed on your desktop. In a previous post, you saw how to use Autodesk Design Review as your default viewer for raster files. What if somebody else – for example, somebody from top management or a subcontractor - who doesn’t have Autodesk Design Review or any other raster file viewers installed on their system wants to review the raster design files? Don’t worry about installing the viewers everywhere. We can easily convert these files to PDF or TIF files using Autodesk Design Review.

Open Autodesk Design Review application on your desktop. Make sure that the ‘List View’ and ‘Thumbnails’ palettes are switched on in the ‘Show/Hide Palettes’ ribbon menu.

Raster2PDF_01

Raster2PDF_02

Open windows explorer and select raster files you wish to convert (use Ctrl+A for in case want you select all the files in the folder).

Raster2PDF_03

Now drag and drop them inside the ‘List View’ window / Thumbnail window.

Raster2PDF_04
You can drag the files inside the list view to arrange them in the proper order.

Raster2PDF_05

Use the ‘Thumbnail’ tab, if you want to preview while arranging them in order.

Raster2PDF_06

Select all the files in the ‘List View’ or ‘Thumbnails’ palette and right click to choose ‘Print’ option in the popup menu.

Raster2PDF_07

In the print dialog box, select the PDF writer of your choice (I use CutePDF writer which is really nice and free). Your can also use common printers like ‘Microsoft Document Image Writer’ to get a multipage TIF document output. Don’t forget to select ‘Choose paper source by DWF page size’ in the ‘Page Handling' section, if you want to preserve original sheet sizes. The print range will be selected ‘All’ by default. Ignore the print range shown in the image as I selected ‘Current sheet only’ option by mistake while taking the snapshot :-).

Raster2PDF_08

That’s it. Now your uncommon raster file formats are ready to be shared with most of the people around you. Trust me; Autodesk Design Review is worth more than a free design review application. Go and grab it right now from Autodesk site for free of cost!

Monday, October 11, 2010

An Easy Way to Publish Drawings from Different Folders

How do you publish drawings from different folders? Do you navigate to each folder from the publish dialog box for selecting files? That sounds really painful. Don’t worry; a simple drag and drop trick can ease your pain.

I will show you the method to accomplish this with the help of a sample folder structure. The following image shows a sample root folder with 5 different project folders.

Drag_n_Drop_Publish_01

Each folder contains different drawing files. For publishing all the drawings in a single stretch, follow the steps as given below.

  • Click on the root folder (‘Sample’ in this case) and hit the search button on the toolbar.
  • Type *.dwg to list all the drawings under the root folder and subfolders.

Drag_n_Drop_Publish_02

  • Invoke the publish dialog box inside AutoCAD.
  • Press Ctrl+A to select all files or use Ctrl/Shift + Left Mouse Click to select only desired files in the explorer search window.
  • Now drag and drop the selected files to the publish dialog box. That’s it! You are done with selecting multiple files from multiple folders.

Drag_n_Drop_Publish_03

Try that and you will come to know that it is as simple as any other AutoCAD drag & drop operations.

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 :-)

Saturday, September 26, 2009

Extracting 3D DWF Model Properties Using Autodesk Design Review API and AutoCAD VBA

A while ago I came across a situation where I had to extract line lists, valve lists, equipment lists and fittings lists from a DWF file. The DWF file was converted from a PDS model review file (DRI) using NavisWorks. After a few hours research on Autodesk Design Review API, I could extract all the required lists with a few lines of code. Ofcourse, with the help of fast dying AutoCAD VBA.

As the code makes use of CExpressViewerContol, you need to place it inside a form before running the code. You may use any COM compliant development environment in place of AutoCAD VBA. But I would like to stick to AutoCAD VBA till its last breath due to ease of use.

Sub ExtractDwfProps()
'### Extracts properties from model components of a 3D DWF file
'### By zoomharis@gmail.com
'### Date: 09/09/09

'### Based on Autodesk Design Review 2010 API

'### DWF specific references
' -----------------------
'### AdCommon 1.0 Type Library
'### ECompositeViewer 1.0 Type Library
'### ExpressViewerDll 1.0 Type Library

'### DWF specific controls
' ---------------------
'### CExpressViewerContol

On Error Resume Next
Dim oECV As ECompositeViewer.IAdECompositeViewer
Dim oSec As ECompositeViewer.IAdSection
Dim oEnt As AdCommon.IAdObject
Dim oProp As AdCommon.IAdProperty
Dim oCol As AdCommon.CAdCollection
Dim oCont As ECompositeViewer.IAdContent
Dim strDwfLoc As String
Dim strPropName As String
Dim strPropValue As String
'## Let me use a sample 3D dwf file
strDwfLoc = "C:\Dwf\3DModel.dwf"
strPropName = ""
strPropValue = ""
'## Open the dwf file in the viewer
CExpressViewerContol1.SourcePath = strDwfLoc
Set oECV = CExpressViewerContol1.ECompositeViewer
'## Iterate through the dwf model
For Each oSec In oECV.Sections
Set oCont = oSec.Content
Set oCol = oCont.Objects(0)
For Each oEnt In oCol
For Each oProp In oEnt.Properties
strPropName = oProp.Name
strPropValue = oProp.value
Next
'## Write code here to apply conditions to filter the list
'## and send the extracted info into a text or excel file.
'## Then clear the property name and property value strings
strPropName = ""
strPropValue = ""
Next
Next
Set oProp = Nothing
Set oEnt = Nothing
Set oCol = Nothing
Set oCont = Nothing
Set oSec = Nothing
Set oECV = Nothing
End Sub

I have stripped down some of the code portion as it was specific my purpose. This is mostly in a general form and you may need to add/modify wherever necessary in order to run it in your system.