ODCL - "Save as LSP" via commandline?

Started by Peter2, November 06, 2016, 08:45:48 AM

Previous topic - Next topic

Peter2

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
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

marcoheuer

hello peter,
with "dcl-Project-SaveAs".

best regards
marco
Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

owenwengerd

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.
Owen Wengerd (Outside The Box) / ManuSoft

Peter2

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

Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

marcoheuer

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")
  )
)
Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

Peter2

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.
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

owenwengerd

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.
Owen Wengerd (Outside The Box) / ManuSoft

Peter2

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?
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

owenwengerd

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.
Owen Wengerd (Outside The Box) / ManuSoft

Peter2

Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10