Hi
What’s the easiest way to select all objects that are on a specific layout space.
In my case there is a rhino file with 10 different layouts.
I’m trying to alter a text element that lies on a specific page.
How would i do that with rhino common
Thanks
Martin
Hi Martin,
below is an example with file. It selects the Text with content “Text to edit” on Page 2 in the example file. it also shows how to detect Detail views on a specific page. Do detect a specific Detail view, it is good to name it.
import Rhino, scriptcontext
def DoSomething():
pv = scriptcontext.doc.Views.GetPageViews()
if pv.Count == 0: return None
d = dict()
for page in pv: d[page.ActiveViewportID] = page.PageName
for obj in scriptcontext.doc.Objects:
if obj.Attributes.Space == Rhino.DocObjects.ActiveSpace.PageSpace:
page_name = d[obj.Attributes.ViewportId]
if isinstance(obj.Geometry, Rhino.Geometry.DetailView):
print "DetailView:", obj.Name
print "PageName:", page_name
else:
print "ObjectType:", obj.Geometry.ObjectType
print "PageName:", page_name
t = Rhino.DocObjects.ObjectType.Annotation
if obj.Geometry.ObjectType == t:
if page_name == "Page 2":
if obj.Geometry.Text == "Text to edit":
obj.Select(True)
print ""
DoSomething()
TestFile.3dm (134.8 KB)
c.
1 Like