Maintain screen position (?) after command is run

Maintain screen position (?) after command is run

js75CAD
Enthusiast Enthusiast
814 Views
7 Replies
Message 1 of 8

Maintain screen position (?) after command is run

js75CAD
Enthusiast
Enthusiast

Hi,

 

I am running a command where I take a selection, copy it and then scale it, based on a start point and an endpoint. So I am trying to copy info from one place to another. Ie I want to copy a block from point a to point b in model space. This works perfectly.

 

However, once I commit the transaction, the screen snaps back to the original view. So where I started with the model space view of the block at point a, zoom out, pan across (etc, etc), get to point b, pick the point, the view resumes back where I started instead of the view at point b.

 

How do you commit the command and then force AutoCAD to keep the view area that is chosen at the end of the command?

 

What am I missing here? Is anyone able to help me with this please?

0 Likes
Accepted solutions (1)
815 Views
7 Replies
Replies (7)
Message 2 of 8

Jeff_M
Consultant
Consultant

It would likely help to post your code. I have code that does similar things but the display remains where it ends up after any pans/zooms.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 8

js75CAD
Enthusiast
Enthusiast

I am not quite sure what this will achieve, but find below a (very) small section of what I am trying to do.

 

 

Dim psr As PromptSelectionResult = ed.GetSelection()

        If Not psr.Status = PromptStatus.OK Then
            Return
        End If

        Dim ppr As PromptPointResult = ed.GetPoint("" & vbLf & "Base point: ")
        If (ppr.Status <> PromptStatus.OK) Then
            Return
        End If

        Dim basePoint As Point3d = ppr.Value
        Dim ppo As PromptPointOptions = New PromptPointOptions("" & vbLf & "Second point: ")
        ppo.BasePoint = basePoint
        ppo.UseBasePoint = True
        ppr = ed.GetPoint(ppo)
        If (ppr.Status <> PromptStatus.OK) Then
            Return
        End If

        Dim disp As Vector3d = basePoint.TransformBy(ucs).GetVectorTo(ppr.Value.TransformBy(ucs))

 

 

So in between picking the basepoint and the second point, I have panned and zoomed around model space to find a place to make the copy of each entity in the selection set. But I have not include all this because it goes for ages.

 

Essentially, what I want to do is start the command, zoom pan, do whatever, but where that view is when it finishes, I would like to stay there. Instead, AutoCad reverts the view back to before the command started.

0 Likes
Message 4 of 8

_gile
Consultant
Consultant
Accepted solution

Hi,

The code snippet you posted is not relevant.

Your problem may be due to an aborted (or non-commited) transaction.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 8

junaidyousuf006
Explorer
Explorer

If you're working with 3D models, using the "VIEWBASE" or "VIEWSECTION" command might help. These commands create 2D views from 3D models, and you can specify the orientation and scale of the view. After you've created the view, it might not be affected by the reset issue you're facing. If you're using a more recent version of AutoCAD, you can try the "CAMERA" command. This command lets you save camera views and restore them later, which might help you maintain the desired view after executing your copy and scale command.

0 Likes
Message 6 of 8

js75CAD
Enthusiast
Enthusiast

On the money again _gile.

 

I found the pesky sub where I called the transaction to select the two points and found I had missed committing.

 

Thanks to all for your help.

0 Likes
Message 7 of 8

daudk4864
Community Visitor
Community Visitor

recommended to use this  option "VPORTS" command to create a new viewport in model space. This allows you to define a specific view and zoom level for the copied block at point B. Once the viewport is created, you can switch to it to maintain the desired view even after committing the command.

0 Likes
Message 8 of 8

daudk4864
Community Visitor
Community Visitor

In addition to using the "Zoom Window" command (shortcut: ZW), you can also use the "Zoom Dynamic" command (shortcut: ZD). This command allows you to define a window by clicking and dragging the cursor, and AutoCAD will dynamically adjust the zoom level as you drag the window. This can be useful for quickly zooming in on the desired view at point b after committing the command.

0 Likes