Creates a new CAD scene instance.
Initializes the Three.js scene and layout management structures.
Get active layout
The block table record id associated with the current active layout
The bounding box of the visibile objects in this secene
The HTML transient elements manager for this scene
The scene object of THREE.js. This is internally used only. Try to avoid using it.
The layers in this scene
The layouts in this scene
The block table record id of the model space
Get the layout of the model space
The statistics of this scene
Add one empty layout with the specified block table record id as the its key.
This method is idempotent: when a layout already exists for the given
ownerId, the existing instance is returned untouched and no new THREE
group is attached to the scene. Re-creating eagerly would leak the
previous AcTrLayout.internalObject as an orphan child of _scene
(still rendered every frame and still indexed by ray/spatial queries),
which manifested as "ghost" entities from previously-visited layouts
accumulating on layout switches.
Input the block table record id associated with this layout
Return the layout associated with ownerId — newly created when
absent, or the pre-existing instance when already registered.
Add one persistent entity (stored in the drawing database) into this scene. If the layout associated with this entity doesn't exist, then create one layout, add this layout into this scene, and add the entity into the layout.
Input AutoCAD entity to be added into scene.
Input the flag whether to extend the bounding box of this scene by union the bounding box of the specified entity.
Return this scene
Add the specified transient entity into this scene
Input one transient entity
Returns the current scene visibility for one entity.
Returns true when the entity is present in any layout.
Hover the specified entities. Propagates the request to every
layout in the scene, not just the active one — entities picked
through a paper-space viewport (drill-through) live in the model
layout while the active layout at pick time is paper, so the
hover/select state must reach both. Layouts that don't own the
given entity ids no-op gracefully (getLayersByObjectId returns
an empty array there).
Remove the specified persistent entity (stored in the drawing database) from this scene.
Input the object id of the entity to remove
Return true if remove the specified entity successfully. Otherwise, return false.
Remove the specified transient entity from this scene
Input the object id of the transient entity to remove
Search entities intersected or contained in the specified bounding box.
Input the query bounding box
Return query results
Select the specified entities across all layouts.
This is what makes drill-through selection visually consistent: a
click inside a paper-space viewport resolves to a model entity, but
the active layout at that moment is paper. Without propagating to
the model layout, the selection would be silently lost — the entity
goes into selectionSet but no highlight ever renders. The bug
manifested as "I click on a line in the viewport and nothing
visibly selects" (debug logs confirmed firstPicked was the
correct entity, but the highlight never appeared).
Cross-layout propagation also restores symmetry of
select/unselect: a model entity highlighted via paper drill
must un-highlight when the user replaces the selection from any
layout, not just the one where it was originally picked.
Updates entity visibility without rebuilding batched geometry.
Unhover the specified entities across all layouts. See hover for rationale on propagation.
Unselect the specified entities across all layouts. See select for rationale.
Update the specified persistent entity (stored in the drawing database) in this scene.
Return true if update the specified entity successfully. Otherwise, return false.
Three.js scene manager for CAD drawings with hierarchical organization.
The scene manages the complete visual representation of a CAD drawing using a hierarchical structure that mirrors CAD data organization:
Key Responsibilities
The scene automatically manages the active layout and provides efficient access to entities for rendering, selection, and spatial operations.
Example