How to link floor-plan spaces to facility data.
Trace a space on a floor plan in Rasterex Canvas, then connect that boundary to the room, asset, inspection and operational records your application owns.
Rasterex technical guide
Canvas stores the spatial reference; your product owns facility information.
Rasterex provides the polygon boundary, annotation events and selection. Your host application owns the space list, metadata editor, asset links, inspections, access model and facility workflow.
Start after the floor plan is open. Use the embedded CAD viewer guide for the Viewer SDK lifecycle.
Use the annotation ID as the durable link to a host space record.
1. Trace the space
Enable the documented polygon action only after the floor plan is ready, then let a user trace the space boundary.
2. Save room metadata
After Canvas returns the annotation ID, collect room and operational metadata in host UI and save one linked record.
3. Synchronize selection
Selecting a host space selects its hatch; selecting a hatch opens the matching host space editor.
Trace, identify, connect.
These marker and event calls are documented by Rasterex. The room model and persistence remain host application responsibilities.
Activate a floor-plan space boundary
01// Run after mount(), ready() and documents.open().02const result = await viewer.tools.set({03 action: "SHAPE_POLYGON",04 enabled: true,05 style: facilityHatchStyle,06});07 08if (result?.success === false) {09 throw new Error(result.error ?? "Space boundary tool failed.");10}11 12// The user traces the room boundary in Canvas.Link Canvas boundaries and host facility records
01const stopCreated = viewer.annotations.on("created", (event) => {02 if (!event.guid) return;03 // Open host metadata UI, then save event.guid with the room/space record.04 setPendingAnnotationId(event.guid);05 setSpaceDialogOpen(true);06});07 08const stopSelected = viewer.annotations.on("selected", (event) => {09 // Find and open the host space record linked to event.guid.10 openMatchingSpace(event.guid);11});12 13// Selecting a room in the host UI selects its polygon hatch in Canvas.14viewer.annotations.select({ guid: space.annotationId });Verify spatial links before relying on facility data.
- The floor plan is open before Add space becomes available.
- Add space activates SHAPE_POLYGON and the metadata dialog opens only after Canvas returns an annotation ID.
- Saving creates one host space record linked to the polygon annotation ID.
- Selecting a saved space selects its Canvas hatch, and selecting a hatch opens the matching host record.
- Updating room metadata does not create a duplicate room record.
- Annotation listeners and the Viewer instance are cleaned up when the screen unmounts.
Facility space answers.
How do I link a floor-plan space to facility data?
Activate the documented SHAPE_POLYGON action, wait for the created annotation ID, then save that ID with the room or space record in the host application.
When should room metadata be shown?
Open the metadata dialog only after Canvas returns an annotation ID for a new polygon, or when an existing saved space is selected.
How does space selection stay synchronized?
Selecting a host space calls viewer.annotations.select with its annotation ID. A selected Canvas hatch can open the matching host space record.
Can metadata edits create duplicate spaces?
No. Update the existing host record linked to the annotation ID; the documented validation checklist specifically checks that metadata updates do not create duplicate room records.
Connect spaces to the operational records users need.
Define which facility records—assets, inspections, maintenance or issues—belong to each linked space, then validate those mappings with live floor plans.
