Wednesday, May 19, 2010

Propulate tutorial for DWG properties

If you want to work with DWG properties inside and outside of AutoCAD learn how to use Propulate as it will automate the work to update these properties.

Together with DWG Columns and DWGInfoTip it is possible to see drawing metadata within Windows Explorer either in one or several columns or as an InfoTip.

DWG Columns

In this example you need to have information in one or many blocks with attributes. Here we have a title block named “Title Block” with several attributes that will be used.

Propulate allows quick, automated population of the Drawing Properties dialog data fields. This data is seen when using the DWGPROPS command or when viewing the properties of a .DWG file though the Windows Explorer, outside of AutoCAD. Drawing Property data can be updated, listed or removed from the current drawing or a subdirectory of drawings.

Using a predefined template, PROPULATE can fill in Drawing Properties data in entire directories of drawings. The information that can be applied includes literal strings, attribute values extracted from specified attributed blocks and lists of attached xrefs, images and fonts. Example: You have a whole project directory full of drawings that use the same attributed title block. Using PROPULATE and a customized template you can have the attribute values from each title block in each drawing extracted and added to that drawing's Drawing Properties dialog. PROPULATE can also insert (into the comment field) a list of the xrefs, images and fonts used by each drawing.

Run the command PROPULATE.

Command: propulate

Default template file: C:\Users\JTB\Documents\template.prp
Enter an option [Active template/Edit template/List/Remove/Update] <Update>: e

Using the option Edit Template opens up this dialog box. Notice the Block Attributes dropdown at the bottom. Make a selection of what block and attribute you want to add.

In the Template menu select Insert Attribute.

Give the Custom property a name. Here two attributes have been added.

Default template file: C:\Users\JTB\Documents\template.prp
Enter an option [Active template/Edit template/List/Remove/Update] <Update>: u

Update Drawing Properties information from template
Enter an option [Current drawing/Other drawings] <Current>: c

Writing C:\Users\JTB\Documents\AutoCAD Sheet Sets\2 revision test.dwg Drawing
Properties Info.

Running DWGPROPS shows how PROPULATE has updated the custom properties on the drawing.

One limitation with PROPULATE is that it is not compatible with dynamic blocks.

There is also a bug that makes it impossible to use PROPULATE if the DWG file name contains commas and possibly other special characters.

PROPULATE can be automated with AutoLISP like this where specified template is activated and then the current drawing is updated:

(command "._propulate" "_a" "c:\\Users\\JTB\\Documents\\template.prp"
"_u" "_c")

The above can be used to automatically run before saving the current drawing either by having a special command, menu command or button. Another method is to undefine the qsave, saveas, save, quit and close commands and redefine them to run propulate first.

Unfortunately it is not possible to use a reactor to run propulate before saving a drawing because calling propulate can only be run asynchronized so it in reality is probably run first after saving the drawing.

So here is an example how the most common commands are redefined to make sure propulate is run. Add the code below to the acaddoc.lsp file so it is loaded into each drawing that is opened. SAVEALL and CLOSEALL are not supported here.


(vl-load-com)
(setvar "cmdecho" 0)

(defun propulate ()
  (setvar "cmdecho" 0)
  (command "._propulate" "_a" "c:\\Users\\JTB\\Documents\\template.prp"
"_u" "_c")
  (setvar "cmdecho" 1)
)

(command "._UNDEFINE" "CLOSE")

(defun c:close ()
  (propulate)
  (vla-sendcommand (vla-get-activedocument(vlax-get-acad-object)) "._close\r")
  (princ)
)

(command "._UNDEFINE" "QUIT")

(defun c:quit ()
  (propulate)
  (vla-sendcommand (vla-get-activedocument(vlax-get-acad-object)) "._quit\r")
  (princ)
)

(command "._UNDEFINE" "SAVE")

(defun c:save ()
  (propulate)
  (initdia)
  (command "._save")
  (princ)
)

(command "._UNDEFINE" "SAVEAS")

(defun c:saveas ()
  (propulate)
  (initdia)
  (command "._saveas")
  (princ)
)

(command "._UNDEFINE" "QSAVE")

(defun c:qsave ()
  (propulate)
  (initdia)
  (command "._qsave")
  (princ)
)

(setvar "cmdecho" 1)
(princ)


More details as mainly found in Express Tools help file.

Command: PROPULATE
Default template file: g:\acad2000\express\template.prp
Enter an option [Active template/Edit template/List/Remove/Update] <Update>: Enter option

Active template
Specify the template file to be used to update Drawing Property fields.

Edit template
Launches a dialog for creating and editing Propulate template files. See Editing the Propulate template.

List
Displays the Drawing Properties for the current drawing or directories of drawings.

Remove
Deletes the Drawing Properties from the current drawing or directories of drawings.

Update
Uses the active template to populate Drawing Properties to the current drawing or directories of drawings.

The following prompt is displayed when selecting the List, Remove or Update options
Enter an option [Current drawing/Other drawings] <Current>:

Current drawing
Applies the selected task to the current loaded drawing file.

Other drawings
Applies the selected task to a user-specified directory of drawing files.

These prompts are displayed when selecting the Other option
Enter search directory and drawing name: Specify a starting location and drawing name or wild-card to search
Search subdirectories? [Yes/No] <Yes>: Enter Yes or No to recursively search subdirectories
For example: g:\project\PG*.dwg will search all drawings whose names start with PG starting in the g:\project directory


Editing the Propulate Template

Propulate uses a template file to determine what values should be inserted into the Drawing Property fields of a drawing. The template file must be edited before use to specify what and where values are applied to the Drawing Properties dialog. You can create as many different templates as you need however there is only one active template at a time. The default template file name is template.prp. The easiest way to edit an existing template or create a new one is to use the 'Edit Propulate Template' dialog.

File menu options

New...
Clears all edit fields in preparation for creating a new template. Will prompt a for a new template file name when the OK button or one of the Save menu options is selected.

Open...
Opens an existing template file.

Save
Saves the template file currently being edited.

Save As...
Saves the template file currently being edited to another name.

Template menu options

Insert Xref list
Inserts the @[XREFLIST] command at the current cursor location.

Insert Font list
Inserts the @[FONTLIST] command at the current cursor location.

Insert Image list
Inserts the @[IMAGELIST] command at the current cursor location.

Insert Attribute
Inserts the value selected in the Block Attributes list at the current cursor location.

Make active template
Sets the template currently being edited to be the default template. This option is unavailable if the edited template is already the default or if it has not yet been saved to a file name.

Fill from Current Drawing
Clears all edit fields and fills them with the existing Drawing Properties values from the current drawing. Useful if you want to create a template based on the current drawing.

To edit the template file, enter text or one of the special insert options in the appropriate field. For example, entering Downtown Renovation in the Subject field would insert the string Downtown Renovation into the subject field of the Drawing Properties dialog for each drawing processed with this template. In addition to literal strings like this, there are four special commands that can be used to extract drawing specific information and insert that data into the Drawing Properties dialog.

Special Insert Commands

@[block.attributeTag]
Extracts the attribute tag value from an attributed block and inserts it in the specified field.
For example: inserting @[title.drawnby] in the Author field causes Propulate to search the drawing for an attributed block named title, extract the value of the attribute tag drawnby and insert that value in the Author field of the drawings Drawing Properties dialog. If common blocks are used across a project it is a simple matter to update a large number of drawings to reflect their specific attribute values.

@[XREFLIST]
Inserts a list of the xrefs currently attached to the drawing being processed. Attached xrefs are preceded with 'A'. Overlay xrefs are preceded with 'O'. Only works in the comment field.

@[FONTLIST]
Inserts a list of the fonts currently used by the drawing being processed. Only works in the comment field.

@[IMAGELIST]
Inserts a list of the image files currently attached to the drawing being processed. Only works in the comment field.

Example: Entering @[XREFLIST] @[FONTLIST] @[IMAGELIST] in the Comments field could produce the following:


Xrefs:
  A  d:\xrefs\1a6
  A  d:\xrefs\2a6
  A  g:\project\work\3a6
 Fonts:
  G:\ACAD2000\support\simplex.shx
  G:\ACAD2000\fonts\txt.shx
  G:\ACAD2000\fonts\ROMANS.shx
 Images:
  G:\Acad2000\acadsig.jpg

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner