Hi @dale ,
i am trying to enable ShowCurves
in the DisplayPipelineAttributes
of the current displaymode (Rendered) using below code:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DisplayModeShowCurves(new_state=True):
dmd = scriptcontext.doc.Views.ActiveView.ActiveViewport.DisplayMode
dmd.DisplayAttributes.ShowCurves = new_state
Rhino.Display.DisplayModeDescription.UpdateDisplayMode(dmd)
scriptcontext.doc.Views.Redraw()
DisplayModeShowCurves(True)
I can see the checkbox in the display tab gets checked, however curves are not shown. If i switch the active view to a different display mode and then back to rendered, curves are displayed. It seems to fail in Rhino 6 and 7. Is there anything wrong with my code ?
thanks,
c.
dale
(Dale Fugier)
May 6, 2022, 9:51pm
2
A little clunky, but this should work:
import Rhino
import scriptcontext as sc
def GetShowCurves():
dm = sc.doc.Views.ActiveView.ActiveViewport.DisplayMode
return dm.DisplayAttributes.ShowCurves
def SetShowCurves(show):
view = sc.doc.Views.ActiveView
active_dm = view.ActiveViewport.DisplayMode
id = Rhino.Display.DisplayModeDescription.WireframeId
wireframe_dm = Rhino.Display.DisplayModeDescription.GetDisplayMode(id)
view.ActiveViewport.DisplayMode = wireframe_dm
view.Redraw()
Rhino.RhinoApp.Wait()
active_dm.DisplayAttributes.ShowCurves = show
Rhino.Display.DisplayModeDescription.UpdateDisplayMode(active_dm)
view.ActiveViewport.DisplayMode = active_dm
view.Redraw()
SetShowCurves(not GetShowCurves())
– Dale
Hi @dale ,
thanks for the example. I just found that adding a temporary point before the redraw seems to eventually trigger a redraw.
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DisplayModeShowCurves(new_state=True):
dmd = scriptcontext.doc.Views.ActiveView.ActiveViewport.DisplayMode
dmd.DisplayAttributes.ShowCurves = new_state
Rhino.Display.DisplayModeDescription.UpdateDisplayMode(dmd)
# hack
pt_id = scriptcontext.doc.Objects.AddPoint(Rhino.Geometry.Point3d.Origin)
scriptcontext.doc.Objects.Delete(pt_id, True)
scriptcontext.doc.Views.Redraw()
DisplayModeShowCurves(True)
There seems to be something wrong with ShowCurves
, its happening in every displaymode. Once a user creates some geometry, either by hand or scripted, it updates.
_
c.
brian
(Brian Gillespie)
February 12, 2025, 10:44pm
4