August 23, 2013

AutoCAD: AutoComplete vs Alias

As you can see in the image above, my Command Line Suggestion list currently has FILLET as the top-ranked response after typing "F" at the Command: prompt. But it did not start out that way, and, to my annoyance, I found that the AutoComplete feature was frequently trumping my "F" command alias for FILLET. More often than not, it was executing the Express Tools FASTSEL command, no matter how quickly I hit the Enter key after typing the "F", because that command was at the top of the list. Initially, FILLET was not even visible on the list, without scrolling down. Yes, you can type additional characters to limit the choices, but the whole point of assigning a single-character command alias is to be able to execute a very-often-used command quickly.

I was made aware of this "issue" in a thread in the Autodesk® AutoCAD® Architecture Discussion Group, and discovered something of a workaround, if you both like the AutoComplete feature [I do] and yet want to be able to use command aliases. The workaround is not foolproof, and in cases where you frequently use multiple commands that start with the same letter, it may not be "permanent".

The workaround is simple, if tedious. Select the Customize tool on the Command Line (wrench icon) and then choose Input Search Options from the context menu that displays.
In the Input Search Options dialog, in the AutoComplete area in the upper left, verify that the According to frequency of usage radio button is selected, under Sort suggestions. If you choose Alphabetically, the list will always remain alphabetic; choosing According to frequency of use allows the commands you use most often to rise to the top of the list.
Also check the delay time at the bottom of the left side. The default value of 300 milliseconds was more than enough time for my single-character alias, you may want to increase this if you want to assure that the Command Line Suggestion List does not pop up if you have a longer alias, as there will not be any commands on the list with AutoComplete disabled. Finally, clear the checkmark next to Enable AutoComplete, to temporarily disable this feature. This will allow the command alias to be used without any interference from the AutoComplete feature. Select OK to accept the settings and dismiss the Input Search Options dialog.

Now for the tedious part: run the command you want at the top of the list repeatedly. I did not count how many times I needed to run the FILLET command to get it to the top of the list, but it was quite a few. In my case, it was probably made worse because I ran the FASTSEL command quite a few times while I was investigating this phenomenon. Once you get tired of running the command, open the Input Search Options dialog again and enable AutoComplete. Then type your alias and wait for the AutoComplete/Command Line Suggestion List to display, and see if your command is at the top. If it is, you should be able to use the command alias and get the desired command every time. If not, disable AutoComplete again and run the command repeatedly again.

Once your command is at the top, and if you increased the delay time, you may want to set it back to 300. You can do that in the Input Search Options dialog, or by changing the INPUTSEARCHDELAY system variable (which can be accessed by selecting the Customize tool on the Command Line, and then choosing Input Settings > Delay Time).

If you would rather just not deal with AutoComplete, you can disable this feature entirely by deselecting all of the options in the Input Search Options dialog (AutoComplete, AutoCorrect, Search system variables and Search content at command line).

August 15, 2013

Revit: Type Catalogs

A few months back I had my first experience with creating an Autodesk® Revit® family driven by a type catalog. I am finally getting around to documenting some of what I learned, so I do not have to learn it again, next time. For the record, the observations below were made while using Revit Architecture 2012; I have not yet worked with type catalogs in the 2014 release.

Yes/No Parameters
The column header format for Yes/No Parameters is: [ParameterName]##other##
where [ParameterName] is the name of the Yes/No parameter. The values assigned to this parameter for each type need to be either 0, for No, or 1, for Yes.

Text Parameters
If your type catalog includes a text-type parameter, such as the out-of-the-box Type Comments parameter, you have to add a value to that parameter in the family file. If the parameter is left unedited, when you try to load the family, you will get a Warning...
...and none of the values in your type catalog will be imported into the type(s) you chose to load into your project. If you edit the text parameter in the family, even by simply typing a single character and then deleting it, Revit recognizes that the parameter has been edited and will load the type catalog values as expected. In order to avoid confusing myself, I plan to leave some visible text in the family for each text parameter I have in the type catalog, so that I can see that the parameter has been edited. If a type needs a text parameter to be empty or blank, a blank value in the type catalog will overwrite the value in the family file, leaving the value of that parameter blank for that type.

Editing the Type Catalog
  • Once you load from a type catalog into Revit, it puts a lock on the text file that holds the type catalog data. I had to close Revit completely (not just the model into which I loaded the types from the type catalog) to get the lock to be released so that I could rename the file. I did discover that you can open, edit and save the type catalog text file, even with the lock on it, but I wanted to replace the file with a new one generated as a CSV file from the Excel file where I was doing the editing. While I could not rename the type catalog file and then rename the new CSV to replace it without closing Revit (which does not make for a very efficient testing period), I found that I could copy a new version of the type catalog file from another folder and overwrite the old version that Revit had locked, so I amended my workflow to moving the CSV file to another folder, renaming it by changing the extension to "txt" and then moving that file to the old version's folder, overwriting it.
  • If Excel (or another spreadsheet program) is used to generate the type catalog text file (by saving as a comma-separated values [CSV] file, and then changing the file extension to "txt"), you can use formulas in the Excel file to generate the values that end up in the type catalog. A formula in the Excel file can be applied on a per-type basis, whereas a formula added to a parameter in a family in Revit applies to all types in the family. As an example, the family I was generating represented the elevation of a Door. Some of the types had had glazing, and I needed to specify how far from each edge of the door the glazing started. Some glass was "full-width," with equal stiles and other glass was a lesser, given width. I was able to use a formula to calculate the glass width opening for the full-width types by subtracting twice the stile width from the overall width, while simply directly entering the value of the given-width glazing in the other types. I am sure there is a way to use multiple formulas and a Yes/No parameter to achieve that directly in a family, but since I was creating a type catalog anyway, it was nice to be able to have the flexibility to customize the formula on a per-type basis in Excel.