Grasshopper

algorithmic modeling for Rhino

Hi,

I'm looking for a method to set the active viewport display mode in c#. Is this possible?

For example, I can read the active viewport's display mode by using this (below), but I have not been able to track down a method for setting the display mode, from a found state such as wireframe to a desired state, such as ghosted.

String viewname = doc.Views.ActiveView.ActiveViewport.DisplayMode.EnglishName;

Many thanks.

Views: 1700

Replies to This Discussion

Hi Tree,

This is python, but I think you will figure it out how to rewrite it in C#:

import Rhino

# all available display modes
dm = Rhino.Display.DisplayModeDescription.GetDisplayModes()
for item in dm:
    print item.LocalName

# set display mode
rendered = Rhino.Display.DisplayModeDescription.FindByName("Rendered")
Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.DisplayMode = rendered

# get the display mode of your active viewport
activeViewPortDm = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.DisplayMode.LocalName
print "\n%s" % activeViewPortDm

djordie,

many thanks - this is very helpful!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service