Steven Matchett explains how to customize AutoCAD command macros to quickly set views in model space.
"This tip addresses setting the clipping planes in a 3D drawing for a specific distance for a specific view. First, create the view buttons in the CUI (Customize User Interface). Mine look like this:
"The magenta buttons are for drawings in imperial measurements (12" in front and behind the selected parts); the green ones are for drawings in metric measurements (225 mm in front and behind the selected parts).
"Next, edit the macro line for each button as shown below:
TOP: ^C^CUCS;W;UCS;O;DVIEW;;PO;@0,0,18;CL;B;-12;CL;F;12;; (CHANGE THE 12 TO 225 FOR METRIC)
FRONT: ^C^CUCS;W;UCS;O;UCS;X;90;DVIEW;;PO;@0,-18,0;CL;B;-12;CL;F;12;; (CHANGE THE 12 TO 225 FOR METRIC)
BACK:^C^CUCS;W;UCS;O;UCS;X;90;UCS;Y;180;DVIEW;;PO;@0,18,0;CL;B;-12;CL;F;12;; (CHANGE THE 12 TO 225 FOR METRIC)
RIGHT:^C^CUCS;W;UCS;O;UCS;X;90;UCS;Y;90;DVIEW;;PO;@18,0,0;CL;B;-12;CL;F;12;; (CHANGE THE 12 TO 225 FOR METRIC)
LEFT:^C^CUCS;W;UCS;O;UCS;X;90;UCS;Y;-90;DVIEW;;PO;@-18,0,0;CL;B;-12;CL;F;12;; (CHANGE THE 12 TO 225 FOR METRIC)
CLIP OFF: ^C^CDVIEW;;CL;B;OFF;CL;F;OFF;;
(Click to enlarge image.)
"To explain how the macro works, I will use the right clip as an example: ^C^CUCS;W;UCS;O;UCS;X;90;UCS;Y;90;DVIEW;;PO;@18,0,0;CL;B;-12;CL;F;12;;
All of the semicolons (;) represent a keyboard Enter, all of the backslashes () represent user picks (clicks of the left mouse button). - The first command sets the UCS to World. ( ^C^CUCS;W;)
- The second command sets the origin of the UCS. The user picks this point at the location he or she wants to look at. (UCS;O;)
- The third set of commands rotates the UCS about the x and y axes. (UCS;X;90;UCS;Y;90;)
- The fourth command (DVIEW;;) waits for the user to select a set of objects with a two-point crossing window (from right to left; you must pick two points and be careful not to select an object with your first click).
- The fifth command (PO;) waits for the user to select a camera point (use the same point as in the second step)
- The final set of commands (@18,0,0;CL;B;-12;CL;F;12;;) sets the camera viewpoint (@18,0,0), then turns the front and back clip planes on with a distance of 12" in front of and behind the point selected in the second and fifth step.
"I know there is a lot of information here, but I find these commands very useful when I am working with a very complex model. These commands are best used when in an isometric view so you can easily pick the same point for steps two and five. The values (12 & 225) can be replaced with any values that the user wants to use; the smaller the number, the smaller the depth of view will be. These commands work 99% of the time; sometimes, however, the view could be slightly skewed. If this happens, just reset the view and retry."
Notes from Cadalyst Tip Reviewer Brian Benton: This tip seems more complicated than it really is; each of these custom commands is nothing more than a macro. They have a preset series of command entries that will rotate your view and create a custom UCS, allowing you to work in a specific plane. |