所以我偶然发现了这个启示(对我来说是一个启示)
我在这里发布了几次。 事实上,我是Lisp的新手(1-2周),并且很好地掌握了它。 我发布了一个用于创建高程线的lisp文件。 非常简单。 非常适合我。 它要求两层楼的板高和一楼的地板结构,所有这些都是输入的。 难道我不能创建一个对话框从中挑选它们吗?所以我遇到了DCL,但不想深入研究。 然后是VBA。 非常简单。 制作了我的对话框,我可以在其中选择预设按钮,并且可以毫无问题地将这些按钮输入到Lisp中。 正在寻找如何将我的Lisp与VBA相结合,发现我无法做到这一点。 有人能给我指出我现在需要去的方向吗?
**** Hidden Message ***** 从VBA内部调用Lisp是可能的,但这并不太好,无论如何都要避免。我的建议是...因为您已经创建了对话框...你已经看到了VBA的一些优势..那么为什么不继续VBA的项目呢?
从好的方面来说,你可以学习另一种语言!而且变得越来越容易!
记得在遇到困难时问一声
说得好!
当然,一旦你学会了面向对象语言的语法,继续做更大更好的事情就变得相对容易了。
当您需要对AutoCAD对象进行更多的控制时,VBA非常有用,仍然有一些事情最好用lisp来完成,但这是很少的。欢迎来到VBA的奇妙世界... 好。。。好吧,我完成了它...在DCL中,就是这样。 我会尽快尝试进入VBA,但我仍在学习Lisp。 如果有人想看,我会发布它。 是时候回家阅读更多关于这一切的信息了。 好吧,我不确定每个人都会有什么用,但是,我可以向你保证,你可能会得到一些关于你的编程方法的质量反馈。 我不认为有人会用得上它...除了批评...就这样...就是这么一件小事,却让我印象如此深刻!我的下一步是创建图层,如果它们不在绘图中的话。DCL文件:
ELines : dialog {
label = "Elevation Line Setup" ;
: boxed_radio_row {
label = "First Floor Ceiling Height" ;
: radio_button {
key = "opt1" ;
label = "8 Foot" ;
}
: radio_button {
key = "opt2" ;
label = "9 Foot" ;
value = "1" ;
}
: radio_button {
key = "opt3" ;
label = "10 Foot" ;
}
}
: boxed_radio_row {
label = "Second Floor Ceiling Height" ;
: radio_button {
key = "opt4" ;
label = "8 Foot" ;
value = "1" ;
}
: radio_button {
key = "opt5" ;
label = "9 Foot" ;
}
: radio_button {
key = "opt6" ;
label = "10 Foot" ;
}
}
: boxed_radio_row {
label = "First Floor Construction" ;
: radio_button {
key = "opt7" ;
label = "2x10" ;
value = "1" ;
}
: radio_button {
key = "opt8" ;
label = "2x12" ;
}
}
: boxed_radio_row {
label = "Second Floor Construction" ;
: radio_button {
key = "opt9" ;
label = "2x10" ;
value = "1" ;
}
: radio_button {
key = "opt10" ;
label = "2x12" ;
}
}
ok_cancel ;
: row {
: paragraph {
: text_part {
label = "Designed and Created" ;
}
: text_part {
label = "by Dominic Cesare" ;
}
}
}
}
LISP文件:
(prompt "\nType Elines to run.....") ;informs user how to run lisp
(defun c:ELines () ;define function
(setq echo (getvar "cmdecho")) ;gets echo value
(setq HT1 "109") ;set default HT1 value
(setq HT2 "97") ;set default HT2 value
(setq FC1 "11.5") ;set default FC1 value
(setq FC2 "10") ;set default FC2 value
(setq dcl_id (load_dialog "ELines.dcl")) ;load dialog
(if (not (new_dialog "ELines" dcl_id) ;test for dialog
) ;not
(exit) ;exit if no dialog
)
(action_tile "opt1" "(setq HT1 \"97\")") ;store HT1 to 8'-1"
(action_tile "opt2" "(setq HT1 \"109\")") ;store HT1 to 9'-1"
(action_tile "opt3" "(setq HT1 \"121\")") ;store HT1 to 10'-1"
(action_tile "opt4" "(setq HT2 \"97\")") ;store HT2 to 8'-1"
(action_tile "opt5" "(setq HT2 \"109\")") ;store HT2 to 9'-1"
(action_tile "opt6" "(setq HT2 \"121\")") ;store HT2 to 10'-1"
(action_tile "opt7" "(setq FC1 \"11.5\")") ;store FC1 to 11 1/2"
(action_tile "opt8" "(setq FC1 \"13.5\")") ;store FC1 to 1'-0 1/2"
(action_tile "opt9" "(setq FC2 \"10\")") ;store FC2 to 10"
(action_tile "opt10" "(setq FC2 \"12\")") ;store FC2 to 12"
(action_tile
"cancel" ;if cancel button is pressed
"(done_dialog) (setq userclick nil)" ;close dialog, set flag
) ;end action_tile
(action_tile
"accept" ;if O.K. is pressed
"(done_dialog) (setq userclick T))" ;close dialog, set flag
)
(start_dialog) ;start dialog
(unload_dialog dcl_id) ;unload
(if userclick
(progn
(setq DN '(0 -100000000)
UP '(0 100000000)
)
;;; ***************Creating Grade & Top of Foundation ****************
(prompt "\nDraw Grade Line.....")
(setvar "cmdecho" 0)
(command "line" pause pause "") ;creating grade line
(setq L1 (entlast)) ;setting grade line to L1
(command "change" L1 "" "P" "LA" "WALL" "C" "WHITE" "") ;changing grade line to layer wall, color white
(command "offset" "8.0" L1 UP "") ;creating top of foundation line
(setq FDN (entlast)) ;setting top of foundation line to FDN
(command "change" FDN "" "P" "LA" "WALL" "C" "15" "") ;changing top of foundation line to layer wall, color 15
;;; ***************Creating First Floor Lines ************************
(command "offset" FC1 FDN UP "") ;creating first floorline
(setq FLR1 (entlast)) ;setting first floorline to FLR1
(command "change" FLR1 "" "P" "LA" "FLR" "C" "BYLAYER" "") ;changing first floorline to layer FLR, color bylayer
(command "offset" HT1 FLR1 UP "") ;creating first floor ceilingline
(setq CLG1 (entlast)) ;setting first floor ceilingline to CLG1
(command "change" CLG1 "" "P" "LA" "CLG" "") ;changing first floor ceilingline to layer CLG
;;; *************** Creating First Floor Fascia **************************
(command "offset" "3.0" CLG1 DN "") ;creating top of first floor fascia
(setq F1T (entlast)) ;setting top of first floor fascia to F1T
(command "change" F1T "" "P" "LA" "WALL" "") ;changing top of first floor fascia to layer WALL
(command "offset" "8.0" F1T DN "") ;creating bottom of first floor fascia
(setq F1B (entlast)) ;setting bottom of first floor fascia to F1B
;;; *************** Creating Second Floor Lines **************************
(command "offset" FC2 CLG1 UP "") ;creating second floorline
(setq FLR2 (entlast)) ;setting second floorline to FLR2
(command "change" FLR2 "" "P" "LA" "FLR" "") ;changing second floorline to layer FLR
(command "offset" HT2 FLR2 UP "") ;creating second floor ceilingline
(setq CLG2 (entlast)) ;setting second floor ceilingline to CLG2
(command "change" CLG2 "" "P" "LA" "CLG" "") ;changing second floor ceilingline to layer CLG
;;; *************** Creating Second Floor Fascia **************************
(command "offset" "3.0" CLG2 DN "") ;creating top of second floor fascia
(setq F2T (entlast)) ;setting top of second floor fascia to F2T
(command "change" F2T "" "P" "LA" "WALL" "") ;changing top of second floor fascia to layer WALL
(command "offset" "8.0" F2T DN "") ;creating bottom of second floor fascia
(setq F2B (entlast)) ;setting top of second floor fascia to F2B
(setvar "cmdecho" echo)
)
)
(princ)
)
(princ)
这里有几篇你可能会觉得有趣的文章。反正比DCL更有趣
http://code.acadx.com/articles/005.htm
http://code.acadx.com/articles/002.htm 嘿鲍比,很高兴见到你。希望一切都好。
这些文章很棒。谢了。斯蒂格·麦德森 嗨,斯蒂格!
好久不见。 我会在附近一点。我很高兴你喜欢这些文章!
页:
[1]