Author Topic: autoload  (Read 1846 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
autoload
« on: February 21, 2005, 08:04:12 AM »
I have some vba events that I'd like to run each time I start Autocad. I originally put a call to them in acad.lsp, but each succesive opened drawing, I'd receive a message telling me that they were already loaded. What can I do to avoid this message? Also, I was wondering if someone could help me with finishing this event up?
Code: [Select]
'Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
'   If CommandName = "PLOT" Then
'  Dim AcadDim As AcadDimension
'    Dim SelSet As AcadSelectionSet
'
'    Set SelSet = ThisDrawing.SelectionSets.Add("Dimension")
'
'        For Each AcadDim In SelSet
'            SendCommand "_.draworder" & vbCr & vbCr
'        Next AcadDim
'    End If
'End Sub

What I'm trying to accomplish is moving all dimensions to the back of the draworder before plotting, so there are no extension lines showing up in print that are laid out along a line. Thanks.

TR

  • Guest
autoload
« Reply #1 on: February 21, 2005, 09:32:06 AM »
For the autoloading part look at this:

http://theswamp.org/phpBB2/viewtopic.php?p=40172#40172

daron

  • Guest
autoload
« Reply #2 on: February 21, 2005, 09:40:42 AM »
So, do I put the code in the acad.dvb or can I have the code in different files and call it from there?

P.S. Thanks. I had seen that thread before, but couldn't relocate it.

ronjonp

  • Needs a day job
  • Posts: 7022
autoload
« Reply #3 on: February 21, 2005, 10:28:48 AM »
Take a look at this thread:

http://theswamp.org/phpBB2/viewtopic.php?p=47284#47284

I've been using this:

Code: [Select]
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
 Dim XrefLay As AcadLayer
 Dim MvLay As AcadLayer
 Dim ImgLay As AcadLayer
 Dim HatchLay As AcadLayer
 Dim DimLay As AcadLayer
 
 If CLayer <> "" Then
  ThisDrawing.SetVariable "CLAYER", CLayer
  CLayer = ""
 End If


 If (CommandName = "XREF") Then
  CLayer = ThisDrawing.GetVariable("CLAYER")
  Set XrefLay = ThisDrawing.Layers.Add("xref")
  XrefLay.color = acWhite
 If XrefLay.LayerOn = False Then
  XrefLay.LayerOn = True
  ThisDrawing.Regen (acAllViewports)
 End If
 If XrefLay.Freeze = True Then
  XrefLay.Freeze = False
  ThisDrawing.Regen (acAllViewports)
 End If
  ThisDrawing.SetVariable "CLAYER", "xref"
 End If
..........



With these lines in my acad.lsp to load it:

Code: [Select]
(vl-load-com)
(vl-vbaload (findfile "C:/Program Files/AutoCAD Tools/create_lyrs.dvb"))
(vl-vbaload (findfile "C:/Program Files/AutoCAD Tools/acad.dvb"))
(princ)

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC