opendcl制作的对话框中GRID如何设置可修改,修改数据后如何响应?
我用opendcl做了一个用GRID的对话框,实现功能为:在图纸中已有多线风管,风管中心线的线型确定,以这种线型的线、圆弧上有扩展数据: "类型" "宽度" "高度" "宽度1" "高度1" "编号" "宽度2" "高度2"另加上的风管中心线的图元名。类型主要有:直管、弯头、三通。若类型是三通的话,宽度2和高度2也有数据(否则为nil)。选择风管线后,分别将每根风管中线的数据读出输入GRID中,有时有些个数据为空,输到GRID后可修改数据为空(或者直接修改有管径高度和宽度)的内容。再根据修改后的数据赋值到风管中心线上。现在我制作的GRID上的单元格内容不能修改,风管中心线的图元名现在不能显示在表格中,如修改数据后如何才能将GRID中修改的数据响应到风管中心线上。
现将程序上传,请高手指教。 加载风管中心线数据到GRID完成了,单击数据也可响应了。
就是不知道怎么修改数据。
自己一个研究用法太麻烦了。用哪个函数都不知道(英文又不太懂),
现在实现点击数据行后,可将该中心线的区域放大。
程序如下:
(command "OPENDCL")
(defun c:Hello () ; 调用方法加载 Hello.odcl 文件。
(dcl_Project_Load "fg数据" T) ; 调用方法显示“Hello world”对话框示例。
(dcl_Form_Show fg_data1)
(princ)
(defun c:fg_data1_TextButton4_OnClicked (/ e1 ent_tmp rValue)
(dcl_Form_Close fg_data1)
)
(defun c:FG_DATA1_GRID1_ONDBLCLICKED ()
(Setq rValue (dcl_Grid_GetCellText
fg_data1_Grid1
Row
9
)
)
)
(defun c:FG_DATA1_GRID1_OnSelChanged
(Row Column / rValue mv et pt1 pt2)
;;;;;;活动单元格更改后;;
;;; (setq rvalue (dcl_Grid_GetCurSel fg_data1_Grid1));得到点击的单元格行号和列号
;;;(Setq rValue (dcl_Grid_GetRowCells fg_data1_Grid1 0 ) );得到表中一行的数据
(Setq rValue (dcl_Grid_GetCellText
fg_data1_Grid1
Row
Column
)
) ;得到表中一个单元格的数据
(Setq rValue (dcl_Grid_GetCellText
fg_data1_Grid1
Row
9
)
)
(if (setq e1 (handent rValue))
(progn
(setq ent_tmp (entget e1))
(cond
((= (cdr (assoc 0 ent_tmp)) "LINE")
(progn
(setq pt1 (cdr (assoc 10 ent_tmp)))
(setq pt2 (cdr (assoc 11 ent_tmp)))
)
)
((= (cdr (assoc 0 ent_tmp)) "ARC")
(progn
(setq pt1 (polar (cdr (assoc 10 ent_tmp))
(cdr (assoc 51 ent_tmp))
(cdr (assoc 40 ent_tmp))
)
)
(setq pt2 (polar (cdr (assoc 10 ent_tmp))
(cdr (assoc 50 ent_tmp))
(cdr (assoc 40 ent_tmp))
)
)
)
)
) ;(command "change" e1 "" "P" "c" "red" "")
(command "zoom"
"w"
(polar pt1 (angle pt2 pt1) (/ (distance pt1 pt2) 4))
(polar pt2 (angle pt1 pt2) (/ (distance pt1 pt2) 4))
)
)
)
(princ)
)
(defun c:fg_data1_TextButton1_OnClicked (/ fg_list fg_data_list)
(dcl_Grid_Clear fg_data1_Grid1)
(get_fg_data)
(setq fg_list fg_data_list)
(if (/= fg_list nil)
(progn
(setq index1 0)
(repeat (length fg_list)
(setq fg_list_tmp (nth index1 fg_list))
;;; 序号 风量 风速 宽度 高度 长度 比摩阻 局部阻力系数
(princ "\n")
(setq index 0)
(setq rValue (itoa (1+ index1)))
(repeat (length fg_list_tmp)
(setq rValue (strcat rValue "\t"))
(cond
((= (TYPE (nth index fg_list_tmp))
'REAL
)
(setq
rValue (strcat rValue (rtos (nth index fg_list_tmp)))
)
)
((= (TYPE (nth index fg_list_tmp))
'INT
)
(setq
rValue (strcat rValue (itoa (nth index fg_list_tmp)))
)
)
((= (nth index fg_list_tmp) nil)
(progn ;(princ (nth index fg_list_tmp))
(setq rValue (strcat rValue "无"))
)
)
((= (TYPE (nth index fg_list_tmp))
'STR
)
(setq rValue (strcat rValue (nth index fg_list_tmp)))
)
)
;;;;(setq rValue (strcat rValue (rtos (nth index fg_list_tmp))))
(setq index (1+ index))
)
(Setq nRow (dcl_Grid_AddString
fg_data1_Grid1
rValue
)
)
(dcl_grid_SetItemStyle
fg_data1_Grid1
nRow
1
10
)
(setq index1 (1+ index1))
;(princ rValue)
)
)
)
(princ)
)
(defun get_fg_data (/ i index index1
line_fg ss_line_fgfg_gj_list fg_len_list
line_list appdata1 appdata2 appdata3
fg_length appname xda fg_len_list
line_fg fg_ent fg_w1 fg_w2
fg_h1 fg_h2 fg_len_tmp fg_wh
fg_lx fg_d_list
)
(setq ss_line_fg (ssget '((6 . "ACAD_ISO10W100"))))
;(setq appdata1 (list "类型" "宽度" "高度" "宽度1" "高度1" "编号"))
(setq appdata2 (list "类型" "宽度" "高度" "宽度1"
"高度1" "编号" "宽度2" "高度2"
)
)
(setq appdata3 appdata2) ;
(setq fg_data_list nil)
(setq index 0)
(repeat (sslength ss_line_fg)
(setq line_fg (ssname ss_line_fg index))
(setq fg_ent (entget line_fg))
(setq i 0)
(if (/= (vlax-ldata-get line_fg (nth 0 appdata3)) nil)
(progn
(setq fg_d_list nil)
(setq appname (nth 0 appdata3))
(setq fg_lx (vlax-ldata-get line_fg appname))
(setq index1 1)
(setq fg_d_list (cons fg_lx fg_d_list))
(repeat (1- (length appdata3))
(setq appname (nth index1 appdata3))
(setq fg_data (vlax-ldata-get line_fg appname))
(setq fg_d_list (cons fg_data fg_d_list))
(setq index1 (+ index1 1))
)
(setq fg_d_list (cons (cdr (assoc 5 fg_ent)) fg_d_list))
(setq fg_d_list (reverse fg_d_list))
(setq fg_data_list (cons fg_d_list fg_data_list))
)
)
(setq index (+ index 1))
)
)
;|(setq fg_list '(("直管" 500 400 500 400 0 0 1)
("直管" 500 400 500 400 0 0 1)
("弯头" 500 400 500 400 1)
("直管" 320 200 320 200 1)
("直管" 200 200 200 200 1)
("变径" 500 400 400 250 1)
("直管" 500 400 500 400 0 0 1)
("弯头" 500 400 500 400 1)
("直管" 320 200 320 200 1)
("直管" 200 200 200 200 1)
("变径" 500 400 400 250 1)
)
)
(if (and (/= rValue "") (/= rValue "0"))
(setq chengs_dcl_fgw (atoi rValue))
(Odcl_Control_SetText
fgsljs_DclForm1fgsljs_TextBox7
(chengs_rtos chengs_dcl_fgw 2 0)
)
)
(if(not (setq e1(handent "5a2")))
(princ "\nNo entity with that handle exists. ")
(princ e1)
)
|;
)
页:
[1]