Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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 -->

(defun c:coro   () (command "copy" pause "" "0,0" "@" "rotate" "p" "" pause "90")) 

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.


RE: Create custom Chamfer commands with different values

I create both shortcut menu items and buttons.

Under pull-down menu: TOOLS-Customize-CUI,

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.

(Notice no mention of using "LISP.")

[ Hint: Among other things - like toolbar buttons, etc, I've modified my DEFAULT and my EDIT right-click shortcut menus ... EXTENSIVELY for my 3D Modeling - with NO LISP involved in a single command. Just sayin' ...! ;) ]

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close