Graphics Section Performance

3 likes Updated 5/14/14 3:07 PM by RyanKoppelmanTags: None

Drawing “Size”

There is often a misconception that the size of a drawing, be it the physical area that it occupies in the world or the amount of bytes it occupies on a computer, has a direct impact on how long it takes to display in a TRIRIGA graphics section. In actuality, the main factor affecting performance is the number of entities visible at the time the graphic is rendered to the user, and often the relative “size” of the drawing has little correlation to this.

An entity is an individual object, such as a line segment, that exists in a CAD drawing (these are generally referred to as “elements” in MicroStation). A polyline, which can be comprised of multiple line and/or arc segments, is also an entity--and it is a single entity regardless of how many vertices and segments it contains. In many cases CAD drawings will contain layers with information about walls, doors, furniture etc. that are comprised of “exploded”, singular entities rather than polylines.

Simple Chair

The chair above looks simple, visually it’s only 4 distinct shapes and could be easily represented by 4 polylines, however in this case it is actually comprised of 27 individual entities, consisting of disconnected arcs and line segments. The difference between 4 and 27 is not large, but imagine a furniture layer on a floor plan that contains 500 chairs, which is not excessive. A layer that could have been comprised of only 2000 entities has instead 13500, increasing the load time for that single layer by a factor of nearly 7. Normally, any drawing that contains furniture blocks in this state will have the same issue with other components of the drawing, which will have a major overall impact on performance.

 

Graphic Layer Config

One means of improving performance on the TRIRIGA side is to start small by limiting what is initially loaded for all users in the system. This can be accomplished via Graphic Layer Config records, which are normally found under Tools > Administration > Graphics in the main menu. By default we include a record that initially turns all layers off with an entity count greater than 1000:

Graphic Layer Config

This can be lowered to have a more dramatic effect; it can even be decreased to 1. It is important to note that Graphic Layer Config records have no impact on attached layers, so even if you set this to 1, all of your attached polyline layers will still load completely. This is often ideal for most use cases, and as a result graphics across the system will load quickly regardless of their “size”. Users that require more information at the time of display can use the Layer Manager to turn on the layers they need to view or export.



Simplifying Drawings

If the complex layers that a Graphic Layer Config normally turns off are used fairly often, the ideal approach to limit load times is to go back through your CAD drawings and clean them up, joining exploded blocks and other unconnected entities. While this may seem like a large effort, it can actually be very easy and the impact on performance is dramatic. The best way to demonstrate this is a real-world example, like this floor plan:

Original Floor Plan



This AutoCAD architectural reference file contains an excessive amount of geometry, especially on the furniture layer. As-is, when published to a graphics section the drawing renders all layers in about 50 seconds, where 45+ seconds of that is the furniture layer. In order to improve that, we'd start by reducing the individual entities in the furniture blocks. Note: If there is repeated furniture in your drawing that is NOT in blocks or cells, the first step will be to create blocks/cells so you're not editing the same thing multiple times. In this case, the desk/chair repeated for each cubicle is represented by a block that looks like this:

Original Block

There are 101 individual entities just to display a simple workstation. In AutoCAD, one quick way to simplify this is to take advantage of the JOIN option of the PEDIT command. After initiating the PEDIT command, you can select all the entities, convert them to polylines if applicable, and join them at a given threshold. Here's an example of the command sequence:

Join Command Results

In under 10 seconds, this join command has reduced the total number of entities for this block from 101 to 29, and the total number of entities on the furniture layer by about 25000. More importantly, because this can all be done via the command line it can be easily automated via a simple LISP routine. If you are unfamiliar with writing LISP that will open a set of drawings in batch, there are existing free utilities like StarBatch that can do this work for you. Beyond this you just need your script to call the noted commands on the requisite layers.

As a more manual approach for trouble areas and an even more dramatic improvement, you could optionally remove unnecessary geometry and/or redraw some of it by hand. The desk/chair above in it's simplest form can be represented with 2 polylines alone:

Simplified Block

When applying the use of the PEDIT join option as well as some manual simplification across the entire floor plan, the load time in the graphics section with all layers on is reduced from 50 seconds to under 5 seconds.

 

Summary

For initial display of a graphic, it is often best to only load what you need for the average use case with Graphic Layer Config records. In the majority of cases one would use the graphics section for reporting, interaction, or locating attached entities like spaces. Extraneous detail in these scenarios often only serves to clutter the graphic. For users that wish to optionally display more complex layers such as furniture or architectural detail, load times across the system can be dramatically improved by simplifying your drawings, either through manual editing and cleanup, or use of your CAD application's built-in features.