January 18, 2017

AutoLISP: Selecting-Gripping Objects by Handle

The AutoCAD® Architecture SHOWDISPLAYOVERRIDES command is a great way to find objects that have a style- or object-level display override associated with them. At least, in a relatively small file it is. Running the command allows you to select either type of override or both, and it will list the objects at the command line as well as highlight them in the drawing canvas. If your drawing extents are fairly tight, you may be able to start zoomed all of the way out and still see the highlighted objects. But if your drawing extents are larger, then it will be hard to see the highlighting when zoomed out. Unfortunately, the command does not actually select the items, or activate the grips on them. You can use the mouse wheel to zoom in afterwards without losing the highlights, but unless you know where to look, that can be frustrating.

The command line output lists the Display Representation with the override, the override type, the object type and the handle of the object for object-based overrides or the handle of the style for style-based overrides.
Command: SHOWDISPLAYOVERRIDES
Show Display Overrides [byObject/byStyle/Both]: b
Massing Element Display Representation Plan High Detail Object based override found on Mass Element ("460F")
Massing Element Display Representation Plan High Detail Style based override found on Mass Element Style "Standard (2)" ("461C")
Massing Element Display Representation Plan High Detail Object based override found on Mass Element ("4733")
Massing Element Display Representation Plan High Detail Object based override found on Mass Element ("4737")

I wrote a quick AutoLISP® routine that will allow me to type in the handles given for the object-based overrides, that will then select and grip these objects. Provided you do not exceed the maximum number of objects for which AutoCAD will show grips at one time (GRIPOBJLIMIT system variable), you should be able to see where the objects that have been gripped are, even when zoomed out. Please note that you should NOT enter the handle of a Style-based override, as there is no graphical object which can be gripped in that case, and the SSFIRSTSET function will throw an error and crash the routine. A test for that could be added, prior to adding the entity to the selection set, but given the manual nature of entering the handles, I did not think that was necessary here.
(defun C:SELHAND (   ; No arguments.
    / ;_ Local variables:
    ename   ; Entity name of object with entered handle [entity name].
    sHand   ; User entered string of object handle [string].
    ss1   ; Selection set of objects whose handles were entered [selection set].
    ) ;_ End arguments and local variables.
  (setq ss1 (ssadd))   ; Initialize ss1 as an empty selection set.
  ;; Ask user for handle strings, until a null response is received.
  (while (/= "" (setq sHand (getstring "\nEnter handle string: ")))
    (setq ename (handent sHand)) ; Try to get entity name from handle string.
    (if ename    ; If an entity was found...
      (setq ss1 (ssadd ename ss1)) ; ...add entity to selection set.
      (prompt    ; ...else, report failure to find object.
 (strcat
   "\nNo entity with handle -->"
   sHand
   "<-- found. "
 ) ;_ End strcat.
      ) ;_ End prompt.
    ) ;_ End if.
  ) ;_ End while.
  (if (> (sslength ss1) 0)  ; If at least one valid handle was entered...
    (sssetfirst nil ss1)  ; ...select item(s), turning on grips.
    (prompt "\nNo valid handles entered.  Nothing to do! ")
     ; ...else, notify user.
  ) ;_ End if.
  (prin1)
) ;_ End C:SELHAND.

January 09, 2017

AutoLISP: Pickable Command Line Options

AutoLISP® code has long supported the use of keywords with many of the GETxxx functions, to allow the user to specify a command-line option rather than provide the input expected by the particular GETxxx function being used, just like AutoCAD commands. The INITGET function is used, prior to the GETxxx function, to specify the keywords. Several releases back, Autodesk made enhancements to the AutoCAD® command line, one of which allowed for using the mouse to click on a command-line option instead of typing at the keyboard. This was also supported in AutoLISP, and I had used it multiple times.

Over the weekend, I was working on a "quick" personal project in AutoLISP, and I wanted to include pickable keywords. The problem was, I had forgotten the syntax for setting those up, and it took me longer than it should have to both realize the problem I was having was due to improper syntax and to find the correct syntax. To save myself time when that happens the next time (and, I suspect, it will), I am documenting the proper syntax here. I had remembered that the keywords needed to be enclosed in square brackets, but forgotten about separating them with forward slashes. I wrote a quick test function, to verify that the problem was in fact with the GETxxx function message formatting; here is the final, corrected code with the correct syntax:
(defun C:TestKW ( / sKW)
  (initget 1 "Alpha Beta Delta")
  (setq sKW (getkword "\nChose a keyword [Alpha / Beta / Delta]: "))
  (prompt (strcat "\nKeyword selected is -->" sKW "<-- "))
  (prin1)
) ;_ C:TestKW.

December 30, 2016

ACA: AEC Modify Tools, Part 8, AEC Array

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

The AecLineworkArray command can be found on the Home ribbon tab, on the Modify panel flyout, by selecting the AEC Array tool from the Array flyout. If the AEC Array tool is not displayed on the Array flyout, select the right side of the split button (down arrow icon) to deploy the flyout and choose the AEC Array tool.
Or, with no command active, you can right click in the drawing window, and choose AEC Modify Tools > Array from the context menu.
If you are intending to apply this command to a Door, Window or Opening object, you can also select the object and, on the contextual ribbon tab for that object type, on the Modify panel, choose the AEC Array tool.
While the AecLineworkArray command can be used to create a linear array of any AutoCAD® or AutoCAD® Architecture object, you will probably find the standard ARRAY command more appropriate for non-anchored objects, particularly if you want an associative array or if your array has columns and rows (and levels). But for anchored objects like Doors, Windows and Openings, which will remain anchored to the host Wall, you may find the non-associative linear array created by the AecLineworkArray command to be easier to use to achieve the desired results.

AecLineworkArray Command Notes:
  • If you do not typically work with Dynamic Input turned on, you will want to to have it on when using this command, as that will allow you to key in the spacing value; otherwise, you will need to use the Pick array distance command line option and then pick two points to define the spacing value. Verify that the Enable Dimension Input where possible toggle is checked on the Dynamic Input tab of the Drafting Settings dialog and that Dynamic Input is enabled (DYNMODE system variable is set to 2 or, if you also want pointer input, 3). With Dynamic Input so enabled, you will see a dimensional input on the screen when you are in the command, and can change the value on the fly and see the potential effect on screen before committing to the array.
  • The initial prompt, Select an edge to array from or Enter to pick two points:, is asking you to define a line in the drawing. The array will run perpendicular to this line, so, for objects that are anchored to a Wall, you will want this line to be perpendicular to the Wall, so that the array projects out along the length of the Wall. A jamb line would be an appropriate choice; just hover your cursor over one until you see the highlight line, then left click to select that line. If you prefer, you can press the ENTER key and then select two points in the drawing to define the "edge to array from".
  • Once the "edge to array from" is established, you will be prompted to "Drag out array elements" or choose one of the command line options. The initial spacing value and spacing method will be whatever was used for the previous use of the command. Moving your cursor away from the edge by the spacing amount will result in a two-element array; as you move the cursor even farther away, additional elements will be added. Preview graphics, in the form of a bounding box indicating the overall extents of the arrayed object(s), will show you what you will get at the current cursor position. Selecting a point when you have what you want will end the command and create the array.
  • As previously noted, you can key in a spacing value to set the distance at which the array elements are spaced, if Dynamic Input is turned on and Dimension Input is enabled. The preview graphics will update accordingly.
  • There are two different ways in which the spacing value is applied, and you can choose one of the two command line options to select the desired method. The Offset method arrays the elements such that the distance from a given point on one object to the same point on the next instance of that object is the spacing value. The dimension of the arrayed item(s) in the direction of the array is included within the spacing value. The Clear distance method arrays the selected objects such that the distance between the objects in the direction of the array is the spacing value. The dimension of the arrayed item(s) in the direction of the array is added to the spacing value..
  • The Pick array distance command line option can be used to set the spacing value by picking points in the drawing canvas, rather than keying in a value. This can be useful if you want the spacing value to match a distance that is already constructed in the drawing, particularly if it is not a nice, round number. It can also be used if you do not want to enable Dynamic Input.
  • The Enter count command line option allows you to key in the number of instances in the final array, rather than setting this by dragging your cursor on screen. This can be useful if you have a relatively large number of items in the array, and do not want to count the items in the on-screen preview to be certain you have the right amount. The initial default value for the count will be based on how many items are currently in the array based on the cursor position and spacing value. Note that once you set the count number, the command will finish and the array will be created, so be certain to have the desired spacing value and spacing method set prior to using the Enter count command line option.
  • The Clear distance spacing method uses the overall dimension of the arrayed object(s), which may or may not be the "Width" dimension for a Door or Window. If the "Measure to" property of a Door or Window is set to Inside of frame, as my firm does with Doors, then you will need to take into account the additional width of the frame component at each jamb when determining the spacing value when the Clear distance method is used.
The following Screencast shows the command in action.

November 27, 2016

ACA: Interference Condition vs Subtraction in Area Calculations

For all of the work I have done with the Schedule Feature of AutoCAD® Architecture over the years, I have not done much with trying to produce accurate Space Schedules, particularly where Interference Conditions and/or Linework Subtraction is involved.

A question came up the other day about this, and I was surprised to learn that even though an Interference Condition "removes" any visible Hatch Component from a Space in a plan (Top) view, it does not have any effect on any of the reported Area properties of a Space. I did discover that using the AecLineworkSubtract command, the area removed does affect the reported area. I cannot speak to the reasons behind this, but given that an Interference Condition (SpaceInterferenceAdd command) only affects the Floor/Floor thickness of a Space, whereas the AecLineworkSubtract command removes the projected 3D volume of a selected 2D Polygon from bottom to top of a Space, perhaps that would be considered to be "by design".

Some additional notes regarding the use of the AecLineworkSubtract command:
  • As noted in the previously linked article on the AecLineworkSubtract command, associative Spaces are not affected (even though the command will allow you to select them as objects from which to subtract). See below for a partial exception when Manual offset boundaries are used.
  • The setting of the Offset boundaries property of a Space (By style, By Standard or Manual) will affect how the AecLineworkSubtract command works.
  • When the Offset boundaries property is set to By style, if the Space is not associative, the AecLineworkSubtract command will affect all of the reported Area values (Gross, Usable, Base and Net), with the offsets specified in the Space Style (on the Design Rules tab, at the bottom right) applied to the area to be subtracted as well. Depending upon the size of the offset and the dimensions of the area to be subtracted, it is possible that some or all of the area to be subtracted could be negated by the boundary offset, giving the appearance of there being no effect. If the Space is associative, then the AecLineworkSubtract command will have no effect.
  • The By Standard offset boundary option is only offered for associative Spaces, so the AecLineworkSubtract command will have no effect on Spaces with this setting.
  • When using Manual offset boundaries with non-associative Spaces, only the the boundaries that are currently set to be editable will be affected by the AecLineworkSubtract command. You can toggle the editability of a boundary using the round gray grips that appear around the location grip or by selecting the Space, right clicking and choosing Edit Boundary and then the boundary whose status you want to toggle, from the context menu.
    The All option on the context menu, only offered when all are not already enabled, will enable all four boundaries. The Reset option on the context menu will enable just the Base boundary. For an associative Space with Manual offset boundaries, only the Gross, Usable and Net boundaries can be manually edited; the Base boundary is associative to the bounding elements. The AecLineworkSubtract command will have no effect on the area reported for the associative Base boundary, but will be applied to the three editable boundaries.
Note: AecLineworkSubtract and LineworkSubtract are two names for the same command. The autocomplete function only recognizes LineworkSubtract, so if you are going to type the command name, omit the "Aec".

November 12, 2016

ACA: WALL Command

I was asked a question about the various command line options for the WALL command in AutoCAD® Architecture, and was surprised to find that the online Help does not have an article on this command. I suppose that, in recent years, most people use the WALLADD command to add a new Wall, most likely through a Tool Palette tool, Ribbon tool or the Styles Browser, but the WALL command still exists. There are other ways to execute the other options as well. The heyday of the WALL command was most likely back in the early days, before Tool Palettes and the Styles Manager (let alone the Styles Browser), but if it is good enough to remain in the program, it should be covered in the Help.
For ease of future reference, here are my findings on the command line options:
  • Add: This option is the equivalent of running the WALLADD command, and allows you to create a new Wall.
  • COnvert: Use this option to select lines, arcs, circles, or polylines and convert them into Walls. You will be given the option to keep or delete the selected linework. Using this option appears to result in a Standard-style Wall, regardless of what the current drawing's default Wall Style is. You may be better served by right clicking on a Wall tool on a tool palette which references the desired final style and then choosing Apply Tool Properties to > Linework from the context menu. (Applying a style to linework is not available from the Styles Browser.)
  • Properties: Use this option to select one or more Walls and have the Properties palette open (if closed) and display the Wall's properties. Unless you do not keep the Properties palette open all the time, this option is fairly worthless. Even if you keep it closed, selecting the Wall, right clicking and choosing Properties from the context menu is faster than typing WALL and choosing the Properties command option. It is a relic from the bad old days before the modern Properties palette, when each AEC Object had its own Properties dialog.
  • Styles: Opens the Style Manager, filtered for Wall Styles.
  • CLeanup groups: Opens the Style Manager, filtered for Wall Cleanup Group Definitions.
  • Dimension: Allows you to select one or more Walls and have AutoCAD Dimensions (not AEC Dimensions) added to it/them. The dimensions will be oriented parallel to the first Wall selected, so choose wisely.
  • Interference: Allows you to add or remove a Wall interference. If you are going to add an interference, you will need to have the AEC object(s) that will be the interfering objects in the drawing and selectable prior to executing the command. Likewise, to remove an interference condition requires that the AEC Object(s) doing the interfering are selectable when the command is run, so if any are on layers that are Off or Frozen, you will want to turn those layers On and/or Thaw them and your display settings need to have an active Display Representation that has visible graphics for those objects.
  • Reverse: Reverses the direction of one or more selected Walls. More easily done for individual Walls with the flip grip in more recent versions of the program, but if you had a reason to reverse the direction of a large number of Walls at once, do not want to maintain the location of the justification line, dislike using tools on contextual ribbon tabs or right-click menus and would rather not click on all those flip grips, one by one, the Reverse option of the WALL command is the way to go.

November 05, 2016

Off Topic: SEPTA Strike, Work Week 1

The union representing the City Division of the local transit agency, SEPTA, went on strike at midnight, Monday, October 21/Tuesday, November 1, leaving me with a six-mile walk to get to work each morning and again on the return trip. I usually try to get 10,000 steps in every day (weather and schedule permitting), but the strike has me over that before I even get to the office each morning.
Both sides in the negotiations have been feeding at the public trough for so long that they have forgotten that most of the people who provide the money that pays for their salaries and benefits through fares paid and tax-payer funded subsidies make quite a bit less in total compensation for equivalent levels of education and experience, and that those very people are the ones hurt most by their grandstanding and inability to compromise. Drive enough people away from using public transit, and there will not be any money to argue over.

October 30, 2016

ACA 2015 & 2016: Missing Tools in Layer Properties Manager

If you are using AutoCAD® Architecture 2015 or 2016, you may find that the New Property Filter, New Group Filter, New Standards Filter and Layer States Manager tools in the Layer Properties Manager are missing from the tool bar at the top.
As noted in this Autodesk Knowledge Network article, if you collapse the Layer Filter Tree, the missing tools will appear.
You can then expand the Layer Filter Tree, and the tools will remain visible.

Here is a brief Screencast showing this in action.

10/31/2016 UPDATE: The same issue can arise in the 2017 release, and the same workaround will bring the missing tools back there, as well.

October 26, 2016

Autodesk Answer Days

Another Autodesk® Answer Day is scheduled for October 27, 2016 (tomorrow!). This event will be held in both English and, for the first time, German. Autodesk staff will be scouring the forums for the included software, focused on product design, and providing answers to questions posted.

The German event covers AutoCAD and Inventor and takes place between 10:00 am and 5:00 pm Central Europe Time.

The English event covers AutoCAD, Inventor and Fusion 360 and takes place between 6:00 am and 6:00 pm US Pacific Time.

Read more about the event here.

October 20, 2016

Revit Families: Yes/No Parameter Defaulting to No

When you add a Yes/No parameter in a Revit® family, the initial default value is "Yes" - the box in the Value column is checked. If you only have one Type in your family at the time, it is easy enough to uncheck the box if you want it to be set to "No" and to have the value be "No" for any other Types created while that Type is current.

But there are occasions, such as for visibility parameters, where a family may get created, with multiple Types, and then later edited to add a new Type that requires a new Yes/No parameter that should only be turned on for the new Type. It is tedious to set each existing Type current and uncheck the newly added Yes/No parameter if there are more than two or three existing Types. Unfortunately, there is no way to specify the initial value for a newly added Yes/No parameter. Thanks to this post in the Who's afraid of the Big Bad BIM? blog, I have worked out a way to quickly get all types set to "No". I believe that what follows is the full intent of what the original article posted, but the article stops short of clearing the formula so that one or more of the Types can be set to "Yes" and therefore also does not note the need to change to a different Type when clearing the formula, so that all Types remain unchecked. [Perhaps that was not necessary in whatever version Erik was using in the summer of 2012 when the article was written.]

  1. Add a new Yes/No parameter to a Revit family with multiple Types, in which you want most of the Types to be set to "No".
    Note that all of the Types will be initially set to "Yes" (checked).
  2. In the Formula column for the newly added Yes/No parameter, type 1=0, and then press the ENTER key. Any expression that evaluates to false will do.
    Note that the toggle in the Value column is now unchecked, but it is also grayed out and locked, because it is being controlled by the formula.
  3. Set a different Type to be the current Type.**
  4. Delete the formula for the newly added Yes/No parameter.
  5. All of the Types are now set to "No". If you want any to be set to "Yes", set each one current, in turn, and select the toggle to check it.
The Screencast below shows the above steps in action. It also shows a second Yes/No parameter being added where the formula is deleted immediately after it was added, with the result that only that one Type is set to "No".
** - In Revit 2016, I found that if I deleted the formula in the Type in which I originally placed it, immediately after placing it, that only that Type remained set to "No", and the others remained checked. If you want, you can change to another Type and then change back to the original to do the deletion. There may be other actions which will "set" the "No" values for all Types.

September 02, 2016

ACA/AMEP: PASTEBLOCK Observation

I have been working on files that were created by others recently, and they contain a large number of Block References created using the PASTEBLOCK command, and left with the random name that gets assigned to the Block Definition by the PASTEBLOCK command. The names all start with A$C, followed by eight characters that appear to be a hexadecimal number. I find this very annoying, as you have no idea what is in any of these blocks, whereas you might if a meaningful name had been given.

Part of my current task required me to find things inside these annoying Block References, so I have been WBLOCKing them out to separate files and then opening those files to view the contents in isolation from all of the other things in the original file. I made an interesting discovery: when opening these files, the file name does not appear in the title area of the AutoCAD window and, in AutoCAD Architecture 2014 and 2016 (and, I suspect, all other versions that have File tabs), a file tab is not generated for these files. They are listed by the Switch Windows tool on the View ribbon tab, on the Windows panel, and they also appear in the Application Menu's Recent Documents list. So why do they not have drawing tabs or have their names in the title bar?

I thought there might be something wrong with my installation, so I did some admittedly brief searching on the Internet and in the online Help, and did not find any mention of this "situation." Surely I cannot be the first person to try this; perhaps I am the only one who thought it was odd.

It does not appear to be anything inside the WBLOCKed file itself. If I save the file under a different name, that does not follow the format of A$C followed by a hexadecimal number, and open that file, the file name will appear in the title area and a drawing tab will be generated. If I manually create a file and save it with a name that does follow that format (the length of the hexadecimal number does not appear to matter; so long as all of the characters that follow the initial A$C are taken from the numerals 0-9 and the letters A-F), when opened, the file name will not appear in the title area and a drawing tab will not be created.

This is not that big of a deal; I am writing this so that when I come across this in five years, having forgotten about it in the mean time, there will be at least one Internet source that discusses it.