help with lisp and open dcl box

Started by jarods350z, September 26, 2014, 09:01:50 AM

Previous topic - Next topic

jarods350z

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

owenwengerd

 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.

jarods350z

#2
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

owenwengerd

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?

jarods350z

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

owenwengerd

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

roy_043

Note: The alert message produced by the code already provides diagnostic output.

jarods350z

#7
wahoo getting closer now I get this error man this is like a lisp openDCL puzzle

owenwengerd

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.

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]