SolidWorks Express
CAD Tips for the week of March 8, 2010
 
Live Links: In addition to tables, AutoCAD 2007 added data links, which are dynamic links between tables and Excel spreadsheets >>
Dynamic Duds: Sometimes, a Dynamic Block can lose its dynamism (dynamicness? dynanimity?). The problem is related to the way in which AutoCAD manages things like visibility states >>
Counting Conundrum: The use of anonymous block names means that the usual methods for counting blocks will not work very well for dynamic blocks >>
Batch Plot to DWF or PDF: Want to batch publish PDF or DWF files? The Autodesk Developer Network has kindly provided a free download that allows you to do just that >>
   
 
> Live Links
   
 

In addition to tables, AutoCAD 2007 added data links, which are dynamic links between tables and Excel spreadsheets. Though the link may be somewhat slow, you can use an Excel spreadsheet just like an xref. To create a data link, copy and paste your desired spreadsheet into AutoCAD, following the process described in last week’s tip. In Excel, select and copy the cells you want to appear as a table in AutoCAD.


Caption: Select your Excel spreadsheet.

Then use the Paste Special command to paste the cells into your AutoCAD drawing. Be sure to select the Paste Link radio button. Instead of the option to paste as AutoCAD entities, you now see and select the type of source file.


Caption: Select the Paste Link button to retain a link to the source Excel file.

This will automatically create a new data link and bring in the Excel formatting. Any changes to the Excel spreadsheet will automatically appear in the AutoCAD table.


Caption: Spreadsheet as it appears in AutoCAD. The Properties palette (below) shows that it’s an OLE object and identifies the source application.

   
 
> Dynamic Duds
   
 

Sometimes, a Dynamic Block can lose its dynamism (dynamicness? dynanimity?). The problem is related to the way in which AutoCAD manages things like visibility states. When you insert a Dynamic Block and adjust it using its dynamic properties, AutoCAD automatically assigns an anonymous block name to keep track of that particular definition.

To make your Dynamic Block dynamic again, try using the Rename command to rename the existing block in your drawing (for example, change its name to “BadBlock”).


Caption: Use the Rename command to change the name of your problem Dynamic Block.

Insert the block again from the tool palette, or use the Save Block As function in the Block Editor to save your block back to its original name. Start the Blockreplace Express Tool by selecting Replace Block with Another Block under Blocks in the Express Tools menu.


Caption: Start the Express Tool Blockreplace.

Replace the BadBlock with the new block (the block with the original name).


Caption: First, Blockreplace asks you to select the block to be replaced.


Caption: Next, it asks for the replacement block. Note that only blocks that are currently inserted in the drawing will appear in the selection box.

AutoCAD uses anonymous blocks for various other purposes. Some actions, such as copying from another drawing and pasting as a block, can also add anonymous blocks to your drawings.
Here are the different types of anonymous entities you may encounter:

  • *U### = anonymous blocks
  • *E### = anonymous nonuniformly scaled blocks
  • *X### = anonymous hatches
  • *D### = anonymous dimensions
  • *A### = anonymous groups

You can deal with any anonymous block in the manner described above. First, use the Rename command to change an anonymous name to one that doesn’t have a leading asterisk. This will allow the block to appear in the Blockreplace pull-down box. Then make a copy of the block and give it a more meaningful name. Use Blockreplace to replace the old block with the new one.

   
 
> Counting Conundrum
   
 

The use of anonymous block names means that the usual methods for counting blocks will not work very well for dynamic blocks.

What are the usual methods? The first is the Express Tool Bcount. The second is to use the Properties palette (display using the <Ctrl>+1 key combination). Click on the Quick Select button at the upper right corner. Select Block Reference from the Object Type pull-down list. Select Name from the Properties panel. Then choose the name of the block you want to count. AutoCAD will select all instances of the block, and the total will appear in the Quick Properties panel of the Properties palette.

If you want to count your dynamic blocks, you will need to use yet another method: Attribute Extraction. The Attribute Extraction wizard allows you to view and select the various dynamic properties associated with a Dynamic Block.


Caption: The Attribute Extraction Wizard lets you pick dynamic properties to extract.

The attribute extraction will subtotal the instances of each dynamic option. For example, if you have a dynamic block with three visibility states, you can export a CSV or insert a table with a total for each of the three options.


Caption: Even though the Dynamic Blocks share the same name, the Attribute Extraction table shows how their properties are different.

Another option for counting  Dynamic Blocks is an AutoLISP routine by Brock Narum, Block Quantify, which is available for download at cadalyst.com. The routine counts the number of blocks, xrefs, and dynamic blocks inserted into an active drawing.

   
 
> Batch Plot to DWF or PDF
   
 

Want to batch publish PDF or DWF files? The Autodesk Developer Network has kindly provided a free download that allows you to do just that. The plug-in runs as a command in AutoCAD (BatchPublish), but also comes with a separate executable that monitors the publishing process and restarts AutoCAD as needed. That means you should save all work before running the command.

You can specify that the command publish only drawings that have been modified since they were last published. The plug-in has been tested with AutoCAD 2007 and up. It should work with AutoCAD-based products as well, but hasn’t been tested on all of them.

ADN’s goal is to encourage the development of similar add-ons. If you feel inspired, you can mess around with the source code, which is provided as a Visual Studio 2005 project containing C# code.

As always when downloading applications from the Internet, be sure to read the Readme file before installing. Type Netload at the command prompt to load the plug-in. Then type Batchpublish to run it. In the Batch Publish dialog box, you specify the path to the source DWG/DXF files as well as the location to which the DWF files will be published. Note that PDF publishing is available in AutoCAD 2010 only.


Caption: Batch Publish dialog box.

Select the Configure button to set additional options such as type of file to publish, length of timeout before AutoCAD restarts, whether to publish only files that have been modified since the last publish, and files to publish.


Caption: Configure provides additional options.

   
 
   
 
 
>> SIGN UP for SolidWorks Express Newsletter and get the tips and tricks delivered into your inbox every two weeks!