.op file with a plan symbol and a 3D body. The blocks are licensed under CC BY 4.0. They need no Floorkit licence key of their own.
Before you start
You have a building model with a storeyground. See Start a building. The catalog is on GitHub at OpenGeometry-io/floorkit-catalog.
Find a block
jsDelivr serves the catalog from its release tags. Pin a tag in the address, not a branch:
The id of a block is
<publisher>.<slug>, for example floorkit.bathtub. A released block never changes. A fix is a new version in a new file.
Load a block
Copytools/loader.mjs into your app. It has no dependencies. It runs in a browser and in Node.js 22.
bathtub.entryis the entry of the block inindex.json.bathtub.textis the.optext.loadchecks the size, the SHA-256, the id and the version of the file againstindex.json. It refuses a redirect, a path outside the catalog and a revoked block. Each refusal is aCatalogErrorwith acode.catalog.list()gives the entries of all blocks.
index.json itself is not signed yet. Without the loader, nothing checks the text that you fetch.
Give the block source
Floorkit does not download blocks. Give the text inassetSources when you open the session. The key is the uri of the block: its path below blocks/. Thus blocks/floorkit/bathtub/1.0.0.op has the uri floorkit/bathtub/1.0.0.op.
Add the block as an asset
add-asset adds the definition one time. Then place copies with add-element. See Place furniture.
ProjectManager saves the .op text of each block in the project file. A saved project opens again without the catalog.
Make one element
For one element outside a building model, give the text toOpenElement. Set up the kernel first.
Credit the catalog
The blocks andindex.json are licensed under CC BY 4.0. Where you show or ship the blocks, credit the catalog with this text:
Rules
- Pin a release tag in the address. A branch can change, and a tag cannot.
- The uri of a block is its path below
blocks/. Keep this uri: the project file keys the saved text by it. - An external asset with no source stops the build with an
asset-source-missingerror that names the uri.
Next
Place furniture
Place, move, turn and mirror the blocks.
OpenElement API
See the block definition and its fields.