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 to 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.

Next post in series [AECLineworkCrop]

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.
       "\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.

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.