Tuesday, August 27, 2013

Diesel Expression in Attribute Fields

Okay, so this is my answer to a question that I saw on cadtutor.net, and I thought that it would be a good topic for a post because I am sure that there are others out there that could use this or something similar to this.  So, today we are going to set up an automated block to increment station number and the elevation of that station.  We are going to do this by setting up a couple of attributes with built in diesel expressions.  
The first attribute is going to be our station number, so (as in the picture below) fire up the attribute definition and in the "Tag" field enter in Station; and then in the default pick the field button to the right of the text box, and then follow the pictures below.

once you are to the "Other" category; we are going to pick on the "DieselExpression" field name, and then enter the diesel expression seen in the picture in the field box.

Once you finish that pick okay, and then make sure the rest of the options are to your liking for the attribute definition and then go ahead and pick okay to place the attribute on your drawing.  Next we will repeat the process for the elevation attribute.
Notice that in this diesel expression field that the "userr" variable is different from the station number variable.  Make sure that you do this or you might have some confusion in the program when trying to place the block.

The picture below is what the (2) attributes should look like when you are done.  Now, once you have this we are going to select the attributes and then run the "Wblock" command.  When you pick the basepoint, pick the bottom left of the elevation attribute.

Now, that we are finished with establishing the block let's get on with the macro.  This macro is set up for LT users, but works no matter which Autocad you have.  If you notice, I named my block "station2" you can name it whatever you want just make sure that you change the name in the macro as well.


Once you have assigned the macro to a new command button and get it placed on a toolbar or ribbon; you are set to insert your new expressive block...wait a minute...there is one more thing that has to be set up before you can run away with it.  When you are in the drawing that the block is going to be placed in, and before you run the command.  You need to go through and define the variables in your "userr1", which is your starting station number; "userr2", which is the increment that your station number will increase by each time you place the block; "userr3", this is your starting elevation; and last but not least "userr4", and this will be the value that your elevation is going to increase by each time you place the block.

Okay that is it...have fun placing blocks!

No comments:

Post a Comment