i found out that the oldest version that is in use in our office is 2008 lt.
I have made the tool palettes, but am still working on writing the lisp routines because more than half our office won't be able to use the tool palettes.
I have gotten it to where the i can select a valve type and hit OK, and it will insert the block, but it will only insert the first one in the list.
LSP code:
(defun c:valve () (setq lst1 (list "GATE" "GLOBE" "BALL" "BUTTERFLY" "CHECK" "PLUG" "WAFER")) (setq dcl_id (load_dialog "blksel.dcl"))(if (not (new_dialog "blksel" dcl_id))(progn(alert "the blksel.dcl file could not be loaded!")(exit))) (start_list "lst1" 3) (mapcar 'add_list lst1) (end_list)(action_tile "accept" "(setq ddiag 2) (done_dialog)") (action_tile "cancel" "(setq ddiag 1) (done_dialog)") (start_dialog) (unload_dialog dcl_id)(setq sStr1(get_tile "lst1")) (if(= ddiag 1) (princ "\n block select cancelled!") ) (if(= ddiag 2) (if(= sStr1 "GATE")> (while (setq pt (getpoint "\nPick Insertion point.")) (command "-Insert" "GATEV" "_non" pt "" pause) )) (if(= sStr1 "GLOBE")> (while (setq pt (getpoint "\nPick Insertion point.")) (command "_Insert" "GLOBE" "_non" pt "" pause) )) )(princ))
any help would be awesome!
Thanks,
Matt When used with a list_box / popup_list tile, get_tile will return a string containing a zero-based integer index indicating the item selected.
Also I believe you will need to use get_tile before the dialog exits, i.e. in the "accept" action_tile statement.
And remember to localise your variables! Hey Lee...
so, i went away from the listbox and went to radio buttons instead but now i am getting
*error: bad argument type: stringp nil*
(defun saveVars( / choices choice1 choice2 choice3 choice4 choice5 choice6 choice7 choice8 choice9) (setq choices(get_tile "mylist")) (setq choice1(atoi(get_tile "gate"))) (setq choice2(atoi(get_tile "globe"))) (setq choice3(atoi(get_tile "ball"))) (setq choice4(atoi(get_tile "butterfly"))) (setq choice5(atoi(get_tile "check"))) (setq choice6(atoi(get_tile "plug"))) (setq choice7(atoi(get_tile "wafer"))) (setq choice8(atoi(get_tile "needle"))) (setq choice9(atoi(get_tile "angle relief"))))(defun ingate( / ) (command "-Insert" "GATEV" pause "" "0" pause) )(defun inglobe( / ) (command "-Insert" "GLOBE" pause "" "0" pause) )(defun c:valve ( / dcl_id ddiag) ;;(setq lst1 (list "GATE" "GLOBE" "BALL" "BUTTERFLY" "CHECK" "PLUG" "WAFER")) (setq dcl_id (load_dialog "blockSelect.dcl"))(if (not (new_dialog "blockSelect" dcl_id))(progn(alert "the blockSelect.dcl file could not be loaded!")(exit))) ;;(start_list "lst1" 3);; (mapcar 'add_list lst1);; (end_list)(action_tile "accept" "(setq ddiag 2) (saveVars) (done_dialog)")(action_tile "cancel" "(setq ddiag 1) (done_dialog)") (start_dialog) (unload_dialog dcl_id) (if(= ddiag 1) (princ "\n block select cancelled!") )(if(= ddiag 2) (progn (cond ((= choice1 1)(ingate)) ((= choice2 1)(inglobe))))))
i have been looking all over to try and find some kind of solution, but i have no idea where the error is coming from.
sorry for all the code posts...i am just trying to figure this out pretty quick.
Thanks,
Matt
Personally, I would find list_box / popup_list tiles easier to manipulate for this task, though radio_button tiles could also be used.
If you want to proceed with radio_button tiles, I would suggest setting a variable within the action_tile expression for each radio_button, then checking this single variable after the user has exited the dialog.
Hence the action_tile statement might be something like:
(action_tile "gate_radio_button_key" "(setq choice \"gate\")")This is the very reason that I state that list_box / popup_list tiles would be easier, since with radio_button tiles, you would require an action_tile statement for each tile; however, with either of the list style tiles, only a single action_tile statement is required to achieve the same result.
Concerning your error, use the debugging utilities offered by the Visual LISP IDE to ascertain the source and cause of the error. I have written a short tutorial on this here. Did you know that you can have a Dialouge with images ? so you could have a 3x3 4x4 etc panel and pick an image rather than a name. Obviously the coding becomes a bit more complex.
Its at home not here so can not post right now. Found a copy
//DD4x3 dialogue.Used by //Called from the AutoCAD Release 12 Standard Menu.dd4x3: dialog {label = "Please choose item";: column { : row { : image_button { key = "43sq1"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq2"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq3"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq4"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } } : row { : image_button { key = "43sq5"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq6"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq7"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq8"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } } :row { : image_button { key = "43sq9"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq10"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq11"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } : image_button { key = "43sq12"; width = 15; aspect_ratio = 1.0; color = graphics_background; allow_accept = true; } } }ok_cancel;} This may be a dumb question, but if you were to use buttons in the dialog box would it make it easier to code them to insert blocks?
Thanks! 6 of one, half a dozen of the other
Maybe you can get some inspiration from this program in which I created the Dialog interface for CAB's excellent program
[ May require membership ] That is an incredible looking program...I still have a lot of learning to do before i can understand what is going on there completely.
Can I ask a couple more questions...
With using buttons on my dcl; would i need an action_tile for each button?and then how would i callup that buttons key to tell the routine to insert a certain block?
Thanks!
Thanks! All credit to CAB, I just created/programmed the interface
Yes, since each button is an independent tile, without an action_tile statement for the tile there would be no way to evaluate a response when the user clicks the button.
I would suggest using a done_dialog call in the action_tile statement of each button, using a different 'status' argument for each. Then read back the status value from the start_dialog call to determine which block to insert. Is there somewhere on your site that gives an example of what that would look like?
页:
1
[2]