Saving viewport "view" and applying to another viewport?

Saving viewport "view" and applying to another viewport?

Dallas_B
Participant Participant
451 Views
4 Replies
Message 1 of 5

Saving viewport "view" and applying to another viewport?

Dallas_B
Participant
Participant

tldr, is there an easy way to save where a viewport is 'looking at' in model space, and apply that to a different viewport?

 

I'm in the process of creating a lisp routine that assists in replacing a drawing's old title block with a newer version. In this process, I'm saving any data or objects I need to save from the old layout, deleting the layout, purging, and importing the new title block from a template.

 

The old layout's viewport and the new template's viewport are ever so slightly a different size and shape, so I can't just copy the viewport object. I thought I had it with the 'Center property, but that seems to be a geometric center in paper space and not a model space view center.

 

The only thought I had was to create a rectangle polyline that matches the outline of the old viewport, adding it to a selection set, and sending it to model space. I'd also save the 'CustomScale of the old viewport. Then, after the purge and import from template, I could just zoom to the rectangle polyline and apply the 'CustomScale zoom factor.

 

Or, similarly, create a point object at 'Center instead of a rectangle matching the boarder.

 

But both seem crazy convoluted, and I'm hoping autoLISP has a different solution.

As always, thanks for any input!

0 Likes
Accepted solutions (2)
452 Views
4 Replies
Replies (4)
Message 2 of 5

pendean
Community Legend
Community Legend
NAMED VIEWS in modelspace not working the way you want?
0 Likes
Message 3 of 5

Dallas_B
Participant
Participant

No unfortunately. The different sized viewports between the two title blocks kind of makes that a pain too. As far as I understand named views, maybe I need to look into it a bit more.

0 Likes
Message 4 of 5

paullimapa
Mentor
Mentor
Accepted solution

You should be able to use the viewctr system variable to get the exact model space view center point from the old vport and apply that as the same position in the new vport. Then apply the same custom scale of the old onto the new


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor
Accepted solution

There is a couple more variables To use custom scale, twistangle. Use dump it.lsp to look at the properties of a viewport.

0 Likes