我有点让它工作,因为我的工作指标,这将是完美的工作脚增加了开销,其他人可能知道一种方法,但它确实增加了价值的电子表格,因为你选择。
- ; this will read various objects in the dwg
- ; its hard coded for a fileame for testing change to pick file name
- ; using findfile etc
- ; it is hard coded for 3 picks
- ; picking dims returns the measurement so UNITS must be reset
- (defun objectis (obj / )
- (setq objname (vla-get-objectName obj))
- (cond
- ((= objname "AcDbText")(setq txtstr (vla-get-textstring obj)))
- ;((= objname "AcDbMText")(stripmtxt))
- ((= objname "AcDbMText")(setq txtstr (vla-get-textstring obj)))
- ((= objname "AcDbRotatedDimension")(setq txtstr (rtos (vla-get-measurement obj)5 3)))
- )
- (if (= txtstr nil)(alert "object not supported"))
- )
- (defun stripmtxt ( / )
- (setq txtstr (vla-get-textstring obj))
- (setq txtstr (LM:UnFormat (txtstr T )))
- )
- (defun c:doentry ( / obj)
- (setq col 1)
- (repeat 3
- (setq obj (vlax-ename->vla-object (car (entsel "\nPick object"))))
- (setq row (+ maxrow# 1))
- (objectis obj)
- (setq txtstr (vl-string-subst "" "F.S." TxtStr))
- (alert txtstr)
- (PutCell (strcat (NUMBER2ALPHA COL) (rtos Row 2 0)) txtstr )
- (setq col (+ col 1))
- )
- (setq maxrow# (+ maxrow# 1))
- )
- (defun c:doclose ( / )
- (CLOSEEXCEL "C:\\temp\\elwidht.XLS")
- )
- )
- ;------------------------------------------------------------------------------------------------
- ; starts here
- ;------------------------------------------------------------------------------------------------
- (if (not openexcel)(load "getexcel.lsp"))
- (if (not LM:UnFormat)(load "Unformat-mtext-string"))
- ; hard coded for testing excel must exist
- (OpenExcel "C:\\Temp\\elwidht.xlsx" "Sheet1" t)
- ; need this to find max row col as exists
- (setq excelrc (VLAX-GET-PROPERTY *EXCELAPP% 'selection))
- ; only need to run once
- (SETQ MAXROW# (VLAx-GET-PROPERTY excelrc 'Row))
- (SETQ MAXCOLUMN# (VLAX-GET-PROPERTY excelrc 'column))
- ; start for 1st time when loading
- (c:doentry)
获取Excel。lsp
埃尔维特。xlsx公司 |