alokmpatel Posted September 4, 2013 Posted September 4, 2013 Hello every one, i found thread about change height and width of particular one viewport. My current situation: I have 3 viewports. i want only one viewport at some specific coordinate (say x=100, y=200) and remain two viewports are are at other coordinate (say x=1000, y=2000) it is possible manually, by simply selecting 1st viewport and editing "Center X" and "Center Y" of their viewport property. if some one know than please help me... Alok Quote
Lee Mac Posted September 4, 2013 Posted September 4, 2013 Welcome to CADTutor Alok Are you referring to the viewport target (i.e. the objects viewed through the viewport), or the position of the viewport object itself in paperspace? If you are referring to the target, you will first need to store the current viewport scale (customscale property) so that it may be reset later; you will then need to activate the viewport (mspace property) and set it as the active paperspace viewport (activeviewport property). To change the target, you could use the zoomcenter method with an arbitrary scale factor (since the viewport scale can be restored later by the program). The stored viewport scale can then be reinstated via the customscale property and the viewport deactivated using the mspace property. Quote
alokmpatel Posted September 5, 2013 Author Posted September 5, 2013 Thanks alot Lee, For your instance reply. But i am not that much familiar about VBA programming. as i was go throug lots of treadds in CADTutor i just have some idea. following code is working well for setting desire target(x,y) , scale, height and width. Sub PVPortManipulation() 'Iterate through the viewports of every paperspace Layout. 'Change the pviewports height to 6 'Change it to SE Iso view 'Move each paperspace vport 2 units to the right. 'Set vport scale 'Modify target Dim Entity As AcadEntity Dim VPcenter As Variant Dim PVport As AcadPViewport Dim objLayout As AcadLayout Dim dblDir(0 To 2) As Double Dim i As Integer For Each objLayout In ThisDrawing.Layouts If objLayout.Name "Model" Then ThisDrawing.ActiveLayout = objLayout ThisDrawing.MSpace = False For i = 1 To objLayout.Block.Count - 1 'avoid primary Paperspace PViewport Set Entity = objLayout.Block.Item(i) If TypeOf Entity Is AcadPViewport Then Set PVport = Entity PVport.Display True PVport.Height = 10 PVport.Width = 50 dblDir(0) = -1#: dblDir(1) = -1#: dblDir(2) = 1#: PVport.Direction = dblDir VPcenter = PVport.Center VPcenter(0) = 100# VPcenter(1) = -50# PVport.Center = VPcenter PVport.StandardScale = acVp1_10 dblDir(0) = -6 PVport.Target = dblDir PVport.Update End If Next ThisDrawing.Regen acAllViewports End If Next End Sub but how i will set different viewports property. above code is working, but it is changing all viewport target and all other properties to the same. Thanks. Alok:) Quote
alokmpatel Posted September 12, 2013 Author Posted September 12, 2013 Is it possible???? it will help me alot... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.