January 27, 2016

ACA: Ceiling Grid Boundary Selection and Resource Manager Error

That is a pretty scary warning dialog. It makes me think that, at the very least, my AecGuiBase70 file has some form of corruption. If you receive this error dialog while adding a Ceiling Grid and using the Set boundary command option to select a Polyline as the ceiling boundary, your AecGuiBase70 is just fine. The problem is that the Polyline you selected is not a closed Polyline.

"But wait!" you exclaim. "That Polyline looks closed to me." It may very well looked closed, but when drawing the Polyline, merely snapping the last point to the first point does not a closed Polyline make. Next time, stifle the urge to add one more point on top of the first point, and use the Close command option, by selecting it on the Command Line, or by typing C and then pressing the ENTER key.
Fix the already drawn Polyline by using the Close command option of the PEDIT command or by selecting the Polyline and, on the Properties palette, on the Design tab, under the Misc category, set the Closed property to Yes.

BONUS TIP: You can double-click that Polyline to initiate the PEDIT command on that Polyline. Personally, I would get rid of that last vertex and then close the Polyline, but that is not necessary for the Polyline to be a valid Ceiling Grid boundary.

Curiously, the Set boundary option of the CEILINGGRIDCLIP command provides an informative message at the Command line, rather than the non-informative Error dialog the CEILINGGRIDADD command gives, when selecting an open Polyline as the boundary.
The CEILINGGRIDCLIP command is used to add a clipping boundary to an already-placed Ceiling Grid, and can be accessed by selecting the Ceiling Grid and then, on the Ceiling Grid contextual ribbon tab, on the Clipping panel, by selecting the Set Boundary tool.

January 26, 2016

ACA: CREATEHLR Command Precision

The CREATEHLR command in AutoCAD® Architecture can be useful in generating a 2D view, with hidden lines removed, of 3D geometry. (Generating a 2D Elevation is another way; each has its uses.) I spent some time today searching the internet for the system variable that will increase the accuracy of hiding (and shading), as my memory failed to call up the information, and I am posting this to make it easier for me to find in the future.

The HIDEPRECISION System Variable controls whether hiding is calculated using single-precision numbers (when set to 0) or double-precision numbers (when set to 1). Double-precision calculations are more accurate, but require more memory, which can have a significant performance hit, particularly if 3D solids are involved in the hide. The value of HIDEPRECISION is not saved, and is initially set to 0 at the beginning of each AutoCAD session.

January 24, 2016

ACA: AEC Modify Tools, Part 6, AEC Merge

First post in series [AecLineworkExtend]
Previous post in series [AecLineworkObscure]

The AecLineworkMerge command can be found on the Home ribbon tab, on the Modify panel flyout, by selecting the Merge tool from the Merge/Subtract flyout. If the Merge tool is not displayed on the Merge/Subtract flyout, select the right side of the split button (down arrow icon) to deploy the flyout and choose the Merge tool. Or, with no command active, you can right click in the drawing window, and choose AEC Modify Tools > Merge from the context menu.

The AecLineworkMerge command is used to modify the extents of closed Polylines, Circles, Hatches, AEC Polygons, Mass Element Extrusions that have an embedded profile and Spaces, as well as Block References which contain any of these objects by "merging" the original object with one or more other objects that define the change to the perimeter. In lieu of selecting one or more objects to merge into the initially selected object(s), you can also specify a rectangular area by selecting its opposite corners, and that rectangular area will be merged into the the intially selected object(s). You will be given the option to erase the object(s) to merge (the object or objects selected at the second prompt for the object(s) that define the changed perimeter); the default is No, which leaves the object(s) to merge in the drawing file.

If you select multiple objects at the first prompt, the AecLineworkMerge command is applied to each of those independently, using the objects selected at the second prompt on each of those selected at the first prompt. Here are some additional notes regarding the AecLineworkMerge command:
  • Open linework cannot be used as the linework to add to (first prompt), neither can MText, Text, Ellipses nor Ellipse Arcs. The command will allow you to select an open Polyline as the linework to add, but will not make any change to it.
  • MText, Text, Ellipses and Ellipse Arcs can be selected as (part of) the objects to merge. For MText and Text, the bounding box of the text is used as a rectangle to be merged.
  • The type of the initial object selected will determine the type of the merged object. Allowed AEC objects will result in an AEC object of that same type, as do Hatches. Closed Polylines and Circles will result in closed Polylines.
  • Mass Elements with a shape other than "Extrusion" and Mass Element Extrusions that have an external Profile can be selected as linework to add to, but will not affected by the AecLineworkMerge command. These types of Mass Elements can be selected as an object to merge.
  • If a Block Reference is selected as linework to add to, only those nested objects within the block on which the AecLineworkMerge command works will be affected.
  • Attributes within a Block Reference will not be affected by the AecLineworkMerge command.
  • If a Block Reference is selected as linework to add to, it has nested elements that can be affected by the AecLineworkMerge command and it is the only instance of that Block Reference in the drawing, then the original block definition will be redefined to include the effects of the merge. If at least one instance of the Block Reference remains unaffected by the merge, then the original block definition will remain unchanged and the affected instance(s) will become instance(s) of new, anonymous block definition(s).
  • If a Block Reference is selected as linework to add to and it has multiple nested elements which can be affected by the AecLineworkMerge command, the merge will be applied to each of those elements independently.
  • Multi-View Blocks can be selected as linework to add to, but will not be affected by the command.
  • If the active View Block of a Multi-View Block contains linework that forms a closed boundary or contributes to a closed boundary, it can selected as an item to merge.
  • Selecting an associative Hatch as linework to add to will result in a non-associative Hatch, regardless of whether or not the boundary of the Hatch is also selected as linework to add in the same AecLineworkMerge command.
  • Associative Spaces, Walls, Doors, Windows and Door/Window Assemblies can be selected as linework to add to, but will not be affected by the command. These objects can be used as object to merge. Non-associative Spaces can be modified by the AecLineworkMerge command when selected as linework to add to.
  • The object(s) to merge do not have to form a closed loop. If multiple objects are selected, they do not have to meet endpoint to endpoint, although the results may be unexpected if there is overlap.
  • The object(s) to merge do not necessarily have to intersect the linework to add to object(s). If the linework to add to objects support it (), a single object with two disconnected parts will be formed (Hatches, AEC Polygons, Mass Element Extrusions that have an embedded profile and Spaces). Closed Polylines and Circles will generate a closed polyline around the object(s) to merge or indicated rectangle, but will remain separate from original objects. (If a Circle is the linework to add to, and the object(s) to merge do not intersect it, it will remain a Circle.) If a Block References is selected as the linework to add to, and the object(s) to merge do not intersect it, there will be no change (unless you delete the object(s) to merge, in which case that object/those objects will be deleted).

There are object types and combinations of objects within a Block Reference that I did not test. When using the AecLineworkMerge command in a situation that you have not previously encountered, you may want to use the Mark option of the UNDO command, so that you can easily UNDO Back to the point before the command was used if you get unexpected results.

January 21, 2016

AutoLISP: Running TXT2MTXT Separately on Multiple TEXT Objects

Of the Express Tools that have not been incorporated into the main program, the TXT2MTXT command, for converting AutoCAD® TEXT objects to MTEXT objects is one of my most-used. I had a drawing with more than 50 TEXT objects that needed to be converted to individual MTEXT objects. The TXT2MTXT command will allow you to select multiple TEXT objects, but it will convert them all into a single MTEXT object. I could have just run the command once for each TEXT object, but I decided that writing a simple AutoLISP® routine would probably take about the same amount of time as this one use, and then I would have it to speed future, similar uses. Here is the function I devised:
(defun C:MLTPL_TXT2MTXT (  ; No arguments.
    / ;_ Local variables:
    acmde  ; Command echo mode.
    ename  ; Entity name of TEXT object being processed.
    icount  ; Loop counter.
    ss1  ; Selection set of TEXT objects on which to operate.
   ) ;_ End arguments and local variables.
  (setq acmde (getvar "CMDECHO")) ; Command echo mode.
  (setvar "CMDECHO" 0)   ; Turn off command echo.
  (prompt "\nSelect TEXT objects to be converted to MTEXT. ")
  (setq ss1    (ssget '((0 . "TEXT")))
 icount 0   ; Initialize loop counter.
  ) ;_ End setq.
  (cond     ; cond A.
    (ss1    ; If TEXT objects selected, do the following:
     (while (setq ename (ssname ss1 icount))
       ;; While unprocessed TEXT objects remain:
       (command "TXT2MTXT" ename "") ; Process text.
       (setq icount (1+ icount)) ; Increment counter.
     ) ;_ End while.
     (prompt "\nAll selected TEXT has been converted to individual MTEXT objects. ")
    ) ;_ End condition A.1.
    (T
     (prompt
       "\nNo TEXT objects selected.  C:MLTPL_TXT2MTXT terminated. "
     ) ;_ End prompt.
    ) ;_ End condition A.2.
  ) ;_ End cond A.
  (setvar "CMDECHO" acmde)  ; Restore previous command echo mode.
  (prin1)    ; Exit quietly.
) ;_ End C:MLTPL_TXT2MTXT.

January 19, 2016

Revit: Schedule Column Totals and Rounding

Schedules in Autodesk® Revit® that include a total for a column of numeric data is subject to the same issues with rounding that Schedule Tables in AutoCAD® Architecture have, as noted in this previous blog article, and expanded upon in this one. Both programs display formatted data in the schedule, which may involve rounding, but use the unformatted data when calculating the total for the column, and then formatting that total. If the data is rounded, then it is possible that the total displayed will not be the sum of the displayed values in the column.

In Revit, you can use one or more calculated value columns in the schedule to have the rounded value be the value that is used to calculate the column total, so the total will match the sum of the displayed values. The round() formula function will round to the nearest whole number. If you are displaying data to the nearest whole number, a single calculated value column, employing the round function will suffice. In the example shown in the screenshots below, the data is to be displayed with two decimal places. That requires a few intermediate calculated value columns. (Click on the image below to see it full-size.)

The Area Parameter column shows the out-of-the-box Area parameter for Rooms, rounded to two decimal places. The total of this column is 0.01 higher than the result you would get if you added the displayed numbers.

The Area Unformatted column is a calculated value column, that displays the Area parameter with eight decimal places. I included this just so you can see how the raw numbers total and then are rounded to get the total of the Area Parameter column. This column is not needed to generate the column with "correct" total.

In order to round the value to two decimal places, the first step is to multiply the Area parameter values by 100. The Area100 calculated column does that. The image below shows the formula.

The Area100Round calculated value column rounds the Area100 value to the nearest whole number. The round function requires an unformatted real number, so it will not work on an Area value. To get around the "inconsistent units" problem, you have to divide the Area value by one square unit, do the rounding, and then multiply by one square unit, as shown in the image below.

The Area Fixed 2 Decimal is the calculated value column that you will want to have displayed in your schedule (but probably not with that column header). This column takes the value in the Area100Round column, divides it by 100 and displays the result with two decimal places. Since the values in the Area100Round column are all rounded to whole numbers, dividing by 100 leaves, at most, two decimal places, so Revit is adding the displayed numbers when calculating the total.

You do not have to apply eight-decimal place formatting to the Area100 and Area100Round columns; I only did that to more closely show the values that Revit is using internally. In the final schedule, you will want to hide the Area Parameter (the built-in Revit Area parameter), Area100 and Area100Round columns. You have to keep them, so the values are available to make the calculations. If you prefer, you can eliminate the Area100 and Area100Round columns by combining all of the math in one formula: ((round((Area * 100) / 1 SF)) * 1 SF) / 100. It is easier to explain what is being done using separate columns, which is why I took that approach here.

December 16, 2015

Revit: CAD Export Layer Mapping - Restore Subcategory Default

When editing a DWG/DXF Export Setup, you may have noticed that some subcategories have the layer name of the main category, enclosed in curly braces ("{" and "}") and italicized, and, if you change the layer name of the main category, these all automatically update to match that change in the main category. For example, using the Revit 2014 out-of-the-box US Imperial default.rte template, the Doors category looks like this:

Notice that the Elevation Swing and Plan Swing subcategories have { A-DOOR } in the Layer column, whereas the Panel subcategory just has A-DOOR. If the layer for the Doors main category is changed, the Elevation Swing and Plan Swing subcategories also change, but the Panel subcategory does not.

If you want a subcategory to be linked to the main category name, but it is not already so linked, you can do one of the following:
  • If there is already another subcategory so linked, you can copy the text in that subcategory, and then paste that value into the subcategory you wish to link. Be certain to copy the entire string, including the leading space characters.
  • If there is not already a linked subcategory, or you just prefer typing to cutting and pasting, type two space characters, an opening curly brace ("{"), one space character, the layer name as it currently appears in the main category, one space character and a closing curly brace ("}"). Once you press the ENTER key or click into another field, the text will italicize, letting you know you entered it correctly.
  • You can also just type two space characters, an opening curly brace ("{"), two space characters and a closing curly brace ("}") in the subcategory's Layer field, and then make a change to the main category's layer name, if that is easier for you. After you change the main categories layer name, you can change it back if you did not want to make a change to it.
As always, click on an image to see a larger version of it.

December 04, 2015

ACA: Underline in Tag But Not in Schedule III

This old post and this follow up post describe two ways to have a text property shown in a tag (such as a room name) be underlined in the tag, but not in a schedule table. The first post suggested adding a formula property, and concatenating %%u and the non-underlined property in the formula, and then using the formula property in the tag.

The second post accomplished the same thing by making a copy of the Property Data Format assigned to the text property and, in the copy, adding %%u in the Prefix field, and then assigning the new Property Data Format to the property in the Property Set Definition. When adding that property to a Schedule Table Style, the original, non-underlined Property Data Format would be used. The benefit of this method is that you do not need to make any changes to the view block used by the Schedule Tag's Multi-View Block Definition.

This all worked fine back in 2005/2006 when the articles were written, and for some time thereafter. I have not checked, but I suspect that the addition of multi-line attribute support for Multi-View Blocks (and, therefore, in Schedule Tags) in the 2009 release broke the recognition of %%u as a code to indicate starting (and stopping) an underlining of text. It certainly does not work in the 2016 release.

Fortunately, there is still a way to do this, and it can be used with either method. Just substitute \\L [the MText underline code] for %%u. For example, given a text property called Name, you could create a formula property that creates an underlined version of that property by using the formula
RESULT = "\\L" & "[Name]"
where "[Name]" is a properly created reference to the Name property.

Or, you could make a copy of the Property Data Format, such as Case - Upper, rename the copy Case - Upper - Underline, and add \\L to the Prefix property on the Formatting tab.

November 21, 2015

ACA: Unexpected Thawing and Turning On of Layers

If you are using AutoCAD® Architecture 2015 and 2016, you place AEC Objects on layers other than the layer associated with the default Layer Key for that object type and you have occasion to turn off and/or freeze the layer associated with that default Layer Key, you may have found that simply selecting one of the objects on one of the other layers will result in the layer associated with the default Layer Key being turned on and thawed. This makes it difficult to work with just the items on the "other" layers. One situation where this would be desirable is on a renovation project, where you have the existing-to-remain, existing-to-be-demolished and new construction objects all in the same file, and you want to view and edit the demolition plan. To do so, you would turn off and/or freeze the new construction layers, and would not expect these to turn back on and thaw just because you select an item on the existing-to-remain or existing-to-be-demolished layers.

For example, you may have a file where the WALL layer key is associated with a layer named A-Wall-N, on which new construction Walls are placed. A layer named A-Wall-E is used for existing-to-remain Walls, and existing-to-be-demolished Walls are placed on a layer named A-Wall-D. As seen in the Screencast below, if the A-Wall-N layer is frozen and turned off, selecting a Wall on the A-Wall-D layer will result in the A-Wall-N layer being turned on and thawed. A REGEN is needed to see this immediately, since the layer had been frozen, but you can also check the Layer Properties Manager to see that the layer has, in fact, been turned on and thawed.

The 2014 release did not exhibit this behavior, as shown in the second half of the Screencast. Note also that if you select multiple object types at one time, only the layer associated with the default Layer Key of the first object type selected will be turned on/thawed.

November 07, 2015

Exception in mc3.dll / mc3d.dll ARX Command

If you are running AutoCAD® Architecture 2016 or AutoCAD® MEP 2016, and get this error message after working in the program for a few minutes
then you have a damaged WHITELIST.XML file, which is used in connection with the Desktop Analytics and Customer Involvement Program features.

This Autodesk Knowledge Network [AKN] article describes the issue and provides a procedure to fix the problem. In brief, with the program closed, you delete the damaged WHITELIST.XML file, reboot your computer, and then restart AutoCAD Architecture or AutoCAD MEP. Turn Desktop Analytics and the Customer Involvement Program features back on, if you turned them off, by selecting the right side (down arrow icon) of the Help split button, and choosing the Desktop Analytics and Customer Involvement Program items (one at a time). After several minutes, the WHITELIST.XML file should be downloaded from the Autodesk website (if you have an active internet connection). This file should not be damaged, and you should not experience the Exception in mc3.dll / mc3d.dll ARX Command error message.

An alternative solution to stop the crashing is to use those menu items to turn off both Desktop Analytics and the Customer Involvement Program. The AKN article describes how to do so via editing the registry if you are unable to open the program and get to the Help Menu.

NOTES:
  1. In order to get the full Help drop-down menu, you need to have at least one drawing file open. Just having the Start tab open will result in a truncated menu that does not include the Desktop Analytics and Customer Involvement Program items.
  2. As of November 7, 2015, the AKN article lists this folder as the location of the WHITEPAPER.XML file for AutoCAD Architecture 2016:
    C:\Users\[user]\AppData\Roaming\Autodesk\ARCHDESK\2016\{5783F2D7-F004-0409-2102- 0060B0CE6BBA}\7.8.44.0\MC3
    I had that folder, but there was not a WHITEPAPER.XML file in it. I found it in this folder, instead:
    C:\Users\[user]\AppData\Roaming\Autodesk\ARCHDESK\2016\{5783F2D7-F004-0409-2102-0060B0CE6BBA}\7.8.106.0\MC3
    The difference between the two is the product version number folder. I had SP1 for AutoCAD Architecture 2016 installed, and 7.8.106.0 is the version number after SP1 is installed. You may want to check the About AutoCAD Architecture 2016 dialog (last item on the Help drop-down menu) to see what your version number is, and look for the WHITEPAPER.XML file in the folder with that number.
  3. After not finding the WHITEPAPER.XML file in the ...\7.8.44.0\MC3 folder, I tried searching my entire C: drive for WHITEPAPER.XML. Windows will apparently not search inside all (any?) of the User folders when the search is started at the root of C: drive, as I got no hits when doing so. After I saw the file in the ...\7.8.106.0\MC3 folder, I tried searching from the C:\Users\[user]\AppData\Roaming\Autodesk folder and then it found the file.

October 07, 2015

Dynamo Primer - Update

First Edition V1.2 of the Dynamo Primer is now available. There are now nine chapters in the primer. Geometry for Computational Design, Designing with Lists, Code Blocks and Dynamo Language, Dynamo for Revit and an Appendix have been added to the four chapters that were in First Edition V1.0. (I suppose there was a V1.1; if so, I missed it.)