Draw in Paperspace or Modelspace

Discussion in 'AutoCAD' started by Rob Peterson, Mar 18, 2005.

  1. Rob Peterson

    Rob Peterson Guest

    How do you get VBA to draw in either model or paper space, depending on
    which one is active.

    The following will draw in paperspace:

    Set objBubble = ThisDrawing.PaperSpace.AddCircle(BubblePnt, BubbleRad)

    This will draw in modelspace:

    Set objBubble = ThisDrawing.ModelSpace.AddCircle(BubblePnt, BubbleRad)

    What do I need to change? I've tried ThisDrawing.ActiveSpace but that does
    not work.

    Any help is appreciated.
     
    Rob Peterson, Mar 18, 2005
    #1
  2. Rob Peterson

    Jeff Mishler Guest

    This is how I do it:
    Code:
    Dim oSpace As AcadBlock
    If ThisDrawing.GetVariable("cvport") = 1 Then
    Set oSpace = ThisDrawing.PaperSpace
    Else
    Set oSpace = ThisDrawing.ModelSpace
    End If
    
    Set objBubble = oSpace.AddCircle(BubblePnt, BubbleRad)
    
     
    Jeff Mishler, Mar 18, 2005
    #2
  3. Rob Peterson

    Joe Sutphin Guest

    I believe this is what he's looking for:

    ThisDrawing.ActiveSpace = acPaperSpace or ThisDrawing.ActiveSpace =
    acModelSpace


    Joe
    --

     
    Joe Sutphin, Mar 18, 2005
    #3
  4. Rob Peterson

    Jeff Mishler Guest

    I read it that he wants to draw in the space that is currently active. If
    you are working in MS through a PS Viewport, the ActiveSpace will report
    that you are in PS. The code I showed ensures you draw in the Space that the
    user is really working in ..........

    --
    Jeff
    check out www.cadvault.com
     
    Jeff Mishler, Mar 18, 2005
    #4
  5. Rob Peterson

    Joe Sutphin Guest

    I realize exactly what your code is doing. However, I think he wanted to
    know how to make the active space one or the other. I generally change to
    the appropriate space, do my work, and change back.

    Joe
    --

     
    Joe Sutphin, Mar 18, 2005
    #5
  6. Rob Peterson

    Jeff Mishler Guest

    OK, now you've piqued my interest. ;-) How does changing your ActiveSpace
    affect your work? AFAIK, switching space just to add a line or arc or
    whatever just adds a regen or two, since you still must use the ModelSpace
    or Paperpace object to add it to....or have I been missing something?

    Thanks,
    --
    Jeff

     
    Jeff Mishler, Mar 18, 2005
    #6
  7. ThisDrawing.ActiveLayout.Block.Addwhatever

    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Mar 19, 2005
    #7
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.