TheSwamp
Code Red => VB(A) => Topic started by: ML on August 17, 2007, 12:52:16 PM
-
Hi,
If I am using the begin plot event and I want to load and run a lisp routine on begin plot, is this possible?
ie:
Private Sub ACADApp_BeginPlot(ByVal DrawingName As String)
(load "c:/Path/LispRoutine");LispRoutine;
End Sub
Thank you,
Mark
-
Absolutely possible.
-
Be better off loading the Lisp ahead of time in your Acad2???doc.lsp with something like:
(load "c:/Path/LispRoutine")
Then place this in the "ThisDrawing" portion of the dvb:
Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
ThisDrawing.SendCommand "(LispRoutine)" & vbCr
End Sub
-
Yes,
I understand that and realize I could do that but I want to "load" and run it from the event
Mark
-
Ok, just do this (haven't tested it):
Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
ThisDrawing.SendCommand "(load "c:/Path/LispRoutine")" & vbCr
ThisDrawing.SendCommand "(LispRoutine)" & vbCr
End Sub
-
That was a good try :)
It was still erroring out on the first line, so I tried
Private Sub ACADApp_BeginPlot(ByVal DrawingName As String)
ThisDrawing.SendCommand Load("c:/custom/color2style") & vbCr <-----
ThisDrawing.SendCommand "(color2style)" & vbCr
End Sub
With this, it did not error out but the event also did not run
I may need to loop through Modelspace since it looks for a variable drawingname
May be something like this?
What do you think?
Thank you
Mark
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
-
So you're trying to load a CTB/PC3 before a plot? If thats the case why not use a quickplot kind of function, a button/command that has all plotting parameters in it, such as:
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
This of course doesn't really answer your original question, but it does get the job done (if thats what you need to do).
-
Or, why not convert the lisp to VBA?
Or, search for VLAX.CLS which makes using lisp inside VBA rather easy.
The problem with SendCommand is A.) Events don't like command calls, & B.) Is not processed synchronously with your VBA app.
-
Or, why not convert the lisp to VBA?
Or, search for VLAX.CLS which makes using lisp inside VBA rather easy.
The problem with SendCommand is A.) Events don't like command calls, & B.) Is not processed synchronously with your VBA app.
I like learning, sometimesit's fun.
Thankyou Jeff,
I ran into that a while ago, but forgot about the intricacies of it.