Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8542

Struggling with creating meshes from CRhinoBrepObject

$
0
0

@gccdragoonkain wrote:

Two questions.

One, when I run the code below for a simple cube polysurface, why do I get 6 meshes returned in the resultant meshes array???

Two, how do I set ON_MeshParameters to mirror the rhino “fewest polygons” slider settings when converting a polysurface to a mesh.

  else if(const auto brepObj = CRhinoBrepObject::Cast(rhObj))
  {
    auto brep = brepObj->Brep();

    ON_MeshParameters mp = ON_MeshParameters::DefaultMesh;
    ON_SimpleArray<ON_Mesh *> createdMeshes;
    ON_SimpleArray<const ON_Mesh *> meshes;

    mp.SetCustomSettings(true);
    mp.SetCustomSettingsEnabled(true);
    mp.SetFaceType(2);

    brep->CreateMesh(mp, createdMeshes);
    if(createdMeshes.SizeOfArray() >= 1)
    {
      meshes.Append(createdMeshes[0]);
    }

    result = runAlgorithm(meshes, false, context) ? CRhinoCommand::success : CRhinoCommand::failure;
    createdMeshes.Destroy();
  }

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8542

Trending Articles