Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:sdksamples:addcone [2015/09/14] (current)
Line 1: Line 1:
 +====== Add a Cone Surface to Rhino ======
 +> **Developer:​** //​[[developer:​cplusplusplugins|C++]]//​
 +> **Summary:​** //​Demonstrates how to create a cone using **ON_BrepCone** and add it to Rhino.//
 +
 +===== C++ =====
 +<code c++>
 +CRhinoCommand::​result CCommandTest::​RunCommand( const CRhinoCommandContext&​ context )
 +{
 +  ON_Plane plane = ON_xy_plane;​
 +  double height = 10.0;
 +  double radius = 5.0;
 +  BOOL bCapBottom = FALSE;
 +  ​
 +  ON_Cone cone( plane, height, radius );
 +  if( cone.IsValid() )
 +  {
 +    ON_Brep* cone_brep = ON_BrepCone( cone, bCapBottom );
 +    if( cone_brep )
 +    {
 +      CRhinoBrepObject* cone_object = new CRhinoBrepObject();​
 +      cone_object->​SetBrep( cone_brep );
 +      context.m_doc.AddObject( cone_object );
 +      context.m_doc.Redraw();​
 +    }
 +  }
 +
 +  return CRhinoCommand::​success;​
 +}
 +</​code>​
 +
 +\\
 +
 +{{tag>​Developer cplusplus}}
 +
  
developer/sdksamples/addcone.txt ยท Last modified: 2015/09/14 (external edit)