Twist Angle ??

Discussion in 'AutoCAD' started by Nate Hunter, Apr 14, 2004.

  1. Nate Hunter

    Nate Hunter Guest

    My users are using a dview command and setting the twist angle of a
    viewport. I need to get the twist angle of a viewpot then in another
    drawing set the twist angle to my first angle.

    Any Ideas on how to do this? I thought it would be as simple as:

    --------------------------------------------------
    Dim PPort As AcadPViewport
    Dim twistAngle As Double
    Dim Sset As AcadSelectionSet
    Dim IntCode(0) As Integer
    Dim VarVal(0) As Variant

    Set Sset = ThisDrawing.SelectionSets.Add("Rebuild")
    Sset.Select acSelectionSetAll, , , IntCode, VarVal

    Set PPort = Sset(0)
    twistAngle = PPort.twistAngle ' this should be the twist angle but it is
    always 0

    Sset.Delete
    Set PPort = Nothing
     
    Nate Hunter, Apr 14, 2004
    #1
  2. Nate Hunter

    Mark Propst Guest

    If Sset(0) was indeed a pspace vport then it should work

    you may want to include some error code to only try to read psvports

    though I would think if it weren't a psvport then you'd get an error with
    the .TwistAngle call but????
     
    Mark Propst, Apr 14, 2004
    #2
  3. Nate Hunter

    Jeff Mishler Guest

    Actually he'd get an error with the Set PPort = Sset(0) call. I'd
    suspect a previous call to On Error Resume Next. The following worked
    for me:

    Sub test()

    Dim PPort As AcadPViewport
    Dim twistAngle As Double
    Dim Sset As AcadSelectionSet
    Dim IntCode(0) As Integer
    Dim VarVal(0) As Variant

    VarVal(0) = "VIEWPORT" ' ADDED
    On Error Resume Next ' ADDED
    ThisDrawing.SelectionSets.Item("Rebuild").Delete ' ADDED
    On Error GoTo 0 ' ADDED
    Set Sset = ThisDrawing.SelectionSets.Add("Rebuild")
    Sset.Select acSelectionSetAll, , , IntCode, VarVal

    Set PPort = Sset(0) 'should account for more than 1 item?
    twistAngle = PPort.twistAngle ' this IS the twist angle

    'Sset.Delete 'COMMENTED OUT
    Set PPort = Nothing

    End Sub

    HTH,
    Jeff
     
    Jeff Mishler, Apr 14, 2004
    #3
  4. Nate Hunter

    Nate Hunter Guest

    awesome what you gave me works!

    Thanks for your help
     
    Nate Hunter, Apr 14, 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.