Author Topic: Code Request  (Read 2099 times)

0 Members and 1 Guest are viewing this topic.

Matersammichman

  • Guest
Code Request
« on: June 02, 2006, 11:32:53 AM »
I need code that will evaluate what layers are OFF or FROZEN in MS, and then FREEZE them in ALL VIEWPORTS in ALL LAYOUTS.

Anyone got something at least close to this?
 :ugly:

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Code Request
« Reply #1 on: June 02, 2006, 12:56:15 PM »
This does it, but uses SendCommand.....
Code: [Select]
Sub freezeall()
Dim oLay As AcadLayer
Dim lSpace As Long
Dim iEcho As Integer

ThisDrawing.StartUndoMark
lSpace = ThisDrawing.ActiveSpace
iEcho = ThisDrawing.GetVariable("nomutt")
ThisDrawing.SetVariable "nomutt", 1
ThisDrawing.ActiveSpace = acPaperSpace
For Each oLay In ThisDrawing.Layers
    If oLay.Freeze = True Or oLay.LayerOn = False Then
        ThisDrawing.SendCommand "vplayer f " & oLay.Name & vbCr & "a" & vbCr & vbCr
    End If
Next
ThisDrawing.ActiveSpace = lSpace
ThisDrawing.SetVariable "nomutt", iEcho
ThisDrawing.EndUndoMark
End Sub

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Code Request
« Reply #2 on: June 02, 2006, 01:51:11 PM »
so vplayer isnt exposed to VBA?  seems odd that you can manipulate layers every other way
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)

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Code Request
« Reply #3 on: June 02, 2006, 07:05:51 PM »
It's available. You have to change the xdata stored in the viewport (1002, 1003)
Frank Z or O made a nice  "sub VpLayerOff", it googles ok

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Code Request
« Reply #4 on: June 11, 2006, 01:29:15 PM »
thanks, Ill have a look on monday
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)