I am trying to move text from Paper Space to Model Space for each layout I have in my .dwg, but when I try to return the viewports from my layout tabs, I get Empty List for each layout. Screenshot below.
Does anyone have any advice on how to get this to work?
I am bringing this topic back up. I think this might have something to do with a viewport being active maybe? I am now trying to place a north arrow in each layout and have the rotation of the north arrow read the twist angle of the layouts viewport, but I am getting an Empty List for each viewport/layout tab unless I double click into the viewport of each sheet. Any way I can avoid this?
Correct - it’s a little quirk of AutoCAD that a layout has to be activated for its viewport(s) to be initialized.
1 Like
Any ideas on how to make this happen automatically? It really disrupts the flow of my script if we have to manually go into each viewport and activate it.
It would have to be done via the API. You can access the LayoutManager
and then set the active layout. That could be put in a loop to do all of them.
I am revisiting this issue now and I am running into inconsistencies with the python script I put together to activate the viewports. Sometimes it does great! Other times, it won’t work at all. Sometimes (like the screenshot) it will work partly. Again the idea behind this process is to get the viewports activated so I can retrieve scaling and rotation factors of the viewport to place scale bars and north arrows on layouts.
VP Activation.dyn (11.2 KB)