+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Forum Newbie
    Using
    Mechanical 2012
    Join Date
    Jul 2013
    Posts
    6

    Default change viewports position (x and y cordinates)

    Registered forum members do not see this ad.

    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

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    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.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  3. #3
    Forum Newbie
    Using
    Mechanical 2012
    Join Date
    Jul 2013
    Posts
    6

    Default

    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

  4. #4
    Forum Newbie
    Using
    Mechanical 2012
    Join Date
    Jul 2013
    Posts
    6

    Default

    Registered forum members do not see this ad.

    Is it possible????

    it will help me alot...

Similar Threads

  1. Cant paste by cordinates
    By Bara in forum AutoCAD Beginners' Area
    Replies: 8
    Last Post: 18th Jan 2013, 12:48 pm
  2. Change position of attributes
    By Mica in forum AutoCAD Drawing Management & Output
    Replies: 7
    Last Post: 10th Apr 2012, 07:29 am
  3. Loosing unwrap UVW cordinates
    By nowikovs12 in forum UVW Mapping, Textures & Materials
    Replies: 2
    Last Post: 7th Mar 2012, 11:32 am
  4. How to change the position of an object without changing the ucs?
    By marlon in forum AutoCAD 3D Modelling & Rendering
    Replies: 11
    Last Post: 5th Nov 2008, 05:57 am
  5. Change in Viewports
    By Wicks in forum AutoCAD General
    Replies: 4
    Last Post: 2nd Jan 2008, 08:19 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts