Jump to content

Recommended Posts

Posted

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)")

 

Posted

You are trying to run a command ("_insert") inside a modal dialog.

Posted (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 by Anushka
Posted
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)))

 

  • Thanks 1
Posted
3 hours ago, Anushka said:

@dlanorh Thank you it worked !!!

 

You're welcome.

  • 5 years later...
Posted (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 by 3dwannab
Posted (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 by pkenewell
  • Thanks 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...