# Geometry: Create a Geometry Model with Geometric Primitives

A geometry model has a part data generator that can be used to tessellate various geometric primitives.

In this tutorial you will create your own geometry model parts and apply some part settings.

Create the following parts:

- A box
- A sphere
- A cylinder

    void TutorialRunnerMainWindow::createGeometryModelWithPrimitives()
    {
        //--------------------------------------------------------------------------
        // Create a geometry model using the PartDataGenerator to tessellate
        // a box, sphere and cylinder. Apply simple part settings.
        //--------------------------------------------------------------------------
        cee::vis::View* gcView = getTutorialView();
        cee::PtrRef<cee::geo::GeometryModel> geometryModel = new cee::geo::GeometryModel;
        gcView->setModelOpenGLCapabilitiesFromView(geometryModel.get());

        // Add a yellow box
        cee::PtrRef<cee::geo::Part> boxPart = new cee::geo::Part(cee::geo::DataGenerator::createBox(cee::Vec3d(1.0, 1.0, 1.0), cee::Vec3d(2.0, 2.0, 2.0)).get());
        geometryModel->addPart(boxPart.get());

        // Add a sphere with default color
        cee::PtrRef<cee::geo::Part> spherePart = new cee::geo::Part(cee::geo::DataGenerator::createSphere(cee::Vec3d(4.0, 2.0, 1.0), 1.0, 30).get());
        geometryModel->addPart(spherePart.get());

        // Add a red cylinder
        cee::PtrRef<cee::geo::Part> cylinderPart = new cee::geo::Part(cee::geo::DataGenerator::createCylinder(cee::Vec3d(6.0, 2.0, 1.0), 0.8, 0.0, cee::Vec3d(0,0,1), 3, 50).get());
        geometryModel->addPart(cylinderPart.get());

        // Settings
        boxPart->settings().addEffect(new cee::geo::EffectColor(cee::Color3f(1,1,0)));
        cylinderPart->settings().addEffect(new cee::geo::EffectColor(cee::Color3f(1,0,0)));

        // Add model to view. Ensure that old models are removed first
        gcView->removeAllModels();
        gcView->addModel(geometryModel.get());

        cee::BoundingBox bb = gcView->boundingBox();
        gcView->camera().fitView(bb, cee::Vec3d(0, 0, -1), cee::Vec3d(0, 1, 0));
        gcView->camera().inputHandler()->setRotationPoint(bb.center());

        gcView->requestRedraw();
    }

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...