Author Topic: Loading and Running a LISP routine from THe VBA Begin Plot Event  (Read 1579 times)

0 Members and 1 Guest are viewing this topic.

ML

  • Guest

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:

Code: [Select]
Private Sub ACADApp_BeginPlot(ByVal DrawingName As String)

(load "c:/Path/LispRoutine");LispRoutine;


End Sub


Thank you,

Mark







deegeecees

  • Guest
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #1 on: August 17, 2007, 12:54:22 PM »
Absolutely possible.

deegeecees

  • Guest
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #2 on: August 17, 2007, 01:04:24 PM »
Be better off loading the Lisp ahead of time in your Acad2???doc.lsp with something like:

Code: [Select]
(load "c:/Path/LispRoutine")
Then place this in the "ThisDrawing" portion of the dvb:

Code: [Select]
Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
    ThisDrawing.SendCommand "(LispRoutine)" & vbCr
End Sub

ML

  • Guest
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #3 on: August 17, 2007, 01:17:11 PM »

Yes,
I understand that and realize I could do that but I want to "load" and run it from the event

Mark

deegeecees

  • Guest
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #4 on: August 17, 2007, 01:23:53 PM »
Ok, just do this (haven't tested it):

Code: [Select]
Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
    ThisDrawing.SendCommand "(load "c:/Path/LispRoutine")" & vbCr
    ThisDrawing.SendCommand "(LispRoutine)" & vbCr
End Sub

ML

  • Guest
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #5 on: August 17, 2007, 03:16:16 PM »


That was a good try :)

It was still erroring out on the first line, so I tried

Code: [Select]
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

Code: [Select]
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

  • Guest
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #6 on: August 18, 2007, 09:46:29 AM »
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:

Code: [Select]
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).
« Last Edit: August 19, 2007, 12:34:18 PM by CmdrDuh »

Jeff_M

  • King Gator
  • Posts: 3944
  • C3D user & customizer
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #7 on: August 18, 2007, 10:42:53 AM »
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.

deegeecees

  • Guest
Re: Loading and Running a LISP routine from THe VBA Begin Plot Event
« Reply #8 on: August 18, 2007, 09:51:22 PM »
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.