2009-02-19 20:57 UTC
I'm relatively new to OpenDCL. I have run into a snag on an application I am working on. I have a modeless dialog box. When a text button is clicked the following event handler kicks in:
The event handler above calls the following subroutine (plsub:InsertBlock) which is shown below:
Once the code executes the "(command "._insert" ..." line the application bombs and the AutCAD command line reads: "Error: invalid AutoCAD command: nil; reset after error".
What am I missing?
Thanks,
Will
;;define action when the insert button is clicked
(defun c:partlibmain_PartLibMain_Insert_OnClicked (/ Dwgname)
(setq Dwgname (dcl_ListBox_GetSelectedItems partlibmain_PartLibMain_ListBox1))
(plsub:InsertBlock Dwgname)
);end defun
The event handler above calls the following subroutine (plsub:InsertBlock) which is shown below:
;;;Subroutine for inserting a block into the current drawing
(defun plsub:InsertBlock (Dwgname / Dwgpath insertpt)
;;save current objects snap settings
(setq oldosmode (getvar 'OSMODE))
;;construct the path of the drawing selected
(if Parent
(setq Dwgpath (strcat "G:\\Blocks\\" Parent "\\" Child "\\" DwgName ".dwg"))
(setq Dwgpath (strcat "G:\\Blocks\\" Child "\\" DwgName ".dwg"))
);end if
(setq insertpt (getpoint "Specify an insertion point: "))
;;turn off object snaps
(setvar "OSMODE" 0)
;;insert the block
(command "._insert" Dwgpath insertpt 1 1 0 "")
;;Restore object snaps
(setvar "OSMODE" oldosmode)
);end defun
Once the code executes the "(command "._insert" ..." line the application bombs and the AutCAD command line reads: "Error: invalid AutoCAD command: nil; reset after error".
What am I missing?
Thanks,
Will