Live lInk to view port

Discussion in 'AutoCAD' started by Cevans, Jul 7, 2004.

  1. Cevans

    Cevans Guest

    Hi
    I'm still a bit new to AutoCAD and would really appreciate some advice. I have a text box in the model space of a drawing which i created through the VBA code but i would like a 'Live link' to this text box in the Paper space so that i can always ensure what is going out is the correct and up to date info. What is the best way of doing this in VBA coding?
     
    Cevans, Jul 7, 2004
    #1
  2. Cevans

    lorier Guest

    hi,
    Are you saying that whatever the textstring in the textbox is in model space, should be the same as a different textbox in paperspace?
     
    lorier, Jul 9, 2004
    #2
  3. Cevans

    Cevans Guest

    Yes, is there any way to 'link' the texbox in the model space to the text box in the paper space so that if the text is changed in the model space then it is also updated in the paper space - i expect it is so easy to do and i'm being very blonde about it.
     
    Cevans, Jul 12, 2004
    #3
  4. Instead of trying to link two textboxes (I assume you mean AutoCAD TEXT or
    MTEXT objects), you could create a viewport in paperspace that showed the
    modelspace text. The viewport would not shrink and grow with the text
    object, so you'd need to make it large enough to show the longest text item
    you're interested in.

    You would definitely want to lock the viewport once you get it zoomed and
    panned the way you want it. Lastly, even after you lock a VP, on our setup
    (Win2k, ACAD 2002, MS Scroll mouse) there is one mouse setting we had to
    change to protect locked VP's. If you're in modelspace within a LOCKED
    viewport and scrolling your mouse's scroll wheel still causes the viewport
    zoom to change, then let me know and I will track down the person here who
    remembers what that setting is.

    If you're using true type fonts, you need to turn the VP's "Hide Plot"
    property to false, or else your TT text will show up as outlines instead of
    filled.

    James


    box in the paper space so that if the text is changed in the model space
    then it is also updated in the paper space - i expect it is so easy to do
    and i'm being very blonde about it.
     
    James Belshan, Jul 12, 2004
    #4
  5. Cevans

    lorier Guest

    you might want to check out RTEXT if you have express tools.

    this is a lot kludgy, but if you insert the handles (obtained through list command) it seems to work.

    Private Sub AcadDocument_ObjectModified(ByVal Object As Object)
    If Object.Handle = "88" Then HandleToObject("8D").TextString = HandleToObject("88").TextString
    End Sub

    i'd like to hear other ways to go about doing this.
     
    lorier, Jul 13, 2004
    #5
  6. Cevans

    lorier Guest

    and now re-reading your initial post, it seems that you have the modelspace text handle, so that probably doesn't need to be hard-coded, is the paperspace text created through vba as well?
     
    lorier, Jul 13, 2004
    #6
  7. Cevans

    Cevans Guest

    I have not yet coded the way the text is put into the paper space so it could be produced through vba if it does the job.
     
    Cevans, Jul 13, 2004
    #7
  8. Cevans

    lorier Guest

    maybe
    Public msTextHandle As String
    Public psTextHandle As String

    Sub Example_addText()
    Dim dblPt(0 To 2) As Double
    Dim msText As AcadText: Dim psText As AcadText
    dblPt(0) = 0#: dblPt(1) = 0#: dblPt(2) = 0#
    Set msText = THISDRAWING.ModelSpace.addText("test", dblPt, 5#)
    Set psText = THISDRAWING.PaperSpace.addText("test", dblPt, 0.1)
    msTextHandle = msText.handle
    psTextHandle = psText.handle
    End Sub

    Private Sub AcadDocument_ObjectModified(ByVal Object As Object)
    If Object.handle = msTextHandle Then HandleToObject(psTextHandle).TextString = HandleToObject(msTextHandle).TextString
    End Sub

    or maybe store the handles in a file or registry
     
    lorier, Jul 14, 2004
    #8
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.