# Particle Model

## Opening a Particle Model

The simplest way to open a particle dataset is to provide a file path. The component will select the appropriate reader based on the file extension (`.ptfx` or `.vtp`):

    #include "CeeParticleModel/ParticleModel.h"

    cee::pt::Error error;
    cee::PtrRef<cee::pt::ParticleModel> model = new cee::pt::ParticleModel;

    if (!model->open("C:/data/particles.ptfx", &error))
    {
        // Handle error - see Error Handling section below
    }

After a successful call to `open()`, the model is ready for frame iteration and visualization.

## Adding the Model to a View

Since `ParticleModel` extends `vis::Model`, you add it to a `View` just like any other model:

    cee::PtrRef<cee::vis::View> view = /* your view */;
    view->addModel(model.get());

    // The model renders as a point cloud; size & color are configurable
    model->setParticleSize(3.0f);
    model->updateVisualization();
    view->requestRedraw();

## Model Lifecycle

You can query whether a model is open with `isOpen()` and explicitly close it with `close()`:

    if (model->isOpen())
    {
        // Model has an active dataset
        size_t frames = model->frameCount();
    }

    // Explicitly release the dataset and free resources
    model->close();

Calling `close()` releases the reader, clears cached frames, and removes any renderables. The model can be reopened with a different file afterwards.

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...