January 31, 2008

Toggling Plot Style Display in a Layout


A request in a thread in the AutoCAD® Architecture Customization Discussion Group for a way to be able to turn on or turn off the display of plot styles on a layout tab without having to open the Page Setup dialog got me thinking the other night. It occurred to be that this would be a handy routine to have, now that the tabs can be hidden in more recent versions of AutoCAD and AutoCAD Architecture, taking away the quick right-click access to the Page Setup command. It also offered me the opportunity to begin to become familiar with the "new" VL functions in AutoLISP, which became available quite some time ago, right around the time that I found myself with less time to spend writing LISP routines. As it turned out, I got a rather limited exposure to the VL commands, but I was able to make use of a few of them to change the current status of the display of plot styles on a layout tab. I posted my first version of that routine in a reply to the previously mentioned thread, and thought I would share the code here.

(defun C:PST ( ; No arguments.
/
acadDocument ; Holds reference to the active AutoCAD drawing object.
acadLayout ; Holds reference to the active Layout object.
acadObject ; Holds reference to the AutoCAD object.
showPStyles ; Holds current status of PlotStyle display on the active Layout.
) ;_ End arguments & local variables.
(cond ; Cond A
((= (getvar "TILEMODE") 1) ; Model tab is active, abort command.
(alert
(strcat
"C:PST is meant for use on a Layout tab, not on the Model tab."
"\nPlease change to a Layout tab and try again."
) ;_ End strcat.
) ;_ End alert.
) ;_ End condition A1.
(T ; Condition A2.
(vl-load-com) ; Load "vl" functions, if not already loaded.
(setq
acadObject (vlax-get-acad-object)
acadDocument (vlax-get-property acadObject 'ActiveDocument)
acadLayout (vlax-get-property acadDocument 'ActiveLayout)
showPStyles (vlax-get-property acadLayout 'ShowPlotStyles)
) ;_ End setq.
(if (= showPStyles :vlax-true)
(progn
(vlax-put-property acadLayout 'ShowPlotStyles :vlax-false)
(prompt "\nThe display of plot styles has been turned off. ")
) ;_ End progn.
(progn
(vlax-put-property acadLayout 'ShowPlotStyles :vlax-true)
(prompt "\nThe display of plot styles has been turned on. ")
) ;_ End progn.
) ;_ End if.
(vlax-release-object acadLayout)
(vlax-release-object acadDocument)
(vlax-release-object acadObject)
(command "_.REGENALL") ; Regenerate the screen graphics.
) ;_ End condition A2.
) ;_ End cond A.
(prin1)
) ;_ End C:PST.

The VL functions allow you to access the ActiveX object model (just like VBA!) in a LISP routine. Never having had the time to truly master VBA (and realizing that for ease of use, a LISP routine to run the VBA code would probably be needed anyway), for this relatively simple task it seemed to me that writing the entire thing in LISP was the better way to go. The vlax-get-acad-object function is used to get the AutoCAD "object" and save it to the acadObject variable. The vlax-get-property function is then used to get properties of the AutoCAD object and its subobjects:
  • The ActiveDocument property of the AutoCAD object is the currently active drawing object.
  • The ActiveLayout property of the currently active document is the currently active layout (or model) tab object.
  • The ShowPlotStyles property of a layout tab (not relevant for the Model tab, which can not display plot styles) indicates whether or not the display of plot styles is enabled for that layout tab. A value of :vlax-true indicates that the display is turned on; :vlax-false indicates that the display is turned off.
In developing the routine, I assigned the intermediate objects to variables, along with the value of the ShowPlotStyles property, so that I could see what sort of values each had and could figure out what my test string should be. After posting the routine, it occurred to me that I could have omitted assigning any of those values to a variable, and simply nested everything in the IF statement condition. I am not certain that would substantially improve performance, however, and felt that leaving it as written would be easier for me to decipher, should that be necessary in the future, after I have forgotten the details of how I wrote this routine.

I am also not certain if releasing the objects is necessary, given that the variables are local to the routine and should "go away" after it has run. Perhaps my next foray into VL territory will lead me to a better understanding of that.

January 24, 2008

Extend Linework to Wall Component Edge

Thanks go out to Steve Bennett for his reply in this thread in the AUGI AutoCAD Architecture 2008 Forum, for reminding me of what I am missing while using Autodesk® Architectural Desktop 2004 for production work. A similar question came up in the Autodesk AutoCAD Architecture 2008 Discussion Group today, and I was able to pass on Steve's suggestion. I decided to document it here so that I will remember it when we move to 2008 for production.

As you are likely aware, the AutoCAD® EXTEND command can be used to extend linework to a wall. When doing so, however, the linework will be extended to the justification line of the wall, which may or may not be the part of the wall to which you wanted the linework extended. The AEC Modify Tools can be used to extend linework to the edge of any component in the wall. Select the linework you wish to extend and, with grips on but none hot, right click and choose AEC Modify Tools > Extend from the context menu, as shown below.
You will be prompted to Select a boundary edge on the screen:. Move your cursor over the edge of the wall component to which you wish to extend the linework. You should get a "Boundary Edge" tool tip as well as a red line extending beyond the drawn graphics of the edge. When you have the right boundary, left click to select that as the extend edge.
You will now be prompted to Select a point near the end(s) to extend:. Left click anywhere near the end of the linework to extend, on the side that you want extended...
...and, just like that, the linework extends!

You can also trim linework to the face of any component using the AEC Modify Tools - simply pick the Trim option, instead of the Extend option, from the context menu.

Part 2 - AEC Trim

January 12, 2008

ACD-A Display System - Part 1, AutoCAD® Basics

I have been answering quite a few Display-System-related posts in the Autodesk Discussion Groups and AUGI Forums lately, and thought it would be helpful to post some information on the AutoCAD® Architecture Display System. Helpful to me, anyway, so I can just post a link, rather than (re)writing the information. The topic is a broad one, and if I wait until I have time to cover the entire subject, it will never happen. So here is the first of what I hope to be a multi-part series on the ACD-A/ADT Display System, a review of AutoCAD's display settings, as similar terms and features are used by ACD-A/ADT.

Color, Linetype, Entity Linetype Scale, Lineweight and Plot Style
The appearance and plotting of AutoCAD objects is controlled by four (CTB plot styles) or five (STB plot styles) properties of each object, which can be found and set on the Design tab of the Properties palette, in the General category.
Color: Determines the color used to draw the object on the screen. For color-dependent plot styles, also determines the plot style used to plot the object. When the object’s plot style calls for the plotted color to "use object color", also determines the plotted color (within the limitations of the plotting device used).

Linetype: Determines the pattern of dots, dashes and gaps used to drawn the object. Linetypes are defined in external text files with a LIN extension, following a prescribed format, and can be loaded into a drawing using the LINETYPE command.

Entity Linetype Scale: Three factors determine the final multiplier applied to the dashes and gaps included in the linetype definition. The first is the value of the LTSCALE system variable, which is a global scale factor applied to all objects. The second applies only to objects drawn in model space but viewed through a viewport on a layout, and is controlled by the PSLTSCALE system variable. If PSLTSCALE is set to 0, no additional scale factor is applied; if PSLTSCALE is set to 1, then a scale factor compensating for the zoom factor of the viewport, relative to paper space (often referred to as the scale of the viewport) is applied. Finally, the Entity Linetype Scale is applied. The default value for newly created entities is stored in the CELTSCALE system variable; this should, under almost all circumstances, be set to 1, to maintain a uniform look to a given linetype across all entities. On occasion, an individual entity may have its Entity Linetype Scale set to something other than 1; for example, a short line segment may need an Entitiy Linetype Scale set to slightly less than 1 to get at least one instance of the linetype pattern to show. New in 2008, an additional system variable, MSLTSCALE, allows you to work as you did before, when set to 0, or, when set to 1, allows you to set PSLTSCALE to 1, LTSCALE to the value you would use when plotting full size (1:1) and then leave these values alone, as the drawing scale will be factored into the display of linetypes in the Model tab. Read more about this new feature in this blog article.

Lineweight: Determines the relative width with which an object is drawn on the screen when the LWDISPLAY system variable is set to 1. The value of LWDISPLAY can be set using the "LWT" toggle on the Application Status Bar. When the object’s plot style calls for the plotted lineweight to "use object lineweight", then this setting also determines the plotted lineweight.

Plot Style: The plot style assigned to an object determines how the object will plot. For named plot styles, this is an explicit assignment in the drawing; for color-dependent plot styles, the plot style is assigned based on the object’s color.

ByLayer and ByBlock
In addition to assigning explicit values for color, linetype, lineweight and plot style, there are two "special" options, BYLAYER and BYBLOCK.

Assigning BYLAYER to a property causes the object to inherit the value for that property from the layer on which the object resides. Nested items within a block definition that are defined on the special layer "0" inherit the layer of the parent object, and, when "BYLAYER" is specified for a property, the value assigned to that property on the layer of the parent object.

Assigning BYBLOCK to a property of a nested object – such as an object within a block definition or a component of a dimension, causes that object to inherit the property of the parent object. If BYBLOCK is assigned to a main object, the default value for that property (color 7, continuous linetype, the drawing default lineweight and the Normal plot style) will be used for the object until it is made part of a block.

To illustrate the effects of ByLayer and ByBlock, I created a block definition that included the following items, with the noted layer and color properties. The effects of ByLayer and ByBlock, when applied to linetype, lineweight or plot style would be similar. The drawing file in which the block was created has four layers of interest: 0, color 7; Red, color red; Blue, color blue; and Magenta, color magenta.
ComponentLayerColor
LinesRed30 ("orange")
TriangleRedByLayer
Square0ByLayer
PentagonBlueByLayer
HexagonBlueByBlock
Circle0ByBlock
In the image below, the parent block is inserted on the Magenta layer in both cases; on the left side, the parent block color is set to ByLayer, which would be "magenta", and on the right side, the parent block color is set to "green".
Lines: In both cases, the two lines are "orange" (color 30), as they were defined with that color explicitly assigned, so neither the color of the layer on which they reside ("red", for the Red layer) nor the color of the parent block ("magenta" on the left or "green" on the right) have any effect on them.

Triangle: The triangle is "red" in both cases, because the triangle was defined on layer Red, and its color was set to "ByLayer", so it inherits the color of the layer on which it was placed.

Square: The square is "magenta" in both cases, because the square was defined on the special layer 0 and color was set to "ByLayer", so it inherits the layer of the parent object (Magenta) and therefore the color of that layer.

Pentagon: Like the square, the pentagon has an explicit layer assignment, in this case Blue, and therefore the "ByLayer" assignment results in the color being "blue" in both cases.

Hexagon: The hexagon is also placed on the Blue layer, but the color is assigned as "ByBlock", so it inherits the color of the parent object. On the left, that color is "ByLayer", so the color of the layer of the parent object is used – "magenta". On the right, the parent block’s explicitly assigned color "green" is used.

Circle: The circle is on the special layer 0, so, like the square, it inherits the layer of the parent object (Magenta). Unlike the square, it is assigned a color of "ByBlock", so while it appears "magenta" on the left, where the block is set to "ByLayer", on the right is appears "green", as the block is set to "green".

Note the difference in the behavior of the square and circle. Both are on the special layer 0, so both inherit the layer of the parent block object and both would not be visible if the Magenta layer were set to "Off". The square will always display with the block layer’s color, while the circle will always display with the block’s color. Sometimes those two may be the same, as on the left; other times they may be different, as on the right.

Next Article in the Series: ACD-A Display System - Part 2, Big Picture Overview

December 24, 2007

AB114-4 Class Materials and Webcast

UPDATE: Autodesk has decided to drop hosting of "old" AU content, but AUGI has stepped in and is hosting the content from Autodesk University 2000 through 2007 and is making it available to all members, including those at the "free" level (current as of 11/01/2013). My class can be found here: Forum > English Forums > Conferences > Autodesk > Autodesk University 2007 > Building Design > AB114-4: Get Fully Equipped in AutoCAD® Architecture. There is a ZIP file you can download which includes the class handout and the sample files that were previously available at the Autodesk site. The screencast is not available.

If you were not lucky enough to attend Autodesk University 2007, like those below who attended my Equipment Schedule class, you can still benefit from the session handouts and, for many classes, additional materials and screencasts of the presentations that were made.
If you are not already a registered user of the Autodesk University website, your first step will be to register and set up a login and password, on the Join page. If you have already registered or attended AU 2006 or 2007, you can login on the Login page. Login and/or Join links occur in the upper right corner of the various Autodesk University website pages, also.
Once you have logged in, click on the Sessions link,and then use the Search Sessions area to help you find the session and session materials you want. For example, to find my session, set the year to 2007 and the Speaker to "David Koch".Click on the Search button and a list of the sessions that meets the criteria you set will be displayed. In this case, that would be just one session, AB114-4.Click on the Session Name / Track link to go to a page that has details about the session, and links to the available handout, sample files and screencast. The screencast consists of the audio part of the presentation along with what was projected on the screen during the session. This year, you can also choose to download a screencast, in addition to streaming it.

December 11, 2007

AEC Survey

Want to give Autodesk a piece of your mind? You can do so, in a controlled manner, by taking the survey you will find in the link posted in this thread in the AutoCAD® Architecture Discussion Group.

November 23, 2007

Multi-View Block Tools in AutoCAD® Architecture 2008

In preparing class materials for my class at AU, I discovered an issue with Multi-View Block tools in AutoCAD® Architecture 2008. The behavior varies and seems partially dependent upon the settings for Drawing Scale and Annotation Plot Size, but what appears to be happening is that instead of respecting the X-, Y- and Z-scale factors set in the Multi-View Block tool's properties, the X-scale factor is being multiplied by the annotation scale factor (a product of the Drawing Scale factor and the Annotation Plot Size) and that scale factor is used for all three scale factors (X, Y and Z). Occasionally, the first use of a Multi-View Block tool results in the annotation scale factor being applied twice. This effect holds true both for Multi-View Blocks whose view blocks are drawn at full size, and were to be inserted with scale factors of 1, as well as for unit-block-based Multi-View Blocks, which were intended to be inserted with X-, Y- and Z-scale factors representing the overall size of that particular use of the unit block, and which were generally not uniform. None of the view blocks associated with these Multi-View Blocks had any attribute definitions or any sort of text included. While this behavior is annoying enough for the Multi-View Blocks that were to be inserted with scale factors of 1, it becomes all but a deal breaker for the unit-block-based Multi-View Blocks, as having the scale factors preset in the tool properties is critical to getting those Multi-View Blocks inserted correctly and consistently.

Even more bizarrely, the scale factors reported in the Multi-View Block tool's properties actually change with no user intervention! You will have to take my word for it, but the Draeger Anesthesia Machine Multi-View Block was set up in the source file with the correct X-, Y- and Z-scale factors and a Multi-View Block Tool created from that source file; the scale factors in the tool are correct with the source file open and the active file. Starting a new file results in the scale factors changing, as shown below.
Placing an instance using this tool results in those same scale factors being applied.


In some tests, I found that eventually the correct sizes would be set, but other times the incorrect sizing persisted for as long as I could be bothered to keep trying. I also found that once a file started behaving correctly, there was no guarantee that after saving and reopening the file (especially if AutoCAD Architecture was shut down and restarted in between), that the correct behavior would continue.

I eventually found the following two options would get AutoCAD Architecture to respect the scale factors set in a Multi-View Block tool's properties. You may need to repeat one of these options after saving, closing and later reopening the file.

1. Manually running the MVBLOCKADD command (I typed in the command at the Command: prompt) and inserting a Multi-View Block resulted in subsequent uses of Multi-View Block tools scaling the inserted blocks correctly.

2. Inserting a Multi-View Block through a Multi-View Block type of AEC Content, either directly from the AEC Content tab of DesignCenter or through a Tool palette tool that references AEC Content (drag the content from the AEC Content tab in DesignCenter onto an editable tool palette) also results in subsequent uses of Multi-View Block tools respecting the scale factors set in the tool's properties.

You could just make AEC Content of all of your Multi-View Block content, but that requires maintaining a separate file for each Multi-View Block Definition, rather than having a single source file, and you can not set Layer Key Overrides on AEC Content tools, whereas you can do so on Multi-View Block tools. Given the hassle of manually typing the MVBLOCKADD command and inserting a Multi-View Block (especially if there are no Multi-View Block Definitions in the file, which would require placing one instance from the tool at the incorrect scale, inserting one instance manually and then probably erasing them both, as the first is incorrectly scaled and the latter may be on the wrong layer and may also not be correctly scaled), I have decided that it would be easier to create a non-plotting Multi-View Block Definition, make an AEC Content file for it and finally making a tool from the AEC Content file. This tool can be placed on the same Tool palette as the other Multi-View Block tools, used once to get the scales on the Multi-View Blocks to be respected, and then that instance erased or left in place, as it will not plot. Dragging and dropping that tool is much faster than manually running the MVBLOCKADD command.

The properties of the tool that invokes the AEC Content file for the non-plotting Multi-View Block are shown below. Note that there is no additional control over the insertion, other than that set in the AEC Content file, which does not allow for Layer Key Overrides.
Using this tool results in inserting the non-plotting Multi-View Block with the scale factors (all 1) set in the AEC Content file.


Once this block has been placed, the properties of the Draeger Anesthesia Machine Multi-View Block tool magically return to the values originally set on the instance in the source file used to create the tool...
...and using the tool now results in a correctly scaled instance of the Multi-View Block being placed.


I did not see this problem in the 2007 or earlier releases, and I hope the problem can be eliminated from the the 2009 release.

October 11, 2007

Get Them While They Are Hot

Two new hot fixes have been posted for AutoCAD Architecture 2008, to be applied after Service Pack 1 is installed:

Raster Images in File Causing Fatal Errors

Linetypes Unexpectedly Displaying as Continuous

October 07, 2007

Startup Dialog in AutoCAD® Architecture 2008

If there are others out there who, like me, prefer to start up AutoCAD® Architecture 2008 the same way they have started earlier versions of Autodesk® Architectural Desktop, with the Startup dialog, you may be surprised to find that the Systems tab of the Options dialog no longer offers the option to activate the Startup dialog. This setting was formerly available in the General Options area in the upper right corner of the tab, as seen below in a screen capture from the 2007 release.
As seen below, the 2008 version no longer offers this as a setting.
Thanks to a tip posted by ScottE in answer to his own question in a thread in the AutoCAD Architecture 2008 Discussion Group, I can report that while the ability to set turn on the Startup dialog is no longer in the Options dialog, you can still turn it on, using the STARTUP System Variable. Set STARTUP to 1 to activate the Startup dialog.
If your only use of this is to select a starting template, then you may not need to activate it. I find it useful for those occasions where I want to start a file from scratch, such as when I am creating the initial working file from which I will create AEC Content, and I want to keep the overhead in the AEC Content file as low as possible.

September 19, 2007

AU Early Bird Deadline Coming Up Fast!

The early-bird registration deadline is October 7, 2007. That is little more than two weeks from now. If you have been considering going to AU this year but have not yet registered, get your ducks in a row and do so before October 7, or it will cost you an extra $500 US.



This message brought to you as a public service by Get Fully Equipped in AutoCAD Architecture (AB114-4), Tuesday, November 27, 3:00 - 4:30 pm. I hope to see you there.

AutoCAD® Architecture 2008 Service Pack

Service Pack 1 for AutoCAD® Architecture 2008 is now ready for download; you can find it here. Do not forget to download and read the README!