arion279 Posted January 26, 2022 Posted January 26, 2022 Hi there, I've had a maddening problem all day. I've trimmed the code below to its base elements and it still does not work. The (get-or-add-dict) function is not included below but that function is fine. The problem is: Calling (addtest) at the command console works perfectly... as does calling the C:T2 command which only calls (addtest)... but if I was to execute the T1 command to open an OpenDCL dialog, then click the "SaveButton" button, which executes the "c:test/Form1/SaveButton#OnClicked" defun, the script always bombs out right at the point of creating the new xrecord entity using entmakex. Again, the script by itself works just fine when not using inside of an OpenDCL defun. Is there a setting or feature I need to include to make this work? My objective is to save data in the OpenDCL dialog to xrecords so they can persist across different sessions of a project. Any help is greatly appreciated. (defun addtest ( / dict xrec) (setq dict (get-or-add-dict)) (setq xrec (entmakex (list (cons 0 "XRECORD") (cons 100 "AcDbXrecord") (cons 1 "Custom String") ))) (dictadd dict "test" xrec) ) (defun c:T1 () ; call the method to load the HelloWorld.odcl file. (dcl_Project_Load "HPLR/test" T) (dcl_Form_Show test_Form1) (princ) ) (defun c:test/Form1/SaveButton#OnClicked (/) (addtest) ) (defun C:T2 () (addtest) ) Quote
arion279 Posted January 27, 2022 Author Posted January 27, 2022 I found the answer on another link and thought I'd share in the event someone else has this issue. In OpenDCL Studio you have to set the button that performs the function that calls (entmakex) to "1 - Asynchronous" to use the (entmakex) function. Otherwise (entmakex) just won't work. https://www.theswamp.org/index.php?topic=50568.msg557037#msg557037 Quote Yeah , you were right , it is a matter with EventInvoke and it has to be set to 1 - Asynchronous . 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.