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
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????
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