ODCL - "Save as LSP" via commandline?

Started by Peter2 · 2016-11-06 16:45 UTC · 9 replies · SMF topic #2445

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
hello peter,
with "dcl-Project-SaveAs".

best regards
marco
author=Peter2 link=topic=2445.msg12196#msg12196 date=1478450748 wrote:
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.
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
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 ...


(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")
  )
)
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.
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.
author=owenwengerd link=topic=2445.msg12244#msg12244 date=1479616384 wrote:
... 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?
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.
Thanks Owen, now it's clear.