Author Topic: VP on layer  (Read 1914 times)

0 Members and 1 Guest are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
VP on layer
« on: October 15, 2007, 02:44:12 PM »
Does anyone know how to manipulate a VP's layer thru code?  This does not work
Code: [Select]
      Dim objViewport As AcadViewport
      For Each objViewport In ThisDrawing.Viewports
      objViewport.Layer = "DEFPOINTS"
      Next objViewport
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)

Guest

  • Guest
Re: VP on layer
« Reply #1 on: October 15, 2007, 03:01:44 PM »
I've used the following code for something similar.... locking all viewports.
I added the 'layer = Defpoints' and it still works fine.

There's probably a better way than what I'm doing, but hey... if it ain't broke.


Code: [Select]
Public Sub x()
    Dim FilterType(0) As Integer
    Dim FilterData(0) As Variant
    Dim sset As AcadSelectionSet
    Dim objVP As AcadPViewport
    Dim x As Integer
   
    FilterType(0) = "0"
    FilterData(0) = "VIEWPORT"

    Set sset = vbdPowerSet("VPUpdate")
    sset.Select acSelectionSetAll, , , FilterType, FilterData
    For x = 0 To sset.Count - 1
        Set objVP = sset(x)
        objVP.Layer = "Defpoints"
        objVP.DisplayLocked = True
    Next x
End Sub

Private Function vbdPowerSet(strName As String) As AcadSelectionSet
    Dim objSelSet As AcadSelectionSet
    Dim objSelCol As AcadSelectionSets
   
    Set objSelCol = ThisDrawing.SelectionSets
    For Each objSelSet In objSelCol
        If objSelSet.Name = strName Then
            objSelSet.Delete
            Exit For
        End If
    Next
    Set objSelSet = ThisDrawing.SelectionSets.Add(strName)
    Set vbdPowerSet = objSelSet
End Function

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: VP on layer
« Reply #2 on: October 15, 2007, 03:04:04 PM »
DUH, I am such an Idiot, I didn't use AcadPViewport

thanks
« Last Edit: October 15, 2007, 03:05:39 PM by CmdrDuh »
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)