Author Topic: Display Viewports On/Off  (Read 2568 times)

0 Members and 1 Guest are viewing this topic.

DanB

  • Bull Frog
  • Posts: 367
Display Viewports On/Off
« on: August 31, 2005, 12:58:36 PM »
Is it possible to globally change the display on/off for ALL viewports in a drawing in one "command." Drawing contains multiple layouts each with multiple viewports. I would like to be able to turn on/off all of them at once. If this needs to be or can be done through LISP I am okay with that as well. Any ideas or a nudge in the right direction?

Thanks,
Dan

deegeecees

  • Guest
Display Viewports On/Off
« Reply #1 on: August 31, 2005, 01:02:22 PM »
You'll have to create that one.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Display Viewports On/Off
« Reply #2 on: August 31, 2005, 01:21:23 PM »
a button...don't know the command off hand...but maybe
Code: [Select]
vport;on;*;

Bob Wahr

  • Guest
Display Viewports On/Off
« Reply #3 on: August 31, 2005, 01:55:58 PM »
VBA?
Code: [Select]
Sub VPOn()
Dim objVP As AcadPViewport
Dim objStuff() As AcadEntity
Dim objSSet As AcadSelectionSet
Dim intGrp(0) As Integer
Dim varData(0) As Variant
intGrp(0) = 0
varData(0) = "viewport"
On Error GoTo UhOh
Set objSSet = ThisDrawing.PickfirstSelectionSet
objSSet.Select acSelectionSetAll, , , intGrp, varData

For Each objVP In objSSet
  objVP.ViewportOn = True
Next objVP
BuhBye:
  Exit Sub
UhOh:
  Select Case Err.Number
    Case -2145386494
      Err.Clear
      Resume Next
    Case Else
      Debug.Print Err.Number
      GoTo BuhBye
  End Select
 
End Sub

Sub VPOff()
Dim objVP As AcadPViewport
Dim objStuff() As AcadEntity
Dim objSSet As AcadSelectionSet
Dim intGrp(0) As Integer
Dim varData(0) As Variant
intGrp(0) = 0
varData(0) = "viewport"
On Error GoTo UhOh
Set objSSet = ThisDrawing.PickfirstSelectionSet
objSSet.Select acSelectionSetAll, , , intGrp, varData

For Each objVP In objSSet
  objVP.ViewportOn = False
Next objVP
BuhBye:
  Exit Sub
UhOh:
  Select Case Err.Number
    Case -2145386494
      Err.Clear
      Resume Next
    Case Else
      Debug.Print Err.Number
      GoTo BuhBye
  End Select
 
End Sub

t-bear

  • Guest
Display Viewports On/Off
« Reply #4 on: August 31, 2005, 02:02:57 PM »
Time of initial request: 11:58
Time of complete VBA solution: 12:55
just under 1 hour.....you guys scare me!
Bob, did you just bang that out or is it something you had "laying around" somewhere?

Bob Wahr

  • Guest
Display Viewports On/Off
« Reply #5 on: August 31, 2005, 02:19:56 PM »
banged it out.  In case anyone is wondering about the error case, using that filter turns up on more viewport than there is in the drawing, I'm 95% sure it's the layout but didn't try to hard to figure it out.  Can't change visibilty on it though so it throws up that error.

JohnK

  • Administrator
  • Seagull
  • Posts: 10664
Display Viewports On/Off
« Reply #6 on: August 31, 2005, 04:46:22 PM »
well im 95% sure you can be 100% sure. *lol*

...Im sure its the layout.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Bob Wahr

  • Guest
Display Viewports On/Off
« Reply #7 on: August 31, 2005, 05:57:59 PM »
yeah, the extra 5% was because I didn't care enough to verify.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Display Viewports On/Off
« Reply #8 on: September 02, 2005, 11:08:56 PM »
I go to Vegas and miss all the fun.
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: 4076
Display Viewports On/Off
« Reply #9 on: September 02, 2005, 11:11:35 PM »
Quote from: Bob Wahr
VBA?
Code: [Select]
     GoTo BuhBye
 

Would Resume BuhBye work as well?
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)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Display Viewports On/Off
« Reply #10 on: September 05, 2005, 05:37:26 PM »
some one give me a lisp doing that.....

I'll sent you as soon I found it !!


 :-D
Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Display Viewports On/Off
« Reply #11 on: September 05, 2005, 07:38:48 PM »
I'll sent you as soon I found it !!

What, you can't share with the rest of the class?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst