LispVariable更新
我正在为rev框创建一个lisp,并在字段中使用LispVariables将rev数据存储在图形中。在我们的用户信息框之前,我使用下拉列表完成了这项工作,效果很好。我一启动它,它就会从图形中读取变量并更新对话框。我在其中使用了编辑框,但每次运行时它们不会更新到图形中的值。有谁能帮忙吗?
还有一种方法可以基于第一个包含除“---”以外的任何内容的编辑框来控制块的可见性状态吗?
Rev_box : dialog { //dialog name
label = "Drawing Revisions" ;//give it a label
////////////////////////////////////////////////////////////////////////////////////////////
:row { //define boxed row
//*********************************************************
: edit_box { //define edit box
key = "ccc_rev1" ; //give it a name
label = "Rev" ; //give it a label
edit_limit = 2 ; //6 characters only
edit_width = 2 ; //6 characters only
}
//*********************************************************
: edit_box { //define edit box
key = "ccc_by1" ; //give it a name
label = "By" ; //give it a label
edit_limit = 3 ; //6 characters only
edit_width = 3 ; //6 characters only
}
//*********************************************************
: edit_box { //define edit box
key = "ccc_date1" ; //give it a name
label = "Date" ; //give it a label
edit_limit = 10 ; //6 characters only
edit_width = 9 ; //6 characters only
}
//*********************************************************
: edit_box { //define edit box
key = "ccc_des1" ; //give it a name
label = "Description" ; //give it a label
edit_limit = 58 ; //6 characters only
edit_width = 42 ; //6 characters only
}
//*********************************************************
:toggle { //define toggle
key = "ccc_tog1"; //give it a name
label = "Line 1"; //give it a label
} //end toggle
//*********************************************************
} //end boxed row
ok_cancel ; //predifined OK/Cancel
} //end dialog
(defun C:rev_box () ;define function
(setq dcl_id (load_dialog "rev_box.dcl"));load dialog
(if (not (new_dialog "rev_box" dcl_id) ;test for dialog
)
(exit) ;exit if no dialog
);if
(action_tile
"cancel" ;if cancel button pressed
"(done_dialog) (setq userclick nil)";close dialog, set flag
);action_tile
(action_tile
"accept" ;if O.K. pressed
" (done_dialog)(setq userclick T))" ;close dialog, set flag
);action tile
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(action_tile "ccc_rev1" "(setq ccc_rev_1 $value)")
(action_tile "ccc_by1" "(setq ccc_by_1 $value)")
(action_tile "ccc_date1" "(setq ccc_date_1 $value)")
(action_tile "ccc_des1" "(setq ccc_des_1 $value)")
(start_dialog) ;start dialog
(unload_dialog dcl_id) ;unload
(princ)
(command "regenall")
);defun C:samp
(princ)
我试图强制平铺句柄接受CAD中变量的值。我用过这个:
(defun C:rev_box () ;define function
(setq dcl_id (load_dialog "rev_box.dcl"));load dialog
(if (not (new_dialog "rev_box" dcl_id) ;test for dialog
)
(exit) ;exit if no dialog
(setq ccc_rev1 ccc_rev_1)
);if
(action_tile
"cancel" ;if cancel button pressed
"(done_dialog) (setq userclick nil)";close dialog, set flag
);action_tile
(action_tile
"accept" ;if O.K. pressed
" (done_dialog)(setq userclick T))" ;close dialog, set flag
);action tile
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(action_tile "ccc_rev1" "(setq ccc_rev_1 $value)")
(action_tile "ccc_by1" "(setq ccc_by_1 $value)")
(action_tile "ccc_date1" "(setq ccc_date_1 $value)")
(action_tile "ccc_des1" "(setq ccc_des_1 $value)")
(start_dialog) ;start dialog
(unload_dialog dcl_id) ;unload
(princ)
(command "regenall")
);defun C:samp
(princ)
这能做到吗?还是我在逆风吹口哨? 所以我发现了我的一些错误。
应如下所示:
(defun C:rev_box () ;define function
(setq dcl_id (load_dialog "rev_box.dcl"));load dialog
(if (not (new_dialog "rev_box" dcl_id) ;test for dialog
)
(exit) ;exit if no dialog
);if
(set_tile "ccc_rev1" ccc_rev_1)
(action_tile
"cancel" ;if cancel button pressed
"(done_dialog) (setq userclick nil)";close dialog, set flag
);action_tile
(action_tile
"accept" ;if O.K. pressed
" (done_dialog)(setq userclick T))" ;close dialog, set flag
);action tile
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(action_tile "ccc_rev1" "(setq ccc_rev_1 $value)")
(action_tile "ccc_by1" "(setq ccc_by_1 $value)")
(action_tile "ccc_date1" "(setq ccc_date_1 $value)")
(action_tile "ccc_des1" "(setq ccc_des_1 $value)")
(start_dialog) ;start dialog
(unload_dialog dcl_id) ;unload
(princ)
(command "regenall")
);defun C:samp
(princ)
这在图形中可以正常工作,但当我保存它时,请关闭它,然后返回。当我运行它时,会出现以下错误:
; 错误:错误的参数类型:stringp nil
安东有什么想法吗? 在lisp中尝试setq ccc\u rev\u 1。
尝试以下操作:
(defun C:rev_box (/ dcl_id ccc_rev1)
(setq ccc_rev1 ???)
;;and so on...
ps
编辑帖子,这样其他用户就不必阅读您的所有帖子来提供他们的输入。 谢谢丹中尉的腿,但那没用。问题似乎是,当我在对话框中输入值时,这些值在CAD中被创建为LispVariables,并且我用这些变量设置了字段。如果保存图形并重新打开,字段仍然包含位于最右侧字段对话框顶部的变量,但它们不再在变量列表中。有什么办法吗?有没有办法让CAD保存图形中的字段?
是否有某种方法可以让CAD在lisp完成后存储字段,这样当我再次打开图形时,这些字段仍然存在,并传递到DCL并显示在正确的编辑框中。 之前已经讨论过在dwg搜索中存储数据以获取扩展实体。还可以看看useri1-5 userr1-5 users1-5。
伍德曼78,
这是可行的。还请注意,我去掉了所有那些无用的评论,并对瓷砖进行了更改。这是您的问题(set\u tile“ccc\u rev1”ccc\u rev\u 1)。
还将此Rev\u框更改为此Rev\u框。
对话
rev_box : dialog { label = "Drawing Revisions";
: row{
: edit_box { label = "Rev"; key = "ccc_rev1";edit_limit = 2;edit_width = 2;}
: edit_box { label = "By" ; key = "ccc_by1" ;edit_limit = 3;edit_width = 3;}
: edit_box { label = "Date"; key = "ccc_date1"; edit_limit = 10; edit_width = 9;}
: edit_box { label = "Description"; key = "ccc_des1";edit_limit = 58; edit_width = 42; }
: toggle { label = "Line 1"; key = "ccc_tog1";}
}
: button { label = "&Ok"; key = "accept"; width = 18; fixed_width = true; alignment = centered; is_default = true; }
: button { label = "&Exit"; key = "cancel"; width = 18; fixed_width = true; alignment = centered; is_cancel = true;}
}
Lisp程序
(defun C:rev_box ()
(or ccc_rev_1 (setq ccc_rev_1 "1"))
(setq dcl_id (load_dialog "rev_box.dcl"))
(if (not (new_dialog "rev_box" dcl_id))
(exit))
(set_tile "ccc_rev1" ccc_rev_1)
(action_tile "ccc_rev1""(setq ccc_rev_1$value)")
(action_tile "ccc_by1" "(setq ccc_by_1 $value)")
(action_tile "ccc_date1" "(setq ccc_date_1 $value)")
(action_tile "ccc_des1""(setq ccc_des_1$value)")
(action_tile "cancel" "(done_dialog)(setq userclick nil)")
(action_tile "accept" "(done_dialog)(setq userclick T))")
(start_dialog)
(unload_dialog dcl_id)
(if userclick
(progn
(command "._regenall")))
(princ))
请参见此处:http://www.afralisp.net/archive/lispa/lisp50.htm 下面的代码称为RBOX,它设置了所有平铺并填充了默认数据。注意,它们被设置为全局变量。试图为你节省一些时间。
这仅适用于当前绘图任务。有关每次打开图形时从上次绘图任务中保存的数据,请参见上面文章中的链接。
RBOX。dcl
RBOX : dialog { label = "Drawing Revisions";
: row{
: edit_box { label = "Rev"; key = "ccc_rev1";edit_limit = 2;edit_width = 2;}
: edit_box { label = "By" ; key = "ccc_by1" ;edit_limit = 3;edit_width = 3;}
: edit_box { label = "Date"; key = "ccc_date1"; edit_limit = 10; edit_width = 9;}
: edit_box { label = "Description"; key = "ccc_des1";edit_limit = 58; edit_width = 42; }
: toggle { label = "Line 1"; key = "ccc_tog1";}
}
: button { label = "&Ok"; key = "accept"; width = 18; fixed_width = true; alignment = centered; is_default = true; }
: button { label = "&Exit"; key = "cancel"; width = 18; fixed_width = true; alignment = centered; is_cancel = true;}
}
RBOX。lsp
(defun C:RBOX ()
(or RBOX:ccc_rev_1(setq RBOX:ccc_rev_1"1"))
(or RBOX:ccc_by_1 (setq RBOX:ccc_by_1 "WM"))
(or RBOX:ccc_date_1 (setq RBOX:ccc_date_1 "10/22/10"))
(or RBOX:ccc_des_1(setq RBOX:ccc_des_1"ISSUED FOR CONSTRUCTION"))
(or RBOX:ccc_tog_1(setq RBOX:ccc_tog_1"1"))
(setq dcl_id (load_dialog "RBOX.dcl"))
(if (not (new_dialog "RBOX" dcl_id))
(exit))
(set_tile "ccc_rev1"RBOX:ccc_rev_1)
(set_tile "ccc_by1" RBOX:ccc_by_1)
(set_tile "ccc_date1" RBOX:ccc_date_1)
(set_tile "ccc_des1"RBOX:ccc_des_1)
(set_tile "ccc_tog1"RBOX:ccc_tog_1)
(action_tile "ccc_rev1""(setq RBOX:ccc_rev_1$value)")
(action_tile "ccc_by1" "(setq RBOX:ccc_by_1 $value)")
(action_tile "ccc_date1" "(setq RBOX:ccc_date_1 $value)")
(action_tile "ccc_des1""(setq RBOX:ccc_des_1$value)")
(action_tile "ccc_tog1""(setq RBOX:ccc_tog_1 $value)")
(action_tile "cancel" "(done_dialog)(setq userclick nil)")
(action_tile "accept" "(done_dialog)(setq userclick T))")
(start_dialog)
(unload_dialog dcl_id)
(if userclick
(progn
(command "._regenall")))
(princ))
页:
[1]
2