Rhino SDK: Color selected edge(s)

Hey guys,

How can I color specific chosen edges in Rhino? I´ve been trying to solve it with the CRhinoConduit Class, but it never actually worked.

This is the current Code I am working with:

    class CSampleHighlightCurveConduit : public CRhinoDisplayConduit
    {
    public:
      CSampleHighlightCurveConduit();
     
      bool ExecConduit(CRhinoDisplayPipeline& dp, UINT nChannel,bool& bTerminate);
    
    public:
      unsigned int m_runtime_object_serial_number;
    };
    
    CSampleHighlightCurveConduit::CSampleHighlightCurveConduit() 
    	: CRhinoDisplayConduit( CSupportChannels::SC_OBJECTDISPLAYATTRS )
    {
      // TODO: initialize members here
    }
     
    bool CSampleHighlightCurveConduit::ExecConduit( CRhinoDisplayPipeline& dp,UINT nChannel,bool& bTerminate)
    {
      switch( nChannel )
      {
      case CSupportChannels::SC_OBJECTDISPLAYATTRS:
    	  {
    		  if( m_pChannelAttrs->m_pObject->m_runtime_object_serial_number == m_runtime_object_serial_number ){
    			  m_pDisplayAttrs->m_ObjectColor = RGB(255,0,0);
    			  m_pDisplayAttrs->m_EdgeColor = RGB(255,0,0);
    		  }
        }
        break;
      }
    
      return true;
    }


And this is Main Method:


CRhinoCommand::result CCommandEdgePicker::RunCommand( const CRhinoCommandContext& context )
{
	CRhinoGetObject gv;
	gv.SetCommandPrompt(L"Select Edge");
	gv.SetGeometryFilter(CRhinoGetObject::meshedge_object);
	gv.GetObjects(1,1);
	if(gv.CommandResult() != CRhinoCommand::success){
		return gv.CommandResult();
	}

	const CRhinoObject* obj = gv.Object(0).Object();
	const ON_MeshEdgeRef* ref = gv.Object(0).MeshEdge();


	conduit->m_runtime_object_serial_number = obj->m_runtime_object_serial_number;
	conduit->SetGeometryFilter(CRhinoGetObject::meshedge_object);
	conduit->Enable();
	context.m_doc.Redraw();


	return CRhinoCommand::success;
}

This code does nothing. What do I do wrong?

Thanks in Advance.

For one thing, I don’t believe you are setting the appropriate attributes. See rhinoSdkDisplayPipelineAttributes.h and look for “Meshes specific attributes”.

Are you looking to to change the color of mesh wires for the selected mesh or just the selected edges?