deegeecees 发表于 2007-8-17 12:52:16

从VBA Begin Plot事件加载并运行LISP例程

**** Hidden Message *****

deegeecees 发表于 2007-8-17 12:54:22

这是绝对可能的。

deegeecees 发表于 2007-8-17 13:04:24

最好在你的Acad2中提前加载Lisp???doc.lsp如下内容:
(load "c:/Path/LispRoutine")
然后将其放在dvb的“ThisDrawing”部分:
Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
    ThisDrawing.SendCommand "(LispRoutine)" & vbCr
End Sub

deegeecees 发表于 2007-8-17 13:17:11

好吧,就这么办(没测试过):
Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
    ThisDrawing.SendCommand "(load "c:/Path/LispRoutine")" & vbCr
    ThisDrawing.SendCommand "(LispRoutine)" & vbCr
End Sub

Jeff_M 发表于 2007-8-17 13:23:53


这是一个很好的尝试
它仍然在第一行出错,所以我尝试了
Private Sub ACADApp_BeginPlot(ByVal DrawingName As String)
ThisDrawing.SendCommand Load("c:/custom/color2style") & vbCr   Private Sub ACADApp_BeginPlot(ByVal DrawingName As String)
For each Drawingname in Thisdrawing.Modelspace
ThisDrawing.SendCommand Load("c:/custom/color2style") & vbCr   <-----
ThisDrawing.SendCommand "(color2style)" & vbCr
Next Drawingname
End Sub

deegeecees 发表于 2007-8-17 15:16:16

所以你想在绘图前加载CTB/PC3?如果是这种情况,为什么不使用quickplot类型的函数,一个包含所有打印参数的按钮/命令,例如:
ThisDrawing.SendCommand "-plot" & vbCr & "y" & vbCr & "Model" & vbCr
& "Oce TDS600 3.x.pc3" & vbCr & "ARCH expand D (36.00 x 24.00 Inches)" & vbCr
& "inches" & vbCr & "Landscape" & vbCr & "no" & vbCr & "extents" & vbCr & "fit"
& vbCr & "Center" & vbCr & "yes" & vbCr & "comed36x24.ctb" & vbCr & "yes" & vbCr
& "n" & vbCr & vbCr & vbCr & vbCr
这当然不能真正回答您最初的问题,但它确实完成了工作(如果您需要这样做的话)。

deegeecees 发表于 2007-8-18 09:46:29

或者,为什么不将 lisp 转换为 VBA?
或者,搜索 VLAX。CLS使得在VBA中使用lisp变得相当容易。
SendCommand 的问题是 A。)事件不喜欢命令调用,以及 B。不与 VBA 应用程序同步处理。

deegeecees 发表于 2007-8-18 10:42:53


我喜欢学习,有时很有趣。
谢谢Jeff,
我前阵子遇到了这个问题,但是忘记了它的复杂性。
页: [1]
查看完整版本: 从VBA Begin Plot事件加载并运行LISP例程