Method to hide objects in Model views, while still visible in layouts?

Hi there!

I have a rhino model with a lot of TextDots. I want these textdots to be visible in a single layout “Detail View”, but not in the model viewport.

some context: The purpose is to create multiple layouts, each of which shows a different set of textdots as an infographic. If each set of TextDots is visible in model space, the view gets clogged and very difficult to select or navigate the correct objects.

Does anyone have a suggestion?

Thanks!
Tim

I don’t think that’s possible.
Layers and objects can have their display blocked in Layout Details (HideInDetail), but I think the layer has to be On in the model.

Maybe one of the Bigger Brains has an idea.

It’s doable through ObjectAttributes.ViewportId I think.

Ah. This is a Scripting question.
It’s in the wrong category.
I’ll move it.

Hi @gankeyu,

That was exactly what I was looking for, thanks!

import rhinoscriptsyntax as rs
import scriptcontext as sc


def main():
    # prompt select obj and detail view     
    obj_guid = rs.GetObject("select obj", preselect=True)
    detail_guid = rs.GetObject("Select detail view", filter=32768, preselect=True)
    
    if not detail_guid or not obj_guid:
        print 'abort'
        return
    
    # update object attributes with new properties
    rh_obj = rs.coercerhinoobject(obj_guid)
    new_attr = rh_obj.Attributes.Duplicate()
    
    detail = rs.coercerhinoobject(detail_guid)
    new_attr.ViewportId = detail.Id
    sc.doc.Objects.ModifyAttributes(rh_obj.Id, new_attr, False)
    
    print "Rhino obj '%s' is now only visible from detail '%s'" % (obj_guid, detail.Id)

main()

Hi everyone!

This has become helpful for a very specific job for me so thank you for the script, however, do we know of there is a way for the hidden object to be made visible again in the future?
If I do SelAll it registers it as an object that exists, however if I do Show it says nothing is hidden

Hi @Hebe,

Object attribute “ViewportId” does not influence visibility settings, but specifies in which single viewport or layout detail the object is visible.

according to the documentation, you should be able to undo the change by setting “ViewportId” to None

For most purposes, rhino command ‘hideInDetail/showInDetail’ or layout layer visibility works fine and any changes are easy to revert in the UI.

Best regards,
Tim

Hi @timcastelijn

Thank you so much for your help~

A post was split to a new topic: Call an existing detail view