Tuesday, August 01, 2006

Toggling TILEMODE

To switch between Paper Space and Model Space, AutoCAD expects you to toggle the value of TILEMODE, either by entering TILEMODE at the command line and changing its value (0=OFF, 1=ON), or clicking on the Model/Layout tabs at the bottom of the drawing editor.

The downside to both of these methods is that AutoCAD does nothing to handle Linetype Scaling.

Why is resetting LTSCALE important?

If you toggle TILEMODE without accounting for LTSCALE, either your linetypes will fail to display in Paper Space because they're too large, or they'll be far too small and generate many times more segments than are needed for Model Space. This can drastically impact performance by using up a significant amount of your resources just to hold the display list.

When PSLTSCALE is 1 (On), Paper Space Viewports automatically apply the inverse of the Viewport Zoom scale factor (times the LTSCALE) as the linetype scale for entities in that Viewport.

You can create a menu button for changing Paper/Model Space that not only toggles TILEMODE but resets the LTSCALE and PSLTSCALE beforehand. Your AutoLISP code for this button might look something like this:
(if (zerop (getvar "TILEMODE"))
(progn
(initget 7)
(setvar "LTSCALE" (getint "\nLTSCALE: "))
(setvar "TILEMODE" 1))
(progn
(setvar "LTSCALE" 1)
(setvar "PSLTSCALE" 1)
(setvar "TILEMODE" 0)))
This code snippet checks the current value of TILEMODE. If it's 0 (zero) it means you're currently in Paper Space so it prompts you for a target LTSCALE value, then toggles to Model Space. If TILEMODE is not 0 (zero) you're in Model Space, so it sets LTSCALE to 1, enables Paper Space linetype scaling, then toggles to Paper Space.

(You could add additional program code to try to divine the target LTSCALE for you rather than stopping to prompt you, but that's more than I want to get into in this post.)


In the image above TILEMODE=0 (Paper Space) with PSLTSCALE=1 and LTSCALE=1; the linetypes for entities in the scaled Viewports and the entities in Paper Space all display correctly.

3 Comments:

At 12:55 PM , Blogger Scott Durkee said...

Does anyone at Benham still use the Tilemode Toggle command, TT?

 
At 1:53 PM , Blogger Ward Romberger said...

Oh yeah! It's still our primary mechanism for toggling TILEMODE.

 
At 4:00 AM , Anonymous keinin said...

THANK YOU for posting! i got puzzled while studying AutoCAD on this topic ;9

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home