Help managing Detail views via Physcript

Hi all, @stevebaer
Could one of you help me in making this part of my code more elegant?

Looks like the ViewDisplayMode doesn’t works with detail views.
Looks, also, like the Zoom Selected doesnt’ work with detail views.

def CambiaModo(self):
    rs.UnselectAllObjects()
    rs.SelectObject(self.DetId)
    rs.Command ("_detail _enable", False)
    rs.Command("_SetDisplayMode _Mode="+ self.DetStyle, False)
    rs.Command ("!_detail _enablepage", False)
    rs.UnselectAllObjects()
def CambiaZoom(self,arrObjects):
    rs.UnselectAllObjects()
    rs.SelectObject(self.DetId)
    rs.Command ("_detail _enable", False)
    rs.SelectObjects(arrObjects)
    rs.Command ("_zoom _selected ")
    rs.UnselectAllObjects()
    rs.Command ("!_detail _enablepage", False)
    rs.DetailScale(self.DetId,1,self.DetScale)

Thanks!

Anyone?

This seems to work:

import rhinoscriptsyntax as rs
strDetail = rs.GetObject("Select detail", 32768, True, True)
if strDetail:
    rs.Command("_Detail _Enable", False)
    rs.UnselectAllObjects()
    rs.Command("_SetDisplayMode _Mode=_Shaded", False)
    rs.Command("!_Detail _EnablePage", False)

So does this:

import rhinoscriptsyntax as rs
strDetail = rs.GetObject("Select detail", 32768, True, True)
if strDetail:
    rs.Command ("_Detail _Enable", False)
    rs.Command("_SelAll", False)
    rs.Command("_Zoom _Selected ")
    rs.UnselectAllObjects()
    rs.Command("!_Detail _EnablePage", False)

Thanks Dale, yes it works :wink:
The question is about detail view methods for phyton .

Would be possible to do the same without using the rs.Command?

Best.

Why? Is there something that isn’t working?

If you look in the Rhino.Python help file in the “View” category, you should see a number of layout and detail-related functions. And, rhinoscryptsyntax has functions for selecting objects, zooming, etc., as does RhinoCommon.

Thanks Dale,
probably I had to be more direct to the point.
I need to zoom the detailed view according to a specific selected object and I can’t get it working without the rs.command.

I tried but it looks like the zoom.selected method doesn’t work for detail views (or I’m not able to pass to it the right id).

Could I ask you to write to me a short example on how to zoom to a selected obj in a detailed view trough Py?

Thanks Thanks Thanks.