- UID
- 606273
- 积分
- 468
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-3-17
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
cad程序后启动,excell程序启动,程序能够不能运行;excell程序启动,cad程序后启动,程序能够运行,希望高手能够帮助!
;----cad取点写入excell ptcoo_exell
(defun c:ptcoo_exell ( / appsession msxl_books_name xh tx p msxl_sheets )
(vl-load-com)
(setq dmode "SHOW" )
(if (null (setq xh(getint "\n起始点编号:")))
(setq xh 1);xh代表序号
)
(setq appsession (vlax-get-or-create-object "Excel.Application"));excell程序
(setq msxl_books (vlax-get-property appsession 'WorkBooks) );工程
;(setq msxl_books_name (vlax-get-property msxl_books 'name) );工程名称
(setq msxl_sheets (vlax-get-property appsession 'WorkSheets) );表
(setq msxl_sheets-count (vlax-get-property msxl_sheets 'count) );表数量
(setq msxl_act_sheets (vlax-get-property appsession 'ActiveSheet) );当前表
(setq msxl_books-name (vlax-get-property msxl_act_sheets 'Name) );当前表名字
(setq msxl_act_cell (vlax-get-property appsession 'ActiveCell) );当前单元格
(setq msxl_act_cell_text (vlax-get-property msxl_act_cell 'FormulaArray) );数值
(setq msxl_act_cell_type (vlax-variant-type msxl_act_cell_text ) );数据类型
(setq msxl_act_cell_value (vlax-variant-value msxl_act_cell_text ) );数据值
;(vlax-dump-object msxl_act_cell [T])
(setq msxl_act_cell_text (vlax-get-property msxl_act_cell 'Value) );数值
(setq msxl_act_cell_col (vlax-get-property msxl_act_cell 'Column) );数值
(setq msxl_act_cell_row (vlax-get-property msxl_act_cell 'Row) );数值
(SETQ P(GETPOINT"\n选择点:"))
(while (/= p nil)
(setq tx (strcat "J" (itoa xh) "," "" "," (rtos (car p) 2 4) "," (rtos(cadr p) 2 4) "," "0"))
(setq msxl_act_cell (vlax-get-property appsession 'ActiveCell) );当前单元格
(setq msxl_act_cell_text (vlax-put-property msxl_act_cell 'Value2 (strcat "J" (itoa xh))) );数值
(setq msxl_act_cell_col (vlax-put-property msxl_act_cell 'Column (1+msxl_act_cell_col)) );数值
(setq cell_val(vlax-make-variant (rtos (car p) 2 4) 8))
(setq msxl_act_cell_text (vlax-put-property msxl_act_cell 'Value2 cell_val) );数值
(setq msxl_act_cell_col (vlax-put-property msxl_act_cell 'Column (1+msxl_act_cell_col)) );数值
(setq cell_val(vlax-make-variant (rtos (cadr p) 2 4) 8))
(setq msxl_act_cell_text (vlax-put-property msxl_act_cell 'Value2 cell_val) );数值
(setq msxl_act_cell_col (vlax-put-property msxl_act_cell 'Column (- msxl_act_cell_col 2)) );数值
(setq msxl_act_cell_row (vlax-put-property msxl_act_cell 'Row (1+ msxl_act_cell_row)) );数值
(if (= (strcase dmode) "SHOW")
(vla-put-visible appsession 1)
(vla-put-visible appsession 0)
);---end if
(princ msxl_act_cell_value)
(SETQ P(GETPOINT"\n选择点:"))
(setq xh(1+ xh))
)
(princ (strcat "\n 共提取" (itoa xh) "个坐标点"))
) |
|