[Solved] Button-Event "onclicked" and "command insert ..."

Started by Peter2, November 13, 2014, 01:19:28 PM

Previous topic - Next topic

Peter2

I have a button which should insert a DWG to my current  drawing, using the
Quotecommand _insert Blockname=externalFileName

Here is the code
Code (autolisp) Select

(setq test_zieldatei "c:\\test\\test.dwg")

(defun c:test_haupt_btnDateiimport_OnClicked ( / )
    (defun subroutine ()
        (setq cmdecho_old (getvar "cmdecho"))
        (command "_-insert" (strcat (vl-filename-base test_zieldatei) "=" test_zieldatei) nil)
        (setvar "cmdecho" cmdecho_old)
        (princ (strcat "\nVorlagedatei " test_zieldatei " wurde eingefügt."))
    )
    (subroutine)
)


The result is:
Code (autolisp) Select
Command: ; Error: invalid AutoCAD command: nil

I tried every single line in AutoCAD, without OpenDCL:

  • pure line (command "_-insert" ... works fine in AutoCAD
  • pure "c:test_haupt_btnDateiimport_OnClicked" works fine in AutoCAD, but error within OpenDCL
  • So I added the crazy "subroutine" and hoped that OpenDCL has no problems: now subroutine works fine in AutoCAD, but error within OpenDCL
So the basic question is:
How to insert a DWG with OpenDCL?

I found the function "dcl_InsertBlock", but it is listed as "outdated"...
Or to I have to close the dialog and open it again?

Thanks for your help

Peter
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

owenwengerd

What kind of dialog, and is the event firing synchronously or asynchronously (i.e. what is the button's Event Invoke property value)?

Peter2

It is a modeless dialog, and "Event Invoke" is "0".

(At the moment I have the same problem with a button_on_clicked with "(command"_line") -
AutoCAD command : nil
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

Peter2

Quote from: Peter2 on November 13, 2014, 02:08:08 PM
...and "Event Invoke" is "0"...
I see, I see ... :-[ :-[ :-[ :-[

EventInvoke should set to "1"   :-[

Have a nice day, Owen.
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10