OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: jarods350z on September 26, 2014, 09:01:50 AM

Title: help with lisp and open dcl box
Post by: jarods350z on September 26, 2014, 09:01:50 AM
I am having an issue getting one of my old files to work. the tool is a command that will bring in an AIA layer list and add the layers to acad.

for some reason I cant get the box to pull up with the layers. I keep getting the failed to load resource file error

Thanks in advance for the help

p.s. I am using opendcl version 8.0.0.8 and autoCAD 2014
Title: Re: help with lisp and open dcl box
Post by: owenwengerd on September 26, 2014, 01:47:30 PM
 Have you checked the value of mstLayZerFile at the point where the code displays the error message? I'm pretty sure it is not a valid path.
Title: Re: help with lisp and open dcl box
Post by: jarods350z on September 26, 2014, 02:30:02 PM
Thanks Own you are always the first to respond but unfortunately It looks like I do unless my lisp is trying to call the ip address and not just the s drive.

see attached directory tree

Oh and by the way it is AutoCAD 2015 not 2014
Title: Re: help with lisp and open dcl box
Post by: owenwengerd on September 26, 2014, 07:34:29 PM
Quote from: jarods350z on September 26, 2014, 02:30:02 PM
Thanks Own you are always the first to respond but unfortunately It looks like I do unless my lisp is trying to call the ip address and not just the s drive.

It looks like your reply got messed up. Did you check the value of mstLayZerFile?
Title: Re: help with lisp and open dcl box
Post by: jarods350z on September 30, 2014, 12:55:04 PM
Owen

What do you mean?

the lisp errors at this point
(defun c:lz (/ t1 ct file line pos layernamelist pre mid)
  (if (not LayZerLayerData)
    (progn
      (setq t1 (getvar "MILLISECS")
            ct 0
      )
      (if (not (setq file (open mstLayZerFile "r")))
        (progn
          (alert "LayZer: Failed to load resource file. Exiting.")
          (exit)
        )
      )
Title: Re: help with lisp and open dcl box
Post by: owenwengerd on September 30, 2014, 01:19:48 PM
Quote from: jarods350z on September 30, 2014, 12:55:04 PM
What do you mean?

I'm trying to help you debug your code. If you inspect the value of mstLayZerFile at the point where the error occurs, I think it will be obvious what you did wrong. You can inspect its value either by stepping through the code with the Visual Lisp IDE, or by placing an inline diagnostic output in your code:
Code (autolisp) Select
(princ (strcat "\nmstLayZerFile=" mstLayZerFile "\n"))
Title: Re: help with lisp and open dcl box
Post by: roy_043 on September 30, 2014, 11:25:27 PM
Note: The alert message produced by the code already provides diagnostic output.
Title: Re: help with lisp and open dcl box
Post by: jarods350z on October 01, 2014, 08:10:07 AM
wahoo getting closer now I get this error man this is like a lisp openDCL puzzle
Title: Re: help with lisp and open dcl box
Post by: owenwengerd on October 01, 2014, 08:27:14 AM
Once (dcl-Form-Show) returns, your dialog box has been closed and the controls no longer exist. You need to perform any dialog operations in an event handler while the dialog is open.
Title: Re: help with lisp and open dcl box
Post by: Fred Tomke on November 12, 2014, 10:42:17 AM
Hi, jarods350z,

I recommend you to study the OpenDCL samples: then for you it is no "this is like a lisp openDCL puzzle" anymore. :)
In addition to Owens explanation I want add that you should enable the event Initialize of the form and rewrite/reorder your code this way:

Code (autolisp) Select

(defun c:myprog (/ c:myproj_myform_OnInitialize doContinue intReturnValue  )
  (defun c:myproj_myform_OnInitialize()
    (dcl-listbox-setlist myproj_myform_mylistbox lstMyList)
  ); c:myproj_myform_OnInitialize

  (setq doContinue T)
  (while doContinue
    (setq intReturnValue (dcl-form-show myproj_myform))
    (cond
      ((= intReturnValue 0) (select_point_or_objects))
      ((= intReturnValue 1) (do_something) (setq doContinue nil))
      ((= intReturnValue 2) (setq doContinue nil))
    ); cond
  ); while
  (princ)
); myprog


The following link hits the same notch: http://www.opendcl.com/forum/index.php?topic=947.msg4759#msg4759
Regards, Fred