OpenDCL Forums

OpenDCL => Studio/Dialog Editor => Topic started by: Peter2 on November 06, 2016, 08:45:48 AM

Title: ODCL - "Save as LSP" via commandline?
Post by: Peter2 on November 06, 2016, 08:45:48 AM
Usually I open an ODCL with Editor and click "Save as LSP" to create a Lisp-file which can be integrated into the main-Lisp-code.

Is it possible to do it with command-line, without opening the Editor?

Peter
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: marcoheuer on November 07, 2016, 12:56:32 AM
hello peter,
with "dcl-Project-SaveAs".

best regards
marco
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: owenwengerd on November 07, 2016, 08:53:04 AM
Quote from: Peter2 on November 06, 2016, 08:45:48 AM
Is it possible to do it with command-line, without opening the Editor?

You mean, by specifying a command line argument to Studio it should insert the specified Lisp file name into a new project? That's not currently possible, but it's a good idea.
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: Peter2 on November 09, 2016, 08:09:39 AM
Hi

thanks for comments, but I'm searching in another direction.

We have many LSP and many ODCL, and I think that the solution like shown in "Samples", DistSample1.lsp and DistSample1.prv is good for us.

The only question is now (see above): How to "convert" many ODCL-files to odcl.lsp-files?

If there was a command line like
Code (autolisp) Select
OpenDCL Studio.exe /in "my.odcl" /out "my.odcl.lsp"
I could create a batch and "convert" them without problems.

Owens idea is rather the same, just from odcl.lsp to ODCL ...

Title: Re: ODCL - "Save as LSP" via commandline?
Post by: marcoheuer on November 10, 2016, 12:04:04 AM
Code (autolisp) Select

(setq path "e:\\MyProgram\\")
(odcl->lsp path)

(defun odcl->lsp (path)
  (mapcar
    '(lambda(filename)
      (dcl_project_load (strcat path (vl-filename-base filename)) T)
      (if (not (dcl_Project_SaveAs (vl-filename-base filename) (strcat path filename ".lsp")))
        (print (strcat "Error: " filename))
      )
    )
    (vl-directory-files path "*.odcl")
  )
)
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: Peter2 on November 10, 2016, 12:35:53 AM
Hi Marco

thanks for the code - it does exactly what I want, but it does it with Lisp and therefore inside AutoCAD.  :)

If it could be done (sometimes) with Editor and without AutoCAD, it would be perfect.
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: owenwengerd on November 19, 2016, 08:33:04 PM
What you want is a way to automate opening and saving an .odcl project by script. The OpenDCL Studio IDE is interactive by design, but I suppose there could be some separate command line conversion tool for this purpose. AutoLISP is a proven and familiar way to script just about anything, so I'd say it's a pretty good solution in any case.
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: Peter2 on November 20, 2016, 03:03:52 AM
Quote from: owenwengerd on November 19, 2016, 08:33:04 PM
... but I suppose there could be some separate command line conversion tool for this purpose....
So do you mean the feature could be added some time to Studio - or not?
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: owenwengerd on November 20, 2016, 07:47:37 AM
OpenDCL Studio is interactive by design, but you want something that is _not_ interactive. Therefore, it is not an appropriate feature for OpenDCL Studio. I hope that clarifies.
Title: Re: ODCL - "Save as LSP" via commandline?
Post by: Peter2 on November 20, 2016, 09:40:34 AM
Thanks Owen, now it's clear.