listbox selection - insert blo
I am new to writing visual lisp routines, and i am trying to develop a routine that shows a dialog box for valves and then you can select one and hit ok and then it inserts the block that you selected. Below is what i have so far...Dcl file:
BlockSelect : dialog { label = "Select block to insert";: list_box {key = "list";height = 10;width = 40;}ok_cancel;}
lsp file:
(Defun c:valve (/)(defun ChooseBlk (lst / dcl result blkname)(defun OKClicked (/ )(setq result (get_tile "list"))(if (or (not result) (= result ""))(done_dialog 0)(progn(setq result (nth (atoi result) lst))(done_dialog 1))))(setq dcl (load_dialog "blksel.dcl"))(new_dialog "BlockSelect" dcl)(start_list "list" 3)(mapcar 'add_list lst)(end_list)(setq list (list "BALL" "BUTTERFLY" "CHECK"))(if blkname (progn )(princ "Canceled by user"))(action_tile "accept" "(OKClicked)")(action_tile "cancel" "(done_dialog 0)")(if (= 1 (start_dialog))resultnil))
any advise would be much appreciated!
Thank you Hi Matsui21,
Welcome to CADTutor!
Firstly, I would suggest that you read the Code Posting Guidlines and edit your post to format your code correctly.
Concerning the program: are you writing the program specifically to learn LISP/DCL, because if not, I would recommend you use Tool Palettes for this task - they are very powerful and easy to use.
Lee tool palettes would be fine...the only question i would have with using them is how do i make it to where other users can pull up the Palettes that i create?And then when a new version of AutoCAD is installed with those Palettes transfer?
Thanks,
Matt
You have the option to Import / Export the Tool Palettes that you create, although others may have a more streamlined solution. 1. Create a toolpalettes directory on the server.
2. Change the toolpalettepath (in options or do it by code) on everyone's computer to one on server
3. Either make the folder "read only" or have IT remove write access to that folder from everyone except you (keep people from accidentally altering something or you losing work - last out gets priority).
4. Every time you make an update to the tool palettes, everyone else will see the additions.
5. ???
6. Profit! Nice one Alan b/w ToolPalletes, the enterprise CUIx and a custom menu pulldown, I can easily streamline everything I need for every user in the office. Thanks Alan for the help on that!
Here is my next question for you and Lee; not all users are on the same version of AutoCAD...are the palettes that i create going to be able to function on different versions?
Thanks,
Matt AFAIK, it shouldn't matter - very little has changed with Tool Palettes over the years. What version differences are we talking? Your biggest limitation with version differences will lie in lower versions not being able to utilize objects/procedures created in a newer version of CAD. Rule of thumb: if you have multiple versions of CAD to deal with and have to streamline blocks, etc., always make sure to create everything with the lowest used version of CAD. A bit extra if you have your partial menu's on the server only and make a change to the mnu then next time others start Autocad they will automatically see the new menu, you do not have to go to their box and load.
页:
[1]
2