Create custom Chamfer commands with different values

Create custom Chamfer commands with different values

Create custom Chamfer commands with different values

How do I create custom Chamfer commands with different values. For instance I want a chamfer command for a 1/16” , 1/8”, 3/16”, and 1/4" I would prefer to have separate icons for each size. I'm having trouble with the exact syntax.
I am using AutoCAD Mechanical 2015.

RE: Create custom Chamfer commands with different values

You can do this with a Lisp routine.
Locate the file in your Autodesk folders called "acad.lsp" (or create a new one with a text editor if there isn't one already there).
This file should be put with the rest of your AutoCad files but the folder structure changes with each release.
You will also want to look through the Options -> Files list in AutoCAD where the exact address of LISP files is stored.
The "ACAD.LSP" file at that location is automatically loaded every time AutoCAD runs.

Then you can write a one-line script for each pre-programmed chamfer command followed by the size prompts as needed.
Once that is done, use the CUI to create custom buttons that invoke the Lisp commands you created.

Here is an example from mine. Instead of typing "XL" and then "V" to make a vertical Xline (construction line) I created "XV" in my ACAD.LSP file:

CODE -->

(defun c:xv () (command "xline" "v"))

Here's a more complicated one. It's a sequence of commands that I use to select an object, make a copy, and rotate it 90 degrees to the original just by typing "CORO":

CODE -->

Your chamfer command would work like these. Create one line per shortcut, call it something like CF1, CF2, etc. and set the size for each on that line.

I'm a little less familiar with creating buttons through the CUI. It can be done, and I did it many many years ago. I don't even know if it works the same way in 2015 like it did ten years ago. I'll let someone else chime in for that.

STF

RE: Create custom Chamfer commands with different values

All I do is put the command, and answer prompts for distances, etc, then let the running command turn control over to me to select the 2 lines to chamfer or fillet. I also use this for a few standard "scales" I use frequently. For example: "chamfer d .25 .25;" then the command releases control to you to pick your 2 lines - Then I pick my 2 lines. If a polyline, it might look something like "chamfer d .25 .25 p;" then the command releases control to you to pick the polyline. This is what you'd put in the command macro line of the CUI dialog. (possible examples only: YOUR personal research is REQUIRED for exact command and format.)

For first-timers, it LOOKS intimidating, but if you'll take just a moment and just examine the available tabs, etc, in the dialog box - it really is something you can figure out with only a little bit of patient effort. Its NOT obvious, but it's also NOT difficult. Also you might get a SPACE or a semicolon (;) (which equals a space) wrong, and the command doesn't work quite like you expected, but that's ok. just go back and add or subract the " space " or " ; ", and you're good. A " space " and a semicolon "; " is the way you pot in the "Return" or "Enter" required by the command if you typed it in at the command prompt. Another thing - if you want the command to pause for you to pick something (or other input from you) use a back-slash ( \ ) at that point in your command.

You're creating a new command item, so you need to look into what the dialog box has you do, to insert a new command. It's right there, so open the Help while you examine the dialog box, and go for it !

Finally, PLEASE read up just a little from the CUI "Help". It'll talk about not modifying the base menu but making a sub-menu or something else to load so you don't corrupt the base default menu that came with your AutoCAD. A possible to approach might be to create a replaceacble menu from the entire base menu, and load that instead. Important possibility, if you're concerned about messing up the menu that came with your AutoCAD, but not necessarily the only right choice.

When was the last time you drove down the highway without seeing a commercial truck hauling goods?The ubiquity of these machines underscores the important roll they play in modern commerce. Download Now