我们发现有效的方法是在break命令中添加if语句:
(action_tile "Slide12"
"(progn
(setq Return$ Slide12$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile
"cancel"
"(done_dialog) (setq doAction nil)")
(start_dialog)
(unload_dialog Dcl_Id%)
(if doAction (SmallVLVInsert))
(princ)
);defun c:Smallvalves
;---------------------------------------------------------------------------------
(done_dialog)
(defun SmallVLVInsert ( / ss p2 p3)
(done_dialog)
(command "attreq" "0")
(if (eq 16384 (logand 16384 (getvar "osmode")))
(setvar "OSMODE" (boole 6 (getvar "OSMODE") 16384)))
(command "snap" "0.0625")
(setq insertpt1 (getpoint "\nPick Insertion Point on line: "))
(if (not (tblsearch "layer" "pid"))
(entmake
(list
(cons 0 "Layer")
(cons 100 "AcDbSymbolTableRecord")
(cons 100 "AcDbLayerTableRecord")
(cons 2 "pid")
(cons 70 0)
(cons 62 3)
(cons 6 "Continuous")
)))
(setq Snap (getvar "osmode"))
(setvar "clayer" "pid")
(command "_insert" Return$ insertpt1 "" "" "")
(while (not ss)
(setq ss (entsel "\nSelect line to break: "))
);while
(setvar 'osmode 613)
(setq p3 (getpoint "\nPick valve center:")
p2 (angle p3 (cadr ss)))
(if ( = slide1$ slide2$ slide3$ slide4$ slide5$ slide6$)
(progn
(command "break" ss "f" (polar p3 p2 0.09375)
(polar p3 p2 -0.09375))
)
(progn
(command "break" ss "f" (polar p3 p2 0.1172)
(polar p3 p2 -0.1172))
)
)
(setvar "cmdecho" 1)
(princ)
(setvar "osmode" Snap)
);if
这允许我们只保留一个可变doAction,但如果选择了幻灯片1到6,则允许例程中断较短的长度,并中断另一个较长的长度“ELSE”(在我们的情况下,是幻灯片7到幻灯片12)
我将尝试Henrique的第二个变量,以防需要传递两个以上的函数,即this或this,因为它在这里。lsp,但有时我们可能需要让lisp做这个、这个、这个、这个或那个。
在后一种情况下,我认为设置更多的变量会很有用。
我会附上lsp和dcl文件,这样如果你们中有人想让我知道如何改进我们的代码,因为这都是自学的,已经让我和其他人的眼睛检查过了。也许更多的人会提供建议。
再次感谢。
*附件对我不起作用,我将用代码括号括起来*
(defun c:smallvalves (/ Dcl_Id% Folder$ Slides@ Slide1$ Slide2$ Slide3$ Slide4$ Slide5$ Slide6$ Slide7$ Slide8$ Slide9$ Slide10$ Slide11$ Slide12$
Return$ X# Y#)
(princ "\nSmall Manually Operated Valves")(princ)
; Set Default Variables
(setq Slides@ (list nil "SMALL GATE VALVE" "SMALL BALL VALVE" "SMALL GLOBE VALVE" "SMALL CHECK VALVE" "SMALL BUTTERFLY VALVE" "SMALL NEEDLE VALVE"
"FLANGED SMALL GATE VALVE" "FLANGED SMALL BALL VALVE" "FLANGED SMALL GLOBE VALVE" "FLANGED SMALL CHECK VALVE" "FLANGED SMALL BUTTERFLY VALVE" "FLANGED
SMALL NEEDLE VALVE")
Slide1$ (nth 1 Slides@)
Slide2$ (nth 2 Slides@)
Slide3$ (nth 3 Slides@)
Slide4$ (nth 4 Slides@)
Slide5$ (nth 5 Slides@)
Slide6$ (nth 6 Slides@)
Slide7$ (nth 7 Slides@)
Slide8$ (nth 8 Slides@)
Slide9$ (nth 9 Slides@)
Slide10$ (nth 10 Slides@)
Slide11$ (nth 11 Slides@)
Slide12$ (nth 12 Slides@)
Folder$ ""
Return$ ""
);setq
; Load Dialog
(setq Dcl_Id% (load_dialog "smallvalves.dcl"))
(new_dialog "smallvalves" Dcl_Id%)
; Set Dialog Initial Settings
(set_tile "Title" "EQUIPMENT - DRUMS AND TANKS")
(set_tile "SMALL GATE VALVE" Slide1$)
(set_tile "SMALL BALL VALVE" Slide2$)
(set_tile "SMALL GLOBE VALVE" Slide3$)
(set_tile "SMALL CHECK VALVE" Slide4$)
(set_tile "SMALL BUTTERFLY VALVE" Slide5$)
(set_tile "SMALL NEEDLE VALVE" Slide6$)
(set_tile "FLANGED SMALL GATE VALVE" Slide7$)
(set_tile "FLANGED SMALL BALL VALVE" Slide8$)
(set_tile "FLANGED SMALL GLOBE VALVE" Slide9$)
(set_tile "FLANGED SMALL CHECK VALVE" Slide10$)
(set_tile "FLANGED SMALL BUTTERFLY VALVE" Slide11$)
(set_tile "FLANGED SMALL NEEDLE VALVE" Slide12$)
; Adjust X# and Y# per image_buttom outline to fit slide_image
(start_image "Slide1")
(setq X# (- (dimx_tile "Slide1") 2))
(setq Y# (- (dimy_tile "Slide1") 2))
(end_image)
(start_image "Slide1")(slide_image 1 1 X# Y# (strcat Folder$ Slide1$))(end_image)
(start_image "Slide2")(slide_image 1 1 X# Y# (strcat Folder$ Slide2$))(end_image)
(start_image "Slide3")(slide_image 1 1 X# Y# (strcat Folder$ Slide3$))(end_image)
(start_image "Slide4")(slide_image 1 1 X# Y# (strcat Folder$ Slide4$))(end_image)
(start_image "Slide5")(slide_image 1 1 X# Y# (strcat Folder$ Slide5$))(end_image)
(start_image "Slide6")(slide_image 1 1 X# Y# (strcat Folder$ Slide6$))(end_image)
(start_image "Slide7")(slide_image 1 1 X# Y# (strcat Folder$ Slide7$))(end_image)
(start_image "Slide8")(slide_image 1 1 X# Y# (strcat Folder$ Slide8$))(end_image)
(start_image "Slide9")(slide_image 1 1 X# Y# (strcat Folder$ Slide9$))(end_image)
(start_image "Slide10")(slide_image 1 1 X# Y# (strcat Folder$ Slide10$))(end_image)
(start_image "Slide11")(slide_image 1 1 X# Y# (strcat Folder$ Slide11$))(end_image)
(start_image "Slide12")(slide_image 1 1 X# Y# (strcat Folder$ Slide12$))(end_image)
; Dialog Actions
(action_tile "Slide1"
"(progn
(setq Return$ Slide1$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide2"
"(progn
(setq Return$ Slide2$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide3"
"(progn
(setq Return$ Slide3$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide4"
"(progn
(setq Return$ Slide4$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide5"
"(progn
(setq Return$ Slide5$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide6"
"(progn
(setq Return$ Slide6$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide7"
"(progn
(setq Return$ Slide7$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide8"
"(progn
(setq Return$ Slide8$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide9"
"(progn
(setq Return$ Slide9$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide10"
"(progn
(setq Return$ Slide10$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide11"
"(progn
(setq Return$ Slide11$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile "Slide12"
"(progn
(setq Return$ Slide12$)(setq doAction 'T)
(done_dialog)
)"
)
(action_tile
"cancel"
"(done_dialog) (setq doAction nil)")
(start_dialog)
(unload_dialog Dcl_Id%)
(if doAction (SmallVLVInsert))
(princ)
);defun c:Smallvalves
;---------------------------------------------------------------------------------
(done_dialog)
(defun SmallVLVInsert ( / ss p2 p3)
(done_dialog)
(command "attreq" "0")
(if (eq 16384 (logand 16384 (getvar "osmode")))
(setvar "OSMODE" (boole 6 (getvar "OSMODE") 16384)))
(command "snap" "0.0625")
(setq insertpt1 (getpoint "\nPick Insertion Point on line: "))
(if (not (tblsearch "layer" "pid"))
(entmake
(list
(cons 0 "Layer")
(cons 100 "AcDbSymbolTableRecord")
(cons 100 "AcDbLayerTableRecord")
(cons 2 "pid")
(cons 70 0)
(cons 62 3)
(cons 6 "Continuous")
)))
(setq Snap (getvar "osmode"))
(setvar "clayer" "pid")
(command "_insert" Return$ insertpt1 "" "" "")
(while (not ss)
(setq ss (entsel "\nSelect line to break: "))
);while
(setvar 'osmode 613)
(setq p3 (getpoint "\nPick valve center:")
p2 (angle p3 (cadr ss)))
(if ( = slide1$ slide2$ slide3$ slide4$ slide5$ slide6$)
(progn
(command "break" ss "f" (polar p3 p2 0.09375)
(polar p3 p2 -0.09375))
)
(progn
(command "break" ss "f" (polar p3 p2 0.1172)
(polar p3 p2 -0.1172))
)
)
(setvar "cmdecho" 1)
(princ)
(setvar "osmode" Snap)
);if
-------------------------------------------------------------------------------
(defun flansmallInsert ( / ss p4 p5)
(done_dialog)
(command "attreq" "0")
(if (eq 16384 (logand 16384 (getvar "osmode")))
(setvar "OSMODE" (boole 6 (getvar "OSMODE") 16384)))
(command "snap" "0.0625")
(setq insertpt1 (getpoint "\nPick Insertion Point on line: "))
(if (not (tblsearch "layer" "pid"))
(entmake
(list
(cons 0 "Layer")
(cons 100 "AcDbSymbolTableRecord")
(cons 100 "AcDbLayerTableRecord")
(cons 2 "pid")
(cons 70 0)
(cons 62 3)
(cons 6 "Continuous")
)))
(setq Snap (getvar "osmode"))
(setvar "clayer" "pid")
(command "_insert" Return$ insertpt1 "" "" "")
(while (not ss)
(setq ss (entsel "\nSelect line to break: "))
);while
(setvar 'osmode 613)
(setq p5 (getpoint "\nPick valve center:")
p4 (angle p5 (cadr ss)))
(command "break" ss "f" (polar p5 p4 0.1172)
(polar p5 p4 -0.1172))
(setvar "cmdecho" 1)
(princ)
(setvar "osmode" Snap)
);if
-----------------------------------------------------------------------------
对于dcl
//---------------------------------------------------------------------------------------------------------
// MySlideImages
//---------------------------------------------------------------------------------------------------------
smallvalves : dialog {
key = "Title";
label = "Small Manually Operated Valves";
spacer;
: row {
: column {
: image_button {
key = "Slide1";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
is_cancel = false;
}
: text {
key = "Text1";
label = "SMALL GATE VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1;}
: image_button {
key = "Slide2";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text2";
label = "SMALL BALL VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1;}
: image_button {
key = "Slide3";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text3";
label = "SMALL GLOBE VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1.2;}
: image_button {
key = "Slide4";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text4";
label = "SMALL CHECK VLV";
fixed_width = true;
alignment = centered;
}
}
: column {
: image_button {
key = "Slide5";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text5";
label = "SMALL BUTTERFLY VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1;}
: image_button {
key = "Slide6";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text6";
label = "SMALL NEEDLE VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1;}
: image_button {
key = "Slide7";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text7";
label = "FLGD SMALL GATE VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1.2;}
: image_button {
key = "Slide8";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text8";
label = "FLGD SMALL BALL VLV";
fixed_width = true;
alignment = centered;
}
}
: column {
: image_button {
key = "Slide9";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text9";
label = "FLGD SMALL GLOBE VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1;}
: image_button {
key = "Slide10";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text10";
label = "FLGD SMALL CHECK VLV";
fixed_width = true;
alignment = centered;
}
:spacer {height = 1;}
: image_button {
key = "Slide11";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: paragraph {
: text {
key = "Text11";
label = "FLGD SMALL";
width = 14;
alignment = centered;
}
: text {
label = "BUTTERFLY VLV";
width = 18;
alignment = centered;
}
}
: image_button {
key = "Slide12";
height = 3.11;
width = 11.00;
fixed_width = true;
alignment = centered;
color = -2;
}
: text {
key = "Text12";
label = "FLGD SMALL NEEDLE VLV";
fixed_width = true;
alignment = centered;
}
}
}
:spacer {height = 2;}
cancel_button;
}//smallvalves
非常感谢,没有遇到我们(最终)无法完成的事情,感觉很好。 不客气,布勒
很高兴你找到了解决方案
亨里克 谢谢你,亨里克。
我在前面的另一节中尝试了你不同的变量建议。。
其中我添加了(action_tile(setq doAction1'T)
然后
if(doAction(normalroutine))
if(doAction1(交替例程))
选择与doAction1关联的动作块仍然会执行normalroutine中的步骤,就好像它根本看不到“aternateroutine”。
你知道另一种方法让我的幻灯片根据他们选择的幻灯片进行不同的例程吗?
再次感谢! bhull1985,
我附上了一个示例DCL和LISP,以及一些注释和根据用户选择执行各种操作的方法。
希望有帮助
亨里克
示例_LISP\u DCL。拉链 哦,我知道你是怎么做到的了,亨利!在第一个defun中,加上一个条件语句,这就更有意义了!
非常感谢您的持续帮助,这将使我们能够清理需要不同修剪长度的例程。
我知道我今天要忙什么。。。 不客气,布勒
很高兴我能帮忙
亨里克
页:
1
[2]