CAD Blocks
Request lightweight CAD block lists, lazily load block details or attributes, and update block visibility using the SDK.
Use viewer.blocks to request lightweight CAD block lists, lazily load block details or attributes, listen for block snapshots, and update block visibility.
Block commands are available after the viewer is mounted, Canvas is ready, and a CAD document is open.
Use getBlocks() for lists, tables, and sidebar UI. It returns lightweight block rows.
getBlocks()sendsgetBlocksand waits forblocksSnapshot.
Use getBlockDetails(...) when a user selects block rows and you need geometry, insert data, bounds, or attributes.
- Request several blocks with
indexes: - The shorter alias
getDetails(...)is also supported:
Request Multiple Blocks Details
Use getBlockAttributes(...) when you only need attributes for selected blocks.
- Shorter alias
getAttributes(...)is also supported:
Attributes Shorter Alias
Use indexes or names returned by getBlocks() to toggle visibility.
setBlockVisibility(...)sendssetBlockVisibilityand returnsvoid.- Shorter alias
setVisibility(...)is also supported:
Visibility Shorter Alias
Use exactly one selector per visibility call:
index: One block by index.indexes: Multiple blocks by index.name: One block by name.names: Multiple blocks by name.all: Every block.
Subscribe to real-time CAD block snapshots and events:
Block list and block detail type declarations:
Method payload option structures:
All exported typings for CAD block integrations:
Validation constraints apply to block method requests:
getBlockDetails(...)andgetBlockAttributes(...)require exactly one selector:indexorindexes.indexmust be a non-negative integer.indexesmust be a non-empty array of non-negative integers.setBlockVisibility(...)requiresvisibleas a boolean and exactly one selector:index,indexes,name,names, orall.namemust not be empty.namesmust be a non-empty array of non-empty strings.
Complete implementation details for Vanilla HTML/JS environments:
Broker message mapping for CAD block APIs:
viewer.blocks.getBlocks(...)maps togetBlocks.viewer.blocks.getBlockDetails(...)maps togetBlockDetails.viewer.blocks.getDetails(...)maps togetBlockDetails.viewer.blocks.getBlockAttributes(...)maps togetBlockAttributes.viewer.blocks.getAttributes(...)maps togetBlockAttributes.viewer.blocks.setBlockVisibility(...)maps tosetBlockVisibility.viewer.blocks.setVisibility(...)maps tosetBlockVisibility.viewer.blocks.on("snapshot", ...)listens toblocksSnapshot.viewer.blocks.on("detailsSnapshot", ...)listens toblockDetailsSnapshot.viewer.blocks.on("attributesSnapshot", ...)listens toblockAttributesSnapshot.
Use the related pages below when you need the matching layer workflow or the full payload reference.
- Layers: Layers
- Technical Reference: API References
- CAD Overview: Overview
