You hide next week’s hollow-core slabs, paint this week’s columns blue, turn the camera to a nice isometric angle and call View.CreateSnapshot. The PNG shows the whole building in its normal colours. No exception, no false.
Nothing is wrong with the colours or the snapshot. The order is wrong.
Moving the camera redraws the view, and a redraw clears every temporary colour
The API reference says it once, in the remarks of ModelObjectVisualization: permanent representation is restored when the view is redrawn. What it doesn’t say is that ViewCamera.Modify() is a redraw. So every colour and every hidden part you set before the camera move is gone by the time the snapshot runs.
The fix is the order, per frame: pose the camera, then apply the colours, then take the picture.
using Tekla.Structures.Model.UI; // ViewCamera, ModelObjectVisualization, SnapshotSettings, Color
var camera = new ViewCamera { View = view };
camera.Select();
camera.Location = eye;
camera.DirectionVector = dir;
camera.UpVector = up; // must be perpendicular to dir
camera.Modify(); // redraws the view: temporary colours are gone
ModelObjectVisualization.SetTransparencyForAll(TemporaryTransparency.HIDDEN); // later steps stay hidden
ModelObjectVisualization.SetTemporaryState(erected, new Color(0.62, 0.64, 0.67)); // earlier steps, grey
ModelObjectVisualization.SetTemporaryState(current, new Color(0.23, 0.51, 0.96)); // this step, blue
var settings = new SnapshotSettings { WhiteBG = 1, UseSmoothLines = 1, LineWidth = 1 };
view.CreateSnapshot(path, settings, true); // last: after the colours, never before
For one screenshot you could move the camera once and colour after. An animation can’t. If the camera orbits a few degrees per step, every frame has a redraw in it, so every frame has to paint the model again. Re-issue the pose even when the camera doesn’t move, so the redraw happens where you expect it and not halfway through the next step.
Paint, pose, shoot gives you a grey building. Pose, paint, shoot gives you the sequence.
The colours apply to nothing when the Identifier only has a GUID
A sequence you saved to disk holds GUIDs, because an Identifier only lives for one Tekla session. The tempting way back is new Identifier(guid). It compiles, and its integer ID stays 0. The visualization calls match objects by that ID, so the step paints nothing. Ask the model instead:
var ids = new List<Identifier>();
foreach (string guid in stepGuids)
{
Identifier id = model.GetIdentifierByGUID(guid); // not new Identifier(guid): its ID stays 0
if (id != null && id.IsValid()) ids.Add(id);
}
Resolve the lists once, before the first frame. Applying a step costs time on a big model. Looking up every GUID again for every frame costs more.
CreateSnapshot returns before the PNG is on disk
View.CreateSnapshot(path, settings, overwrite) exists from Tekla 2024. The reference lists its three parameters and documents none of them. Two things it won’t tell you. Set Width or Height, not both: with both set, height wins and the width follows the view’s aspect. And the file can appear after the call has returned, so a GIF encoder that opens it straight away reads a file that isn’t there yet.
var settings = new SnapshotSettings { Width = 800, WhiteBG = 1 }; // Height 0: follows the view's aspect
if (!view.CreateSnapshot(path, settings, true))
throw new IOException("Snapshot failed. Is the view still open?");
for (int i = 0; i < 50 && !File.Exists(path); i++)
Thread.Sleep(100); // the PNG can land after the call returns
WhiteBG = 1 is worth keeping for anything you send to a client. Tinted parts read far better on white than on the model’s gradient background, and best of all in a GIF.
On Tekla 2021 to 2023 there is no snapshot method at all
Timelapse supports Tekla 2021, so it compiles against the 2021 package and looks for CreateSnapshot by reflection when it starts. When it isn’t there, it captures the view’s own window with the Win32 PrintWindow call instead. That path has limits you should say out loud: frames come out at the view’s on-screen size, with the user’s own background, and Tekla can sit behind other windows but can’t be minimised. The pose, paint, shoot order doesn’t change.
A crashed export must not leave the model empty
The first call of every frame hides the whole model. If the export throws on step 14, or the user presses Cancel, that’s the state Tekla stays in. Nothing is lost, but a detailer looking at an empty model doesn’t know that. Restore in a finally:
try
{
for (int step = 0; step < stepCount; step++)
{
// pose camera, re-apply colours, snapshot
}
}
finally
{
ModelObjectVisualization.ClearAllTemporaryStates(); // even on cancel or crash
}
Note that ClearAllTemporaryStates clears everything, including colours another tool set. For an export, that’s what you want.
See it run on your own model: Timelapse
Everything above is the frame loop of Timelapse, a free tool I built with an AI agent and my Tekla Open API skill. It groups parts into steps by phase, by bottom level or by a UDA, plays the sequence in the model and exports it as a GIF or MP4 for the client update. It runs on Tekla 2021 and newer, and it never writes to the model: temporary colours only, cleared when it closes.
The frame loop, in the order Tekla needs it
- Resolve GUIDs to identifiers once, through
model.GetIdentifierByGUID. - Pose the camera first, on every frame.
Modify()is a redraw. - Hide all, then paint earlier steps and the current step.
- Snapshot last, then wait for the file. Set one dimension, not two.
- Clear temporary states in a
finally.
The agent didn’t find this trap. It read it. “A view redraw also wipes temporary states” went into my skill on 10 June 2026, in a helper for checking geometry by screenshot. Timelapse’s first commit, three weeks later, already had the frame loop in the right order. That’s the method the course teaches: you build real tools with an AI agent, from a selection reporter to a plug-in shipped as a .tsep, and the skill tells the agent what Tekla won’t.
Tekla Open API Course: build real Tekla tools with an AI agent →
Related: Tekla Open API skill: why AI invents API that doesn’t exist · Tekla TSEP packaging: build a .tsep with BatchBuilder · AI agent for Tekla Open API: why a chatbot isn’t enough
