Plugin set an individual object to wireframe


(Gccdragoonkain) #1

Is it possible for a plugin to set a rhino object to be wireframe while other objects remain shaded?

I’m using C++ SDK


(Michael Pryor) #2

I don’t know C++ but can you access SetObjectDisplayMode Rhino command.


(Steve Baer) #3

SetObjectDisplayMode is what users use for this feature in Rhino.

In C++ you would get a CRhinoObject and a CRhinoViewport. For the CRhinoObject you would add aan ON_DisplayMaterialRef to the object’s attributes with a given viewport Id and the id given by
CRhinoDisplayAttrsMrg::WireFrameModeId();

CRhinoObject* pObject = ... CRhinoObject you got from somewhere...
CRhinoView* pView = RhinoApp().AcitveView();
if( pView )
{
  ON_DisplayMaterialRef dmr;
  dmr.m_viewport_id = pView->Viewport().ViewportId();
  dmr.m_display_material_id = CRhinoDisplayAttrsMgr::WireFrameModeId();
  CRhinoObjectAttributes oa = pObject->Attributes();
  oa.AddDisplayMaterialRef(dmr);
  pObject->ModifyAttributes(oa);
}

(Gccdragoonkain) #4

Thanks Steve! Also Michael.

Edit: unfortunately I can’t modify the object since CRhinoGetObject returns a const reference. I’m guessing I have to create a new one or something?

What I’m really after is the ability to convert an input mesh/polyline to a display mode of something like this:


(Steve Baer) #5

Just use ModifyObjectAttributes on the CRhinoDoc then.


(Gccdragoonkain) #6

Thanks! This forum has been infinitely more helpful than most dev forums I’ve posted to.