Author Topic: Speaking of CAB's Plot Tabs routine...  (Read 3682 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Speaking of CAB's Plot Tabs routine...
« on: June 24, 2005, 04:37:01 PM »
I want to run a vba macro on all layouts.  I would like to put it into a pull down menu.  Once clicked, the .dvb file gets loaded and the macro is ran.  Then the tab is switched, macro is run again.  I have the first (easy) part in the menu, but the tab switching is a whole 'nother monster.  I tried disecting CAB's Plot Tabs routine, but now my head hurts.  Is there a down and dirty tab switch routine that I can mess with?

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #1 on: June 24, 2005, 04:48:26 PM »
use the thisdrawing.layoutswitched event
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #2 on: June 24, 2005, 04:51:10 PM »
here is an example
Code: [Select]
Private Sub AcadDocument_LayoutSwitched(ByVal LayoutName As String)
Dim dblLTScale As Double
Dim dblDimScale As Double
dblLTScale = 0.6 * (Val(ThisDrawing.GetVariable("DIMSCALE")))
If dblLTScale = 0 Then
dblLTScale = 0.6
End If
    With ThisDrawing
        If .ActiveSpace = acModelSpace Then
            .SetVariable "LTSCALE", dblLTScale
            ThisDrawing.Regen acAllViewports
            Exit Sub
            Else
            .SetVariable "LTSCALE", 0.6
            .SetVariable "PSLTSCALE", 1
            ThisDrawing.Regen acAllViewports
            Exit Sub
        End If
    End With
Exit Sub
End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Speaking of CAB's Plot Tabs routine...
« Reply #3 on: June 24, 2005, 04:59:00 PM »
Thank you CmdrDuh...I'll see what I can do with that...here's what I was working from (taken from the developer help):

Code: [Select]
Sub DisplayPlotStyles()
    ' This example reads and modifies the ShowPlotStyles
    ' value, and then regenerates all viewports.
   
    Dim ACADLayout As ACADLayout
    Dim originalValue As Boolean
   
    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout
   
    ' Read and display the original value
    ' originalValue = ACADLayout.ShowPlotStyles
    ' MsgBox "The ShowPlotStyles value is set to: " & originalValue

    ' Modify the ShowPlotStyles preference by changing the value
    ACADLayout.ShowPlotStyles = Not ACADLayout.ShowPlotStyles
    ' MsgBox "The ShowPlotStyles value has been set to: " & ACADLayout.ShowPlotStyles

    'Regenerate viewports
    ThisDrawing.Regen acAllViewports


I guess this falls into the VBA forum...I thought I would need LISP to do the tab switching...mod should probably move ( if agreed upon )

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #4 on: June 24, 2005, 05:05:50 PM »
whats really funny was i didn't  notice you were asking for a LISP solution.  I was just happy to have an answer, I posted before looking to see where it was.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #5 on: June 24, 2005, 05:06:37 PM »
so what do you want to do?  maybe I can help
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Speaking of CAB's Plot Tabs routine...
« Reply #6 on: June 24, 2005, 05:13:39 PM »
Well...I'd prefer LISP for now, because I'm coding a entire menu system for a client, and I understand LISP, to some extent.

EDIT:  Also because part of the menu is to plot certain tabs.  Predefined by menuselection:

Code: [Select]

[->Plotting...]
[Current View]^C^C^C-PLOT;YES;;HP LaserJet 5000 Series PCL 6.pc3;11x17;INCHES;LANDSCAPE;NO;EXTENTS;1:1;0.290322,-0.000694;YES;MRF11X17.ctb;YES;YES;NO;NO;NO;NO;YES;
[--]
[->All Views for a Single Floor...]
[1st Floor]
[2nd Floor]
[3rd Floor]
[4th Floor]
[<-5th Floor]
[->Single View on ALL Floors...]
[Egress Lighting]
[Exit Signage]
[--]
[Rated Doors]
[Rated Walls]
[--]
[Smoke Resistant Doors]
[Snow and Ice Removal]
[--]
[<-<-Trash and Linen Chutes]

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Speaking of CAB's Plot Tabs routine...
« Reply #7 on: June 24, 2005, 05:17:07 PM »
I know I'm showing two different things, one VBA for displaying plot styles, and one macro for plotting, but they both deal with tab switching...so...

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #8 on: June 24, 2005, 05:18:20 PM »
are each tab a view like "egress lighting" or "Rated Doors"?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #9 on: June 24, 2005, 05:20:17 PM »
you can code it all in vba if you want, and call it from your menu w/ LISP.  thats what I do.
[2nd Floor](command "-vbarun" "Whatever")

just make sure you (vl-vbaload "macro") in your mnl file
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Speaking of CAB's Plot Tabs routine...
« Reply #10 on: June 24, 2005, 05:21:19 PM »
yes...each tab is a floor and view...for example:
Code: [Select]

1st Floor - Egress Lighting
2nd Floor - Egress Lighting
1st Floor - Exit Signage
2nd Floor - Exit Signage
etc...

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #11 on: June 24, 2005, 05:21:28 PM »
Is this for LT?
I have a plot macro you can edit with all your settings and it works better than -plot
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #12 on: June 24, 2005, 05:22:16 PM »
Code: [Select]
Public Sub Vendor1117()
Dim Layout As AcadLayout
Set Layout = ThisDrawing.ActiveLayout
Layout.RefreshPlotDeviceInfo
Layout.ConfigName = "11x17Draft.pc3"
Layout.PlotType = acExtents
Layout.PlotRotation = ac90degrees
Layout.StyleSheet = "11X17-CHECKSET.ctb"
Layout.CanonicalMediaName = "ANSI_B_(11.00_x_17.00_Inches)"
Layout.PaperUnits = acInches
Layout.StandardScale = acScaleToFit
Layout.ShowPlotStyles = False
ThisDrawing.Plot.NumberOfCopies = 1
Layout.CenterPlot = True
Layout.RefreshPlotDeviceInfo
ThisDrawing.Regen acAllViewports
ZoomExtents
ThisDrawing.Plot.PlotToDevice
Set Layout = Nothing
'ThisDrawing.Close True   ' do yo want to close the dwg?
Exit Sub
End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Speaking of CAB's Plot Tabs routine...
« Reply #13 on: June 24, 2005, 05:23:59 PM »
You should be able to see the parts to change for your HP printer.  And depending on if ctb files need to change, or printers change, you just either copy paste and edit  OR change this to a function and pass arguments to it.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Speaking of CAB's Plot Tabs routine...
« Reply #14 on: June 24, 2005, 05:26:14 PM »
Not LT...the company will be upgrading from R14 to 2004.  I have full control over this entire system, so as long as I can understand it, I'll use it.  If I'm called to add something to the menu, like another view (i.e. fire extinguishers), then I need to be able to make that change and modify anything else it affects with no problem.  I'm really just getting into VBA, so I'm not fully comfortable with it yet.  But as long as I can understand what's going on with it, I'll use it.

P.S.  I appreciate the help :twisted: