Visual LISP, AutoLISP and General Customization

Active Contributor
Posts: 48
Registered: ‎07-20-2011
Message 1 of 2 (165 Views)

custom buttons with script-like functionality. Help me get started

165 Views, 1 Replies
05-18-2012 10:53 AM



I would like to build a custom button that mimics the FDO - Save as AutoCAD drawing functionality. Clicking this button brings up a wizard with too many clicks for how often the users will do it.


They will not want to load a script so a custom button is required. Also, I need to be able to dynamically set the new saved file name based on the source DWG file name.


What documentation should I be reviewing to get started with this? thanks.

*Expert Elite*
Posts: 2,314
Registered: ‎12-18-2002
Message 2 of 2 (143 Views)

Re: custom buttons with script-like functionality. Help me get started

05-18-2012 08:45 PM in reply to: tmblackflag

(defun c:whatever(/ dwgnm dwgfld nmandfld)
  (setvar "FILEDIA" 0)
  (setq dwgnm (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)))
  (setq dwgfld (getvar "dwgprefix"))
  (setq nmandfld (strcat dwgfld dwgnm "_FDO.dwg"))
  (alert nmandfld)
  (setvar "FILEDIA" 1)


This code will export the current map as a dwg of the same name as the current drawing, but with "_FDO" appended. It saves the new drawing to the same folder as the current drawing. You might want to remove the alert. I put it there so the user will be told what file is being saved, but it's not critical. And, of course, you will want to change my c:whatever nomenclature to a name that makes sense to you.


Is this what you were looking to do? If you don't know how to put this on a button, read up on the CUI, including how to create a new command and how to add a command to a ribbon panel.





Tim Corey, Owner
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community