DCL的滑动问题!!
嘿,我的幻灯片可以工作,但当你点击ok按钮进行计算时,幻灯片就会消失。为什么会这样? 你可以把DCL和处理DCL的LISP部分贴出来吗?我来看看 嘿,你好,李。麦克,这是Lisp程序。嘿,李,我也刚刚遇到了另一个问题。我有两个编辑框来收集信息。外形尺寸
对象间距
现在我可以以十进制形式输入,但我们不使用十进制形式。有没有办法将框中的输入更改为英尺和英寸?这被认为是一种节省时间的方法,如果它是十进制的,那么它就达不到目的了。
(defun space:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls dstx spax
)
(setq dialogLoaded T
dialogShow T)
(if (= -1 (setq dcl_id (load_dialog "SPACE.DCL")));_looks for and loads the dcl file
(progn
(princ "\nERROR: Cannot load space.DCL");_error trapping
(setq dialogLoaded nil)
) ;_ end of progn
) ;_ end of if
(setq what_next 2);_this is a variable for the loop
(while (>= what_next 2);_this is the loop
(if (and (not (new_dialog "space" dcl_id));_if everything is found let the program proceed
dialogLoaded
) ;_ end of and
(progn
(princ "\nERROR: Cannot show dialog space");_error trap if there is a problem
) ;_ end of progn
) ;_ end of if
(if (and dialogLoaded dialogShow)
(progn
;;; below is where you assign values to tiles and other stuff
(if rtvls
(progn
(set_tile "end1" (rtos(nth 0 rtvls)5 4))
(set_tile "sp" (rtos(nth 1 rtvls)2 0))
(set_tile "sp2" (rtos(nth 2 rtvls)4 4))
(set_tile "oa" (rtos(nth 3 rtvls)4 4))
(set_tile "end2" (rtos(nth 4 rtvls)5 4))
(set_tile "sd" (rtos(nth 5 rtvls)4 4))
);_progn
(progn
(set_tile "end1" "")
(set_tile "sp" "")
(set_tile "sp2" "")
(set_tile "oa" "")
(set_tile "end2" "")
(set_tile "sd" "")
(set_tile "ss" "")
);_progn
);_if
(setq dialogShow nil)
(setq w (dimx_tile "im1")
h (dimy_tile "im1"))
(slide_image 0 0 w h "space")
(end_image)
(if dstx (set_tile "x" dstx)(set_tile "x" ""))
(if spax (set_tile "y" spax)(set_tile "y" ""))
(action_tile "cancel" "(done_dialog)(setq UserClick nil) ");_if user click the cancle button make dlg go bye-bye
;;; if user clicks okbutton assign tile values to variables
(action_tile "accept"
(strcat
"(progn"
"(setq dstx (get_tile \"x\"))"
"(setq spax (get_tile \"y\"))"
"(if (not (member \"\" (list dstx spax)))"
"(progn"
"(done_dialog 4)"
")" ;_progn
"(alert \"Please enter values\")"
")" ;_if
")" ;_progn
) ;_end strcat
) ;_ end of action_tile
(setq what_next (start_dialog))
) ;_ end of progn
) ;_ end of if
(cond
((= what_next 4)
(setq rtvls (space (atof dstx)(atof spax))));_do this if user clicks the button named qdx_wld
);_end cond
);_end while
(unload_dialog dcl_id)
) ;_
这是dcl
space :dialog {
label = "The Spacing Chart!" ;
: row {
:boxed_column {
label = "ENTER DIMENSIONS EXACTLY";
:edit_box {
key="x";
label="What is your Overall Diemsnion of Object?" ;
edit_width=14;
alignment=centered;
}
:edit_box {
key="y" ;
label = "What is your Desired Spacing on Object?";
edit_width=14;
}
}
:boxed_column {
:edit_box {
label="Displays Overall in Feet & inches";
key="sd";
edit_width=14;
alignment=centered;
}
}}
:row {
:column {
width=10;
alignment=centered;
label="End Space 1";
:edit_box {
edit_width=6;
key="end1" ;
}
}
:column {
width=3;}
:column {
width=10;
label="# of Spaces";
:edit_box {
edit_width=6;
key="sp";
}
}
:row {
:column{
width=15;
:text {key="tt" ; value="SPACES @";
alignment=centered;}}
}
:column {
width=10;
label="Space Size";
:edit_box {
edit_width=6;
key="sp2";
}
}
:row {
:column{
width=15;
:text {key="eq" ; value="EQUALS";
alignment=centered;}}
}
:column {
width=10;
label="Overall Middle";
:edit_box {
edit_width=12;
key="oa";
}
}
:column {
width=3;}
:column {
width=10;
alignment=centered;
label="End Space 2";
:edit_box {
key="end2" ;
edit_width=6;
}
}}
:row {
:boxed_column {
label="Written by: Brandon DeLoach and Joe Barrertt <2009>" ;}
}
: image {
key = "im1";
height = 30;
aspect_ratio = 1.5;
color = 0;
allow_accept = true;
}
: row { // defines the OK/Cancel button row
: spacer { width = 20; }
: button { // defines the OK or calculate button
label = "Calculate";
is_default = true;
key = "accept";
width = 8;
fixed_width = true;
}
: button { // defines the Cancel button
label = "Cancel";
is_cancel = true;
key = "cancel";
width = 8;
fixed_width = true; }
: spacer { width = 20;}
}
} 快速浏览一下,我认为在LISP代码中,需要包含以下内容:
(start_image "im1")
(setq w (dimx_tile "im1")
h (dimy_tile "im1"))
(slide_image 0 0 w h "space")
(end_image)
对于编辑框情况,您将从编辑框中检索字符串,然后需要检索用户输入并将其转换为程序所需的单位。。。
我有两种可能。。。可能有两个编辑框,用于英尺和英寸。。。或者可以使用substr(或类似的另一个函数)去掉“and”。 因此,我想没有办法只更改该编辑框的RTO,它就这样? Rtos?我想你的意思是“distof”,
编辑框返回一个字符串,可以使用以下方法将其正确转换为实数:
(distof 3)
否则,我会按照以下思路思考:
feet : dialog {
label = "Edit Box Test";
: row {
: edit_box {
label = "Feet:";
mnemonic = "F";
key = "edit_feet";
alignment = centered;
edit_limit = 3;
edit_width = 3;
value = "2";
}
: edit_box {
label = "Inches:";
mnemonic = "I";
key = "edit_inches";
alignment = centered;
edit_limit = 3;
edit_width = 3;
value = "3";
}
}
ok_cancel;
}
在VLIDE中预览 好的,现在有了(distof),这将必须在我的输入/输出表上。我一直在尝试,但每次都会出现错误 隐马尔可夫模型。。。我不使用“输入/输出”表,但需要在其中收集编辑框的值。 我试过了,但还是没有运气,它出现了一个糟糕的nump nil错误,所以我将发布所有3个代码,看看你能做什么。
这是主lisp文件
; THIS PROGRAM IS TO DETERMINE SPACES AND ENDS GIVEN
; A KNOWN SPACE AND AN OVERALL DIMENSION.
;
; AN EXAMPLE IS THE SPACING OF STUDS AT 24" O.C.
; ON AN EMBED ANGLE
;
;
;Again this program is written by Joe Barrett and Brandon DeLoach, Atchley Steel's Boppsy Twins.
;on or about February 25, 2009
;
;dst1 = end to end of material
;dst3 = initial number of spaces times the space
;dst4 = final number of spaces times the space
;endl = left end dimension
;endr = right end dimension
;num1 = initial number of spaces (exact)
;num2 = initial number of spaces minus the fraction
;num3 = initial number of spaces minus 1 plus the fraction
;num4 = final number of spaces required
;rem1 = working number to determine endspaces
;spa1 = spacing of whatever
(defun c:spc ()
(space:DialogInput)
(princ)
);_defun
(defun space (dst1 spa1 / dst4 endl endr num1 num2 num3 num4 rem1)
(setq num1 (/ dst1 spa1))
(setq num2 (fix (+ num1 0.50)))
(setq num3 (- num2 1))
(setq dst3 (* spa1 num3))
(setq rem1 (* (- num1 num2) spa1))
(if (< rem1 6)
(setq num4 num3)
(setq num4 num2)
)
(setq dst4 (* num4 spa1))
(setq endl (/ (- dst1 dst4) 2))
(setq endr (- dst1 dst4 endl))
(setq ret (list endl num4 spa1 dst4 endr dst1 spa1))
)
这是输入/输出表
(defun space:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls w hdstx spax
)
(setq dialogLoaded T
dialogShow T)
(if (= -1 (setq dcl_id (load_dialog "SPACE.DCL")));_looks for and loads the dcl file
(progn
(princ "\nERROR: Cannot load space.DCL");_error trapping
(setq dialogLoaded nil)
) ;_ end of progn
) ;_ end of if
(setq what_next 2);_this is a variable for the loop
(while (>= what_next 2);_this is the loop
(if (and (not (new_dialog "space" dcl_id));_if everything is found let the program proceed
dialogLoaded
) ;_ end of and
(progn
(princ "\nERROR: Cannot show dialog space");_error trap if there is a problem
) ;_ end of progn
) ;_ end of if]
(start_image "im1")
(setq dialogShow t)
(setq w (dimx_tile "im1")
h (dimy_tile "im1"))
(slide_image 0 0 w h "space")
(end_image)
(if (and dialogLoaded dialogShow)
(progn
;;; below is where you assign values to tiles and other stuff
(if rtvls
(progn
(set_tile "end1" (rtos(nth 0 rtvls)5 4))
(set_tile "sp" (rtos(nth 1 rtvls)2 0))
(set_tile "sp2" (rtos(nth 2 rtvls)4 4))
(set_tile "oa" (rtos(nth 3 rtvls)4 4))
(set_tile "end2" (rtos(nth 4 rtvls)5 4))
(set_tile "sd" (rtos(nth 5 rtvls)4 4))
);_progn
(progn
(set_tile "end1" "")
(set_tile "sp" "")
(set_tile "sp2" "")
(set_tile "oa" "")
(set_tile "end2" "")
(set_tile "sd" "")
);_progn
);_if
(if dstx (set_tile "x" dstx)(set_tile "x" ""))
(if spax (set_tile "y" spax)(set_tile "y" ""))
(action_tile "cancel" "(done_dialog)(setq UserClick nil) ");_if user click the cancle button end dialog
;;; if user clicks okbutton assign tile values to variables
(action_tile "accept"
(strcat
"(progn"
"(setq dstx (get_tile \"x\"))"
"(setq spax (get_tile \"y\"))"
"(if (not (member \"\" (list dstx spax)))"
"(progn"
"(done_dialog 4)"
")" ;_progn
"(alert \"Please enter values\")"
")" ;_if
")" ;_progn
) ;_end strcat
) ;_ end of action_tile
(setq what_next (start_dialog))
) ;_ end of progn
) ;_ end of if
(cond
((= what_next 4)
(setq rtvls (space (atof dstx)(atof spax))));_do this if user clicks the button named quit dialog
);_end cond
);_end while
(unload_dialog dcl_id)
) ;_ end of defun
这是dcl文件
space :dialog {
label = "The Spacing Chart!" ;
: row {
:boxed_column {
label = "ENTER DIMENSIONS EXACTLY";
:edit_box {
key="x";
label="What is your Overall Dimension of Object?" ;
edit_width=14;
alignment=centered;
}
:edit_box {
key="y" ;
label = "What is your Desired Spacing on Object?";
edit_width=14;
}
}
:boxed_column {
:edit_box {
label="Displays Overall in Feet & inches";
key="sd";
edit_width=14;
alignment=centered;
}
}}
:row {
:column {
width=10;
alignment=centered;
label="End Space 1";
:edit_box {
edit_width=6;
key="end1" ;
}
}
:column {
width=3;}
:column {
width=10;
label="# of Spaces";
:edit_box {
edit_width=6;
key="sp";
}
}
:row {
:column{
width=15;
:text {key="tt" ; value="SPACES @";
alignment=centered;}}
}
:column {
width=10;
label="Space Size";
:edit_box {
edit_width=6;
key="sp2";
}
}
:row {
:column{
width=15;
:text {key="eq" ; value="EQUALS";
alignment=centered;}}
}
:column {
width=10;
label="Overall Middle";
:edit_box {
edit_width=12;
key="oa";
}
}
:column {
width=3;}
:column {
width=10;
alignment=centered;
label="End Space 2";
:edit_box {
key="end2" ;
edit_width=6;
}
}}
:row {
:boxed_column {
label="Written by: Brandon DeLoach and Joe Barrertt <2009>" ;}
}
: image {
key = "im1";
height = 30;
aspect_ratio = 1.5;
color = 0;
allow_accept = true;
}
: row { // defines the OK/Cancel button row
: spacer { width = 20; }
: button { // defines the OK or calculate button
label = "Calculate";
is_default = true;
key = "accept";
width = 8;
fixed_width = true;
}
: button { // defines the Cancel button
label = "Cancel";
is_cancel = true;
key = "cancel";
width = 8;
fixed_width = true; }
: spacer { width = 20;}
}
}
页:
[1]