Showing posts with label CUI. Show all posts
Showing posts with label CUI. Show all posts

Sunday, January 25, 2009

Assigning Multiple Double Click Actions to Single Entity Type in AutoCAD

In the Unleash the Double Click Power post, you saw how to customize the double click action of an entity type to implement custom double click actions. Now we are going to see how we can implement different double click actions simultaneously on single entity type. Normally, we accomplish this by using Reactors or Events in the respective languages. But, we are not going to use any of these in our method. Rather, we will follow a tricky way to achieve the same result.

As an example, I will show you how to change the double click action of an 'Attribute Block'. Normally double clicking an attribute block shows the Enhanced Attribute Editor Dialog. We are going to change this to show either Enhanced Attribute Editor(_eattedit) or Edit Attributes dialog (_attedit) depending on certain condition. Let's say, when we double click on a title block named TITLE_BLOCK, it should display the Enhanced Attribute Editor dialog and for all other blocks in the drawing, it should display Edit Attributes dialog. The step by step configuration is given below.



  1. Open CUI and create a custom command with the following code inside the macro section of the command. If you don't know how to create a custom command, then refer to the 'Unleash the Double Click Power' post mentioned above. Replace the 'TITLE_BLOCK' inside the following code with your actual title block name.
    ^C^C(if (= (cdr (assoc 2 (entget (ssname (ssget "P") 0)))) "TITLE_BLOCK") (command "_eattedit")(command "_ddatte" ))

  2. Drag and drop the custom command under the 'Attribute Block' section inside the Double Click Actions.

  3. Click on 'Apply' and close the CUI dialog.





That's it. Now if you double click on the title block, it will open the Enhanced Attribute Editor dialog and for all other attributed blocks, it will open Edit Attributes dialog. By the way, don't forget to take a backup of the default CUI files before you start experimenting with them.

Saturday, September 1, 2007

Unleash the Double Click Power...

  1. The best thing I like in AutoCAD is the power of customization it offers for the end user. By doing so many customizations, you can convert your AutoCAD to a custom product most suitable for your industry. Moreover, the process of customization gets simpler with each new release of the product. Here is a sample tutorial to create a custom double click action which converts a Line to a PolyLine. Please have a look at the image attached below.



    The picture itself speaks well about the process. Doesn't it? In case you are unable to make out the process, here goes the steps in detail.

  2. Open CUI dialog by typing CUI in the command prompt (or Tools -->Customize -->Interface...).

  3. In the 'Command List' category, click on 'New' button to create a custom command (See the image section 1).

  4. Type in a name in the 'Name' property field (image section 2) and assign your macro to the 'Macro' property field (image section 3).

  5. Now the costom command is ready for use. The next thing is to apply this command to the double click action of an entity. For that, expand the 'Double Click Actions' category to locate the target entity (Here we are going to apply it to a 'Line').

  6. Drag the command using left mouse button and drop it right under the 'Line' category listed under the 'Double Click Actions' (image section 4). Before doing this, take a note of the existing command under the 'Line' category, in case you want to go back to the default command later.

  7. Now finish the process by clicking apply. Draw a line and double click on it to see how the new settings work. If the settings were done properly, the list command should list the object type as 'LWPOLYLINE'.


The double click macro for converting line to polyline is given below

^C^C$M=$(if,$(=,$(getvar,peditaccept),1),_pedit;,_pedit;;)

The following are some macros I use to make my drafting life easier.

Macro : ^C^C_xopen;
Category : XRef

Description : Opens the external reference source file.

Macro : ^C^C_dimedit;home;cmddia;0;_dimedit;new;<>;previous;;
Category : Dimension
Description : Regains its original dimension value, text position and text orientation

Macro: ^C^C$M=$(if,$(=,$(getvar,peditaccept),1),_pedit;decurve;,_pedit;;decurve;)
Category : Arc
Description : Converts an arc to a straight polyline

Macro: ^C^C$M=$(if,$(=,$(getvar,peditaccept),1),_pedit;close;,_pedit;;close;)
Category : Arc
Description : Converts an arc to a circular polyline

Macro: ^C^C_transparency;on;
Category : Image
Description : Makes an image transparent.

Macro: ^C^C'_.zoom;_o
Category : Applicable to all
Description : Zooms to the double clicked object

Macro: ^C^C_-view;_swiso;'_.zoom;_o;previous;;
Category : 3DSolid
Description : Switches to isometric view of the double clicked 3D object.

I have a few more useful double click actions. But I skip those for the reason that it contains LISP expressions which is not supported in AutoCAD LT. Please note that you can not directly do these things in AutoCAD 2005 or earlier versions. Hope you enjoyed the double click customizations. If you have got any double click actions with you, please feel free share it with me.