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

Using VBA to restore a view in a AcadPViewport

3 REPLIES 3
Reply
Message 1 of 4
toddralph
607 Views, 3 Replies

Using VBA to restore a view in a AcadPViewport

I can't seem to figure out how to do this. I thought it would be something similiar to myViewPort.setView, but the paperspace viewport doesn't have that method.

Problem: I have a bunch of views defined in my drawing (all same size and shape) and I want to plot them all by restoring the view to the paperspace viewport, then plotting. Of course this has to be automated because I have 250+ views.

Any help would be appreciated.

Thanks,
Todd
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: toddralph

I asked the same question a couple of days ago but haven't had a reply so in the meantime I have used pviewportObj.Display True
' Switch to model space
ThisDrawing.MSpace = True
' Set newVport current
Set pviewportObj = ThisDrawing.ActivePViewport
' Set the required views name
ViewName = "VIEW" & counter
' add it to the current open viewport
Set view = ThisDrawing.Views.item(ViewName)
' set it as current
ThisDrawing.SendCommand "-view" & vbCr & "R" & vbCr & ViewName & vbCrwhere ViewName is the name of the view you wish to present in the AcadPViewport and can be set. Its not a direct Visual Basic method but it does the trick untill someone comes up with the goodies.
Regards
Scruff
Message 3 of 4
toddralph
in reply to: toddralph

Thanks Scruff, that did the trick for now.
Message 4 of 4
svreis
in reply to: toddralph

A solução funcionou bem... Só acho que se fosse utilizado o código VB (que não existe pois não sei de nínguem que saiba) seria mais rápido. Mas não tem problema esperar alguns segudos comparado as horas que seriam gastas para fazer isso manualmente.

Valeu.

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

Post to forums  

Autodesk Design & Make Report

”Boost