Freeze/thaw current Viewport

Discussion in 'AutoCAD' started by Irfan, Jun 15, 2004.

  1. Irfan

    Irfan Guest

    help please!

    I need to use 'freeze layer in current viewport' option.My understading of
    viewport(s) object was that it should be below the layout object in the
    object hierachy, which it is not.
    so i tried to use

    For Each activeLyt In acad.ActiveDocument.Layouts
    If activeLyt.Name = "MyLayout" Then
    Set activeVP = activeLyt.activeViewport (this is wrong)
    .....
    End If
    Next

    Can anyone help please, how can i first make a layout active and then make
    its viewport active, so that i can freeze some of its layers. or is their
    anyother method

    irfan
     
    Irfan, Jun 15, 2004
    #1
  2. Irfan

    wivory Guest

    I cobbled this together from information I found on the web which I think is along the lines of what you want. In my case I am creating some layouts and freezing certain layers on each layout. Here is an excerpt:

    Code:
    Dim pviewportObj As AcadPViewport
    
    ThisDrawing.ActiveLayer = ThisDrawing.Layers("Work")
    ThisDrawing.ActiveSpace = acPaperSpace
    
    ' Banana Layout
    ThisDrawing.Layouts.Add "Banana"
    ThisDrawing.ActiveLayout = ThisDrawing.Layouts("Banana")
    Set pviewportObj = ThisDrawing.ActivePViewport
    pviewportObj.Display (True)
    ThisDrawing.MSpace = True
    ThisDrawing.SendCommand "vplayer freeze 0,Apple,Orange" & vbCr & vbCr & vbCr
    ' If it becomes necessary to use something other than SendCommand vplayer then see the following references:
    '    www.contractcaddgroup.com/articles/vport.htm
    '    discussion.autodesk.com/[email protected]/3#5
    pviewportObj.DisplayLocked = True
    ThisDrawing.MSpace = False
    
    (Watch out for the space that the forum interface seems to be inserting at the end of the second url above.)

    Regards

    Wayne Ivory
    IT Analyst Programmer
    Wespine Industries Pty Ltd
     
    wivory, Jun 16, 2004
    #2
  3. Irfan

    Irfan Guest

    VBA is equally good with Acad as any other office application , but like

    other office programs you need to know the features of the application,
    before

    modifying them. You cannot modify Excel cell if you dont know what they are.

    Similaly, you cannot draw a line or circle though VBA if you dont know how

    they are drawn manually in acad.

    Acad is a vast application in itself, it will be good if you start with

    knowing the basic acad commands and how they work to get the real benifts or

    start with VBA tutorial in Acad, it is a very helpful tool.

    You can do everything u can think of in VBA or VB that includes linking with

    databases, extracting data from files etc.

    To answer ur queries:

    1. yes, open acad ->tools-->macro ->vbeditor

    2. yes, all is in built in acad object, similar to when u create msoffice

    application object.

    3.yes, u can link to VB directly, the ony differece is that u create AutoCAD

    object before using it, in VBA u are referring to it already.

    4. loads and loads of websites, just search in google.

    Lastly, buy a VBA AutoCAD book

    HTH

    irfan

    is along the lines of what you want. In my case I am creating some layouts
    and freezing certain layers on each layout. Here is an excerpt:
    the end of the second url above.)
     
    Irfan, Jun 16, 2004
    #3
  4. Irfan

    Irfan Guest

    thankyou very much, that worked with bit of changes

    is along the lines of what you want. In my case I am creating some layouts
    and freezing certain layers on each layout. Here is an excerpt:
    the end of the second url above.)
     
    Irfan, Jun 16, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.