Anushka Posted August 16, 2019 Posted August 16, 2019 I'm trying to apply an action to a button to insert a block, but I get an error exception in veval-str+ arx command unhandled Can someone help me solve the problem? subfunction and how am i applying the action (defun Inblk ( name* tag1 tag2 ) (if (not (tblsearch "BLOCK" name*)) (command "_insert" name* pause "" "" "" tag1 tag2) ) ) " : butt { key = \"bt01\"; label = \"9.300\"; }" (action_tile "bt01" "(Inblk \"D_Poste\"\"9/300\" nil ) (done_dialog 1)") Quote
dlanorh Posted August 16, 2019 Posted August 16, 2019 You are trying to run a command ("_insert") inside a modal dialog. Quote
Anushka Posted August 16, 2019 Author Posted August 16, 2019 (edited) 7 minutes ago, dlanorh said: You are trying to run a command ("_insert") inside a modal dialog. it's a problem? vla-SendCommand it works ? Edited August 16, 2019 by Anushka Quote
rkmcswain Posted August 16, 2019 Posted August 16, 2019 Yes. You can't do this. See also: http://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-EA46DBF6-227F-409E-ABBB-DFC8CCE2C82F If you need the user to interact with the dialog further, then hide it, then restore it. Otherwise, close the dialog before trying to do any commands, as described in the link above. 1 Quote
dlanorh Posted August 16, 2019 Posted August 16, 2019 1 hour ago, Anushka said: it's a problem? vla-SendCommand it works ? No. Nothing works unless the form is hidden as @rkmcswain alluded to above. The "form" is Modal. Nothing will work until it hidden or ended. Are you collecting the exit state from the dialog, as you're using (done_dialog 1). I collect it by using (setq x_val (start_dialog)) Then change (action_tile "bt01" "(Inblk \"D_Poste\"\"9/300\" nil ) (done_dialog 1)") to (action_tile "bt01" "(done_dialog 1)") and after unloading the dialog (cond ( (= x_val 1) (Inblk "D_Poste" "9/300" ""))) You cannot set an attribute 'TEXTSTRING value to nil, it will error so you send it the null string "" If you are doing several block you can store the values in strings eg (action_tile "bt01" "(progn (setq blk \"D_Poste\" t1 \"9/300\" t2 "") (done_dialog 1))") Then (cond ( (= x_val 1) (Inblk blk t1 t2))) 1 Quote
Anushka Posted August 20, 2019 Author Posted August 20, 2019 @dlanorh Thank you it worked !!! 1 Quote
dlanorh Posted August 20, 2019 Posted August 20, 2019 3 hours ago, Anushka said: @dlanorh Thank you it worked !!! You're welcome. Quote
3dwannab Posted November 17 Posted November 17 (edited) I had this issue and vla-SendCommand worked for me. ;; ;; Function to rename a block withing a DCL ;; Call the function within the DCL: ;; (_renameBlock Oldname NewName) ;; (defun _renameBlock (old new / actDoc) (if (tblobjname "BLOCK" new) (princ (strcat "\n\"" new "\" block aleady exists.")) ) (if (and (tblobjname "BLOCK" old) (not (tblobjname "BLOCK" new))) (progn (setq actDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-SendCommand actDoc (strcat "-rename _B " old "\r" new "\r")) ) ) ) Edited November 17 by 3dwannab Quote
pkenewell Posted November 18 Posted November 18 (edited) @Anushka & @3dwannab You could always just use activex, which can run in the background with the DCL, since it does not use the command line: (defun _RenameBlock (bn nn / bobj) (if (and (tblsearch "BLOCK" bn) (not (tblsearch "BLOCK" nn)) ) (progn (setq bobj (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) bn)) (vla-put-name bobj nn) ) ) ) Edited November 19 by pkenewell 1 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.