VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Possible? Select a specific PS Viewport...

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
257 Views, 9 Replies

Possible? Select a specific PS Viewport...

I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: Anonymous

I think you want to be saving a vport not a view. Now
restoring this vport in a paperspace layout and retrieve
with this idea.

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

gl
Paul
"Dan" wrote in message
news:4883288@discussion.autodesk.com...
I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
Message 3 of 10
Anonymous
in reply to: Anonymous

for the view...

Dim view As AcadView
For Each view In ThisDrawing.Views
Debug.Print view.Name
Next view

"Paul Richardson" wrote in message
news:4883412@discussion.autodesk.com...
I think you want to be saving a vport not a view. Now
restoring this vport in a paperspace layout and retrieve
with this idea.

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

gl
Paul
"Dan" wrote in message
news:4883288@discussion.autodesk.com...
I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
Message 4 of 10
Anonymous
in reply to: Anonymous

Thank you for the input.

If I run the following code, "*Active" is returned. I need some way to make
sure a specific Viewport is active, and then set a named view.
Or even simpler, how would one cycle through each viewport?

Any help is greatly appreciated.

Dan

If I have 5 viewports in paperspace, how would I make changes to the bottom
right viewport for example.
"Paul Richardson" wrote in message
news:4883412@discussion.autodesk.com...
I think you want to be saving a vport not a view. Now
restoring this vport in a paperspace layout and retrieve
with this idea.

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

gl
Paul
"Dan" wrote in message
news:4883288@discussion.autodesk.com...
I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
Message 5 of 10
Anonymous
in reply to: Anonymous

>Or even simpler, how would one cycle through each viewport?
Is what I posted not what you want?

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

"Dan" wrote in message
news:4884916@discussion.autodesk.com...
Thank you for the input.

If I run the following code, "*Active" is returned. I need some way to make
sure a specific Viewport is active, and then set a named view.
Or even simpler, how would one cycle through each viewport?

Any help is greatly appreciated.

Dan

If I have 5 viewports in paperspace, how would I make changes to the bottom
right viewport for example.
"Paul Richardson" wrote in message
news:4883412@discussion.autodesk.com...
I think you want to be saving a vport not a view. Now
restoring this vport in a paperspace layout and retrieve
with this idea.

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

gl
Paul
"Dan" wrote in message
news:4883288@discussion.autodesk.com...
I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
Message 6 of 10
Anonymous
in reply to: Anonymous

Thanks for the input.
Not sure if I am being clear or not.

If I have 5 viewports in paperspace, the code below just provide the name
"*Active".

This does not help me select the 5th viewort in the bottom righ-hand corner.

I am not sure how to go about it.

Thanks,
Dan
"Paul Richardson" wrote in message
news:4884930@discussion.autodesk.com...
>Or even simpler, how would one cycle through each viewport?
Is what I posted not what you want?

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

"Dan" wrote in message
news:4884916@discussion.autodesk.com...
Thank you for the input.

If I run the following code, "*Active" is returned. I need some way to make
sure a specific Viewport is active, and then set a named view.
Or even simpler, how would one cycle through each viewport?

Any help is greatly appreciated.

Dan

If I have 5 viewports in paperspace, how would I make changes to the bottom
right viewport for example.
"Paul Richardson" wrote in message
news:4883412@discussion.autodesk.com...
I think you want to be saving a vport not a view. Now
restoring this vport in a paperspace layout and retrieve
with this idea.

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

gl
Paul
"Dan" wrote in message
news:4883288@discussion.autodesk.com...
I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
Message 7 of 10
Anonymous
in reply to: Anonymous

Dan, If you want paperspace viewports
use.

Dim pvport As AcadPViewport
For Each pvport In ThisDrawing.PaperSpace
Debug.Print pvport.ObjectName
Next pvport

Don't see a name property thougt. Don't know
if you can transfer the name of a saved view when
restoring as a paperspace viewport.

Paul
"Dan" wrote in message
news:4886298@discussion.autodesk.com...
Thanks for the input.
Not sure if I am being clear or not.

If I have 5 viewports in paperspace, the code below just provide the name
"*Active".

This does not help me select the 5th viewort in the bottom righ-hand corner.

I am not sure how to go about it.

Thanks,
Dan
"Paul Richardson" wrote in message
news:4884930@discussion.autodesk.com...
>Or even simpler, how would one cycle through each viewport?
Is what I posted not what you want?

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

"Dan" wrote in message
news:4884916@discussion.autodesk.com...
Thank you for the input.

If I run the following code, "*Active" is returned. I need some way to make
sure a specific Viewport is active, and then set a named view.
Or even simpler, how would one cycle through each viewport?

Any help is greatly appreciated.

Dan

If I have 5 viewports in paperspace, how would I make changes to the bottom
right viewport for example.
"Paul Richardson" wrote in message
news:4883412@discussion.autodesk.com...
I think you want to be saving a vport not a view. Now
restoring this vport in a paperspace layout and retrieve
with this idea.

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

gl
Paul
"Dan" wrote in message
news:4883288@discussion.autodesk.com...
I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
Message 8 of 10
Anonymous
in reply to: Anonymous

still no go....
"Paul Richardson" wrote in message
news:4886388@discussion.autodesk.com...
Dan, If you want paperspace viewports
use.

Dim pvport As AcadPViewport
For Each pvport In ThisDrawing.PaperSpace
Debug.Print pvport.ObjectName
Next pvport

Don't see a name property thougt. Don't know
if you can transfer the name of a saved view when
restoring as a paperspace viewport.

Paul
"Dan" wrote in message
news:4886298@discussion.autodesk.com...
Thanks for the input.
Not sure if I am being clear or not.

If I have 5 viewports in paperspace, the code below just provide the name
"*Active".

This does not help me select the 5th viewort in the bottom righ-hand corner.

I am not sure how to go about it.

Thanks,
Dan
"Paul Richardson" wrote in message
news:4884930@discussion.autodesk.com...
>Or even simpler, how would one cycle through each viewport?
Is what I posted not what you want?

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

"Dan" wrote in message
news:4884916@discussion.autodesk.com...
Thank you for the input.

If I run the following code, "*Active" is returned. I need some way to make
sure a specific Viewport is active, and then set a named view.
Or even simpler, how would one cycle through each viewport?

Any help is greatly appreciated.

Dan

If I have 5 viewports in paperspace, how would I make changes to the bottom
right viewport for example.
"Paul Richardson" wrote in message
news:4883412@discussion.autodesk.com...
I think you want to be saving a vport not a view. Now
restoring this vport in a paperspace layout and retrieve
with this idea.

Dim vport As AcadViewport
For Each vport In ThisDrawing.Viewports
Debug.Print vport.Name
Next vport

gl
Paul
"Dan" wrote in message
news:4883288@discussion.autodesk.com...
I have written code to create a named view, then set that named view. I do
not see a method to select a specific viewport in PS.

If I have 5 viewports, how do I choose between them using VBA code?

Thanks for the insight,
Dan
Message 9 of 10
Anonymous
in reply to: Anonymous

This does not help me select the 5th viewort in the bottom righ-hand corner.

I am not sure how to go about it.

Thanks,
Dan

you're getting closer to answering your own question

The whole problem is how to *You* determine which viewport you want?
First off, which tab is it on?
Next, which viewport on that tab?
Now you say you want the one in the bottom right-hand corner.
assuming you know the coordinates of that viewport you can select it via a
selection set window as an example of one way to locate that particular
viewport

another way would be to iterate the viewports on that tab and check the
coordinates of each one in turn looking for a match to some pre-determined
criteria

another way would be to attach xdata to your viewports to tag them in some
way meaningful to yourself or your program.

etc

hth
Mark
Message 10 of 10
Anonymous
in reply to: Anonymous

Thanks for the leads Mark.

I have never attached xdata yet, so I will do some research.

Dan

As far as cycling through the viewports with tab,
"MP" wrote in message
news:4886416@discussion.autodesk.com...
This does not help me select the 5th viewort in the bottom righ-hand corner.

I am not sure how to go about it.

Thanks,
Dan

you're getting closer to answering your own question

The whole problem is how to *You* determine which viewport you want?
First off, which tab is it on?
Next, which viewport on that tab?
Now you say you want the one in the bottom right-hand corner.
assuming you know the coordinates of that viewport you can select it via a
selection set window as an example of one way to locate that particular
viewport

another way would be to iterate the viewports on that tab and check the
coordinates of each one in turn looking for a match to some pre-determined
criteria

another way would be to attach xdata to your viewports to tag them in some
way meaningful to yourself or your program.

etc

hth
Mark

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost