서페이스 아이소커브 밀도 조정
C++, .NET
Summary: 서페이스의 아이소커브 밀도를 조정하는 방법을 소개합니다.
질문
선택된 커브로 새로운 서페이스를 만들면 언제나 서페이스 표면에 하나의 아이소커브만이 걸쳐지게 됩니다. Rhino 의 속성 창에서 아이소커브 밀도를 조정해야 하는데, 플러그인에서 자동으로 설정이 가능하도록 지정할 수 있습니까?
답변
서페이스 개체의 아이소커브 밀도는 개체의 특성에 저장됩니다. C++ 플러그인의 경우, CRhinoObjectAttributes와 ON_3dmObjectAttributes 클래스가 해당되며, .NET 플러그인은 MRhinoObjectAttributes 와 On3dmObjectAttributes 클래스가 해당됩니다. m_wire_density property 를 설정하세요. 참고로, 이 속성을 0 (영) 으로 설정하면 개체의 아이소커브가 표시되지 않게 됩니다.
예:
C++
CRhinoCommand::result CCommandFooBar::RunCommand( const CRhinoCommandContext& context ) { CRhinoGetObject go; go.SetGeometryFilter( CRhinoGetObject::surface_object ); go.GetObjects( 1, 1 ); if( go.CommandResult() == CRhinoCommand::success ) { const CRhinoObjRef& objref = go.Object(0); const CRhinoBrepObject* brep_obj = CRhinoBrepObject::Cast( objref.Object() ); if( brep_obj ) { CRhinoObjectAttributes atts = brep_obj->Attributes(); atts.m_wire_density = 3; // for example context.m_doc.ModifyObjectAttributes( objref, atts ); context.m_doc.Redraw(); } } return go.CommandResult(); }
C#
public override IRhinoCommand.result RunCommand(IRhinoCommandContext context) { MRhinoGetObject go = new MRhinoGetObject(); go.SetGeometryFilter(IRhinoGetObject.GEOMETRY_TYPE_FILTER.surface_object); go.GetObjects(1, 1); if (go.CommandResult() == IRhinoCommand.result.success) { MRhinoObjRef objref = go.Object(0); IRhinoBrepObject brep_obj = MRhinoBrepObject.ConstCast(objref.Object()); if (brep_obj != null) { MRhinoObjectAttributes atts = new MRhinoObjectAttributes() = brep_obj.Attributes(); atts.m_wire_density = 3; // for example context.m_doc.ModifyObjectAttributes(objref, atts); context.m_doc.Redraw(); } } return go.CommandResult(); }