CAD PANACEA HAS MOVED TO http://cadpanacea.com
31 January 2007
D - Drafting Settings          

A quick tip regarding the Drafting Settings dialog box. It is possible to open this dialog and set the visible tab. You may want to do this if you want to access a certain tab from within a lisp file, a menu, toolbar button, or even a tool palette.

Recall that that actual command for this dialog box is "DSETTINGS". So at the command line, simply prefix this command with a "+".

Command: +DSETTINGS
Tab Index <0>:0

Notice that it prompts you for a "Tab Index". This is a zero based index corresponding to the tabs in the dialog. "0" displays the first tab, "1" displays the second tab, and so on. The above command would open the dialog with the "Snap and Grid" tab visible. If you wanted to display the "Dynamic Input" tab, you would specify an index of "3".

Doing this on the command line isn't much help, since you can open the dialog and pick the tab you want quicker than you can remember what "index" to select, however if you want direct access to a particular tab, you can use a lisp statement.

The following example will open the dialog to the "Object Snap" tab:

(command "+DSETTINGS" "2")

Labels:


PermaLink       Posted 1/31/2007 08:30:00 AM      Comments (0)
16 January 2007
MDI Document Navigation          

Since AutoCAD move to the MDI world back in 1999, users have wanted a fast way to switch drawings. Some of these include...

  • Set the system variable TASKBAR to 1 and you get a button for each open drawing on the Windows taskbar. This is how R14 would have appeared when you had multiple "sessions" open.
  • The Windows pull-down menu allows you to select an open drawing.
  • Ctrl+Tab cycles through drawings pretty quickly if you are a keyboard junkie.

How about another layer of "tabs" like you have for switching layouts? 8 years later and it's still not built into AutoCAD, but there are several vendors out there with add-on's that provide this functionality. We use the "DWG Tabs/Manager". It's basic, but free and stable. I have tested some, but NOT all of these. This is not meant to be a rating grid, only a summary so that if you are looking for this type of tool, all the links are here.

If I have missed any, let me know.

Name Version Cost Notes
DWG Tabs/Manager 2000-2007 FREEVery basic, but stable.
DWGSTRIP 2000-2007FREE  
iDwgTab 2000-2007 FREE Multiple files, no install program. Customizable.
AcadXTabs™ 2000-2007 See Prices  
DocBar 2000-2007 See Prices Many features as seen on website.
Drawing Tabs 2007 Only FREE Limited features, no Vista support, no tooltips in Win2k.

Labels:


PermaLink       Posted 1/16/2007 08:22:00 AM      Comments (1)
10 January 2007
C - Calculator          

Here's old oldie, but a goodie...

Most users of AutoCAD 2006 and above know about the 'new' QuickCalc command, the built in calculator, but many users don't know that AutoCAD has had a built-in calculator since R12. It's command line based, but very powerful.

You can use it alone or within an active command. I still prefer the old command line version over the new QuickCalc. Here are some examples.


Example 1: Use it as a plain old calculator. At the command line, type ._CAL and enter an expression like 95/7 which will return 13.571428571429

Example 2: In this example, we are going to apply the result of a calculation directly to a input prompt. Suppose you want to draw a circle whose radius is 99.03 + 74.33 + 69.08. You might reach for your HP handheld and add these up, then draw your circle, but you can do this right inside of the ._CIRCLE command instead.

Start the ._CIRCLE command, pick the center point. Now you are prompted for the radius, so enter 'CAL, then the equation. The result is calculated and the circle is constructed.

Command: ._CIRCLE
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]:
Specify radius of circle or [Diameter] <112.848>: 'cal
>>>> Expression: 99.03+74.33+69.08
Resuming CIRCLE command.
Specify radius of circle or [Diameter] <112.848>: 242.44
Command:


Example 3: This is similar to example 2, except we are going to get one of the distances from the drawing itself. This time the circle radius is specified by two points in the drawing + 150.5.

Start the ._CIRCLE command, pick the center point. Again, you are prompted for the radius, so enter 'CAL, then the equation. The result is calculated and the circle is constructed. In this example "cur" is part of the equation used to tell AutoCAD that you are going to pick a point on the screen.

Command: ._CIRCLE
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]:
Specify radius of circle or [Diameter] <242.440>: 'CAL
>>>> Expression: dist(cur,cur)+150.5
>>>> Enter a point:
>>>> Enter a point:
Resuming CIRCLE command.
Specify radius of circle or [Diameter] <242.440>: 766.99064463655
Command:


Example 4: Suppose you have a line that's 99 units long, and you want to place a circle on the line whose center is 1/3 the distance of the line away from an endpoint of the line. Simple math tells you to place the center of the circle 33 units from the line endpoint.

But what if the line's length is unknown and you want to place a circle 2/9ths from one endpoint? This is a little more involved.

You might...

  • Change the units precision to the maximum
  • List the line.
  • Write down the answer.
  • Change the units back.
  • Take the answer, enter it into your handheld HP.
  • Multiply by 2/9.
  • Draw a construction line from the line endpoint this distance along the line.
  • Start the circle command at this endpoint.
  • Erase the construction line.

...or you could...
  • Use the ._DIVIDE command
  • Divide the line into 9
  • Set PDMODE to something like 32 so you can see the newly created points.
  • Draw your circle
  • Erase the 8 POINT objects that were created by the ._DIVIDE command.
  • Restore PDMODE


That's nine or six steps, depending on how you do it.


Here are the steps using the built-in calculator.


Command: ._CIRCLE
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]: 'CAL
>>>> Expression: plt(end,end,2/9)
>>>> Select entity for END snap:
>>>> Select entity for END snap:
Resuming CIRCLE command.
Specify center point for circle or [3P/2P/Ttr (tan tan radius)]:
3018809.0299135,1320280.6000424,0
Specify radius of circle or [Diameter] <766.991>:
Command:

Notice that this time, a coordinate was returned instead of a number.

So this was a bit shorter than the other two ways, and we didn't have to make any temporary lines or points.

In this example the "plt" function was used. "plt" is a built-in function that accepts two points that define a line, and a third parameter which specifies a parametric position along the line. I used "end" to specify the line endpoints, this works like the "endp" object snap to return the endpoint of a selected line. We could have used "cur", which would have accepted any picked point, but you would have to specify the "endp" of the line yourself.

This is just a few ways to use the CAL command. There are many, many more uses.

Tell me your favorite.

Labels:


PermaLink       Posted 1/10/2007 08:56:00 PM      Comments (0)
04 January 2007
B - Blockicon command          
If you have some old drawings that contain blocks, you can use the ._BLOCKICON command to update the icons associated with those blocks. The command accepts wildcards when you are specifying the blocks to update, so * will update them all.


Labels:


PermaLink       Posted 1/04/2007 07:50:00 PM      Comments (0)
03 January 2007
A - ADC commands - Design Center          
Here are a couple of tips regarding the use of Design Center.
There are some commands that may be useful when working with menu macros or lisp files.

  • ADCSTATE - Query this system variable if you need to determine if Design Center is open or not. 1=Active, 0=Not Active
  • ADCENTER - Opens Design Center
  • ADCCLOSE - Closes Design Center
  • ADCNAVIGATE - Use this command to set the active directory in Design Center.

Let's say that you want to create some menu items that open Design Center to a certain directory, and that you have 3 of these to create. There is no need to create 3 separate functions to do this.


Let's create a single function that will open Design Center and navigate to a certain directory.


(defun adc:go (dir)
(if (zerop (getvar "ADCSTATE"))
(command "._ADCENTER")
)
(command "._ADCNAVIGATE" dir)
(princ)
)

Now, you can call this routine in your custom menu, like this:

[Design Center BLOCKS]^C^C(adc:go "C:\\CAD\\MYBLOCKS")
[Design Center DYN BLOCKS]^C^C(adc:go "C:\\CAD\\MYDYNBLOCKS")
[Design Center SEALS]^C^C(adc:go "C:\\CAD\\MYSEALS")

Now you are opening Design Center to a certain directory, using the same code over and over, by passing the name of the directory to the ADC:GO function.


Save this ADC:GO function in the MNL file that goes with the menu. If your menu file is named CUSTOM.CUI, then the MNL file should be named CUSTOM.MNL. If this file doesn't exist, just create it.


An MNL file is just a lisp file. When a menu file is loaded, it looks for a MNL file with the same name and loads this file also.

Labels: ,


PermaLink       Posted 1/03/2007 07:31:00 AM      Comments (0)