GetExcel和PutExcel命令
我是autolisp新手,请解释getexec、GetCell和putexcel命令。。。(GetExcel“G:/FR\u X/drline.csv”“drarc”“A20”)
这个命令是什么意思?
这段代码也解释了。
(命令“cutclip”ss33“”)
(命令“pasteclip”point1“”)
GetExcel看起来像一个从单元格“A20”、工作表“drarc”文件“G:/FR\u X/drline.csv”中检索数据的lisproutine,但由于它是一个csv文件,无法确切说明例程的功能,因为这一切都取决于文件的内容或格式。
其他命令部分是标准autocad(google cutclip/pasteclip)。Lisp例程进行了选择并将此选择保存在变量ss33中,将其剪切并粘贴(有效移动)到由例程保存在变量“point1”中的坐标。
gr.Rlx 格泰克塞尔。lsp是一个非常好的从excel和Autocad收发的程序,它可能有一个读取csv的选项,我的版本没有,但它似乎是2008年左右的版本,也许他们是一个更新的版本。
Overview of Main functions
;-------------------------------------------------------------------------------
; GetExcel - Stores the values from an Excel spreadsheet into *ExcelData@ list
; Syntax:(GetExcel ExcelFile$ SheetName$ MaxRange$)
; Example: (GetExcel "C:\\Folder\\Filename.xls" "Sheet1" "L30")
; GetCell - Returns the cell value from the *ExcelData@ list
plus lots more options
(defun putexcel(\u file \u lst flag/\u excelapp \u workbooks \u ws \u tbs \u cells)(if(and(setq \u excelapp(vlax get or create object“Excel.Application”))(setq \u workbooks(vlax get \u excelapp“workbooks”)(and(findfile \u file)(setq \u ofile(vlax invoke \u workbooks“Open”\u file))(and(setq \u ofile(vlax invoke \u workbooks“Add))(vlax invoke _of ile'Saveas _file))(progn(vlax for w(vlax get _excelapp“Sheets”)(setq _tbs(cons w _tbs))(cond((eq(vla get name w)_sheet)(setq _ws)))(if(and(或_ws(setq _ws(last _tbs)))(setq _单元格(vlax get _ws'单元格)))(foreach x _lst(apply(函数vlax put property)(append(list _cells'item)x))(vlax invoke _ofile'Save)(和标志(vlax invoke _ofile'close)(vlax release object _excelapp)))(defun getexcel(_file _sheet flag/_excelapp _workbooks _ws _tbs _cc _l)(if(和(setq _file(findfile _file))(setq _excelapp(vlax get or create object“Excel.Application”)(setq _工作簿(vlax get _excelapp“工作簿”))(setq _文件(vlax invoke方法_工作簿“打开”_文件))(progn(vlax for w(vlax get _excelapp“Sheets”)(setq _tbs(cons w _tbs))(cond((eq(vla get name w)_sheet)(setq _ws w)))(if(或_ws(setq _ws(last _tbs)))(progn(setq _cc(vlax get(vlax get(vlax get _ws‘UsedRange)’Columns))(setq _n 0)((lambda(/_v _tmpl)(vlax for x(vlax get _ws‘UsedRange)(setq _v(vlax get x’value))(cond((not _v)(setq _v“”)((numberp _v)(setq _v(rtos _v 2))(setq _tmpl(cons _v _tmpl))(如果(
页:
[1]