Get Named View from within Xref

Discussion in 'AutoCAD' started by BVH-CAD, Jul 3, 2003.

  1. BVH-CAD

    BVH-CAD Guest

    Is it possible to get the name of a NAMED VIEW within an XREF? I've got a custom plotting program that plots using named views and I'd rather put that named view in just ONE drawing (the title block drawing) instead of EVERY SINGLE FILE. Is this possible?? If so, how??

    Thanks in advance!
      ~ Matt
     
    BVH-CAD, Jul 3, 2003
    #1
  2. BVH-CAD

    Jeff Mishler Guest

    using the following as a portion of your code should get what you want...

    Dim doc As AcadDocument
    Dim XRname As String
    Dim view As AcadView
    Dim vName As String
    Dim newView As AcadView

    Set doc = acad.Documents.Open(XRname)
    Set view = doc.Views.Item(vName)
    doc.Close savechanges:=False
    doc = Nothing
    Set newView = ThisDrawing.Views.Add(vName)
    newView.Center = view.Center
    newView.Direction = view.Direction
    newView.Height = view.Height
    newView.Target = view.Target
    newView.Width = view.Width

    HTH,
    Jeff

    custom plotting program that plots using named views and I'd rather put that
    named view in just ONE drawing (the title block drawing) instead of EVERY
    SINGLE FILE. Is this possible?? If so, how??
     
    Jeff Mishler, Jul 3, 2003
    #2
  3. What you can do is write an 'import view' function, by copying the view from the xref object into the drawing. Look at the online help for VBA, and you will see for the Object Model that there is for Blocks a seperate object called DataBase. What you can do is access the xrefs database (ie the database object), and then use the CopyObjects method to copy the view and its ucs settings into your drawing.


    I wrote a routine like this that gives the user a list of xrefs, and on selecting the list tells them what Views are saved with that xref, so that if they select one they can import it. Works a treat and is very, very useful on working with our drawings.
     
    terencechatfielduk, Jul 4, 2003
    #3
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.