Creating layout & logic AutoCAD plugin dialog

Creating layout & logic AutoCAD plugin dialog

Anonymous
Not applicable
1,519 Views
5 Replies
Message 1 of 6

Creating layout & logic AutoCAD plugin dialog

Anonymous
Not applicable

Brand new to AutoCAD plugin development. I'm trying to create a plugin that loads as an entire main menu option inside of AutoCAD (let's call this menu the "Fizzbuzz" menu, and when the user selects one of the menu items (say, Fizzbuzz >> Foobar) I want a simple dialog/window to show up on screen in the top-left corner of AutoCAD.

 

I'm trying to figure out where the presentation/layout logic for this dialog/popup window needs to go (what file does it live in and how do I create/edit it?), and just as importantly: where the event-driven GUI logic needs to go (again: what file do I edit and in what language?). By "GUI logic" I mean: let's say there's a checkbox or button inside my dialog...when the user clicks/interacts with these UI components, I need custom logic to execute.

 

Any idea what files house this type of presentation/GUI logic for new AutoCAD plugins and how I create/edit them? Thanks in advance!

0 Likes
1,520 Views
5 Replies
Replies (5)
Message 2 of 6

Jonathan.Trostad
Advocate
Advocate

I guess it kinda depends on what you want your dialog to do. AutoCAD supports Visual LISP and DCL internally to build dialogs & fire code. They typically go in LSP and DCL files, but could also live in an MNL file. You can also run VBA which makes the dialogs a bit easier to layout, if VBA code is in your wheelhouse, but i don't think it can touch all of the content of ACAD like LISP can. You could also do a hybrid, LISP that fires VBA code or vice-versa. The first Priority is to decide on what your widget does, & then investigate which tool is best for that job.

 

Hope that helped

0 Likes
Message 3 of 6

Anonymous
Not applicable

Thanks so much @Jonathan.Trostad! Thatis extremely helpful!

 

Digging a little further based on your response, it definitely looks like MNL files contain Lisp-like code in them, so I think that addresses my question regarding where event-handling/GUI logic code lives.

 

But let's say I had a listbox that was populated with dozens and dozens of items, allowing the user to select one of them and then click some button to make the selection official. Where would the listbox, the button, and the data populating all the listbox choices/items all be stored? Thanks again!

0 Likes
Message 4 of 6

Jonathan.Trostad
Advocate
Advocate

Well, if you are driving this dialog from the MNL file you are likely using LISP, so you have options. Traditionally, you would build a DCL file & have the dialog's code in there (no information, just the code that draws the dialog itself), which would get called on by the LISP living in your MNL file, but you could potentially have the LISP file build the dialog on the fly based on which of your options is actually available at the time the code is fired. To Fill your dialog with options, you could hard-code it in your LISP program, or you could tell the LISP to fill the dialog options from either the AutoCAD DWG, or an outside file like a TXT file or an Excel file, or a word DOC. It really depends on what you are after. Which goes back to: what does this dialog do? where is the data I'm responding to? What is my desired end result when i click OK? Am I Altering the drawing in some way? Am I delivering information from 1 document to another? Am i trying to change the drawing environment to more efficiently do a task? Am I firing up the dialog, or is AutoCAD automatically responding to some condition? are the dialog options ALWAYS going to be the same, or could my drawing (or some other influence) change what options are actually available? These will all factor in on how you build this thing, and where the ending logic should live.

0 Likes
Message 5 of 6

Anonymous
Not applicable

Thanks again @Jonathan.Trostad -- what about an ARX (ObjectARX) file? Could that possible be the source of various UI component's data (listboxes, labels for things, etc.)?

0 Likes
Message 6 of 6

Jonathan.Trostad
Advocate
Advocate

ObjectARX is a set of tools for those who want to program in a deeper language like C++. It provides a set of hooks into ACAD so those languages can more easily interface. If you want to use that, then you would build your dialog in one of those languages and use the hooks provided in the ObjectARX developers kit to tie into AutoCAD. 

 

you can read the FAQ HERE

0 Likes