equivalent of dcl_binfile_write/read/close

Started by s.barszczewski, November 17, 2009, 02:13:41 AM

Previous topic - Next topic

s.barszczewski

Hello everybody

I'm using autocad 2009 LT and autocad extender which allows to run lisp routines on autocad LT, opendcl is not 100% compatibile with this autocad extender so for example when normal autolisp syntax looks like this

(dcl_Form_Close abc_Form)

i have to divide it into such syntax (dcl_Form_Close "abc" "Form") to make it work on autocad 2009 LT and autocad extender, or i get prompt from opendcl : Bad argument

because I'm not able to force autocad 2009 LT to work with such code (normal autocad 2009 works with it ) :
Code (autolisp) Select
(setq file (dcl_BinFile_Open "c:\\file.txt" "r"))
(setq data (dcl_BinFile_Read file T)  <<< here I get opendcl prompt : bad argument
(dcl_BinFile_Close file)   <<< here I get opendcl prompt : bad argument



I'm looking for library or lisp routine which has similar functions to : dcl_binfile_open / dcl_binfile_write / dcl_binfile_read . Maybe one of you came across of such functions

Regards
Sebastian
s.barszczewski@wp.pl

Fred Tomke

Hi, have you ever tried with the Scripting.FileSystemObject?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

DW

#2
The other option might be to use OpenDCL 4.1.2.2 which does work with LT-Extender - but of course you need to rewrite your dialog project and will be limited to the older version.  Also binary file functions have different names in the older version.

David

s.barszczewski

Quote from: Fred Tomke on November 17, 2009, 03:56:53 AM
Hi, have you ever tried with the Scripting.FileSystemObject?

Fred

what's that, can you give me short example ? I don't know what's that . Maybe you're talking about Microsoft Scripting Runtime Library?

regards
Sebastian

Fred Tomke

Hi, I will give you an example later this day. I'm just in a customer training.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

Slavko Ivanovic

Hi barszczewski
Hi Fred

Fred, maybe no need for samples.

Barszczewski can check very nice samples by mr. Tony Tanzillo.:
lnk. to site http://www.caddzone.com/free.htm
direct lnk. to sample http://www.caddzone.com/wsh.lsp


p.s. Fred
Are U Customer or Trainer ;)

Slavko
***  siCAD Solutions for AutoCAD  ***
ArchiTools l ToolsPlus l LandTools l LBE

Fred Tomke

#6
Hi,

Quote from: Slavko Ivanovic on November 18, 2009, 09:48:21 AM
Fred, maybe no need for samples.

Hm, that's a really nice link, Slavko! Thank you! But I will publish a sample anyway. Maybe it is shorter. And finally, I'm not sure if AutoCAD LT makes it possible to get access to the ActiveX-object.

Code (autolisp) Select

(defun write_textfile (strFile uData isUnicode / filFile oFSObject oFSFile strZeile)
  (setq oFSObject (vlax-create-object "Scripting.FileSystemObject"))
  (setq oFSFile (vlax-invoke-method oFSObject "CreateTextFile" strFile :vlax-true (if isUnicode :vlax-true :vlax-false)))

  (if (listp uData)
    (foreach strZeile uData (vlax-invoke-method oFSFile 'WriteLine strZeile))
    (vlax-invoke-method oFSFile 'WriteLine uData)
  ); if
  (vlax-invoke-method oFSFile 'Close)
  (vlax-release-object oFSFile)
  (vlax-release-object oFSObject)
  T
); write_textfile


Quote from: Slavko Ivanovic on November 18, 2009, 09:48:21 AM
Are U Customer or Trainer ;)

I'm a AutoCAD Civil 3D trainer these days. ;)

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

Slavko Ivanovic


And, barszczewski for other methods for
Code (autolisp) Select
(vlax-create-object "Scripting.FileSystemObject")
u can check
http://msdn.microsoft.com/en-us/library/z9ty6h50%28VS.85%29.aspx

Slavko
***  siCAD Solutions for AutoCAD  ***
ArchiTools l ToolsPlus l LandTools l LBE