Jef! Posted February 18, 2014 Posted February 18, 2014 I wrote the dcl file, it loads. I begun setting my action_tiles to send alerts to test. All my buttons work. My set_tile dynamically retrieve all the correct values, and I've test my mode_tiles varying my input. They all are as intended all the time. Great! I also have all functions written, they all work when I invoke them independently. When I tried to recall one of the (working) functions in the action_tile of one button, the dcl and cad freeze. (action_tile "converttostb" "(alert \"this alert prints\") (convtostb) (alert \"this one doesn't print, cad freeze before\") (current_plot_style_table_type_update)") It looks like my function (convtostb) doesn't work invoked by the dcl, but I can invoke it on command line without issues. Command: (convtostb)Convert.stb available. Launching conversion from CTB to STB Drawing converted from Color Dependent mode to Named plot style mode. I can't figure out why it doesn't work. Is there some functions that cannot be executed while a dcl is opened? Does anyone pinpoint what I have done wrong? Thanks Jef! Quote
Snownut Posted February 18, 2014 Posted February 18, 2014 If the function is trying to go to the drawing editor without closing the DCL box it will freeze. (ie: getpoint or similar) In short you cannot use the drawing editor as a method for user input without closing the DCL. Quote
Jef! Posted February 18, 2014 Author Posted February 18, 2014 Hi Snownut! This function is not using any getpoint, but uses getvar and getenv. Do you see that as similar? Here's the code (defun convtostb ( / oldecho) (setq oldecho (getvar "cmdecho")) (setvar "cmdecho" 0) (if (vl-directory-files (getenv "PrinterStyleSheetDir") "convert.stb") (princ "\nConvert.stb available. Launching conversion from CTB to STB") (progn (vl-file-copy (findfile "convert.stb") (strcat (getenv "PrinterStyleSheetDir") "[url="file://convert.stb/"]\\convert.stb[/url]")) (command "shell" (strcat "attrib +R \"" (getenv "PrinterStyleSheetDir") "[url="file://convert.stb/"]\\convert.stb\[/url]"")) (princ "\nConvert.stb could not be found locally and has been copied from the server") (princ "\nand has been made read-only") (princ "\Launching conversion from CTB to STB") ) ) (command "convertpstyles" "convert.stb") (setvar "cmdecho" oldecho) (princ) ) Quote
Snownut Posted February 18, 2014 Posted February 18, 2014 Try commenting out the (princ) lines.... Quote
Jef! Posted February 18, 2014 Author Posted February 18, 2014 I tried to comment all the princ lines (the whole if because the if true is a (princ).) it still hangs... I uncommented all the princ and commented the (command "convertpstyles" "convert.stb") instead and it don't hang anymore... But that command is sole purpose of that convtoctb routine. How inconvenient. What are my options? =D Quote
Snownut Posted February 18, 2014 Posted February 18, 2014 Close the DCL first then perform the command, you could incorporate this into a while loop to restart the DCL if you still need it. (happens so fast most users are unaware that the DCL was closed and restarted) Quote
Jef! Posted February 18, 2014 Author Posted February 18, 2014 Seems like a good workaround. I've tried both (action_tile "converttostb" "(alert \"will try to conv\")(done_dialog) (convtostb)(standard_scan_dcl) ") (action_tile "converttostb" "(alert \"will try to conv\")(done_dialog)(unload_dialog DCL_ID) (convtostb)(standard_scan_dcl) ") With both, the dcl don't hang up, but while it seems to process the command I end up with 2 dialogs. I can close the 2nd one, but the 1rst one remains, and even the cancel button don't work. I have to go in task manager to kill my cad app. Quote
Jef! Posted February 18, 2014 Author Posted February 18, 2014 Ok, here's what I've learned: commands cant be invoked while a dcl is opened. I managed to make it work. I'm not sure I understood how to make it in a while like you suggested, but here's how I did it. (action_tile "converttostb" "(alert \"will try to conv\")(done_dialog)(setq convtostbflag 1) ") In my dcl definition, after unloading it I added (if (= convtostbflag 1) (convtostb)) Then in my convtostb definition, at the end, if convtosbtflag exist, I (reset it to nil & launch dialog file again)... so theoretically I could use that sub function without launching the dcl as the flag wont exist. I'm pretty sure there are better ways of doing it.. but I'm glad it work. Thanks for your help and input snownut! Quote
Snownut Posted February 18, 2014 Posted February 18, 2014 You're welcome, glad I could steer you in the right direction. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.