Usage Notes
- Only BIMFACE platform Web applications are supported, using JSSDK v3.
- Strictly refer to
references/the code writing style of the corresponding documents in the directory, and do not change the interface calling method on your own. - Only implement the functions explicitly requested by the user.
Interface Calling Guide
Identify synchronous/asynchronous methods: The distinction between synchronous and asynchronous in BIMFACE JSSDK v3 is very simple — if the method parameters include a
callback/callback function, it is asynchronous (such asgetComponentProperty); if there is no callback, it is synchronous (such asgetBoundingBoxById). Each reference document has complete examples; just refer to the examples when calling.
1. Page Initialization
- BIMFACE initialization: refer toBIMFACE initialization
1.1 Requirement Analysis (mandatory before coding)
After receiving the user's requirements, complete the following steps before starting to code:
- Capability mapping: Match the keywords of the user's requirements against
§2 功能模块to find the matching reference document. - Scope confirmation: If the requirements involve more than 3 modules, list the modules planned to be called and have the user confirm the priority.
- Unsupported notification: If the requirements cannot match any existing reference, immediately inform the user that "the current SDK capability scope does not support it" to avoid silently generating incorrect code.
- Multi-model determination: If the requirements involve multiple models/integrated models, confirm whether
getModel(modelId)is needed to specify the target model.
2. Functional Modules
2.1 Scene Interaction Related
- Common listening events: refer toListening Events
- Path roaming: refer toPath Roaming
- Auto-rotation: refer toAuto-rotation
- Camera state: refer toCamera State, including view switching, camera interaction behavior, and damping effects.
- Navigation map: refer toNavigation Map
- Custom toolbar: refer toCustom Toolbar
2.2 Component Operation Related
- Component visibility: refer toComponent Visibility
- Component coloring: refer toComponent Coloring
- Wireframe color: refer toWireframe Color
- Freeze components: refer toFreeze Components
- Isolate components: refer toIsolate Components
- Component emphasis: refer toComponent Emphasis
- Model attributes: refer toModel Attributes
- External components: refer toExternal Components
- Rooms: refer toRooms
- Model merging tool: refer toModel Merging Tool, which is a tool that allows users to adjust the relative positions of multiple models on the page.
- Model editor: refer toModel Editor
- Model state: refer toModel State
- Grid: refer toGrid
2.3 Effect Presentation Related
- Scan effect: ReferenceScan effect
- Curve effect: ReferenceCurve effect
- Electronic fence effect: ReferenceElectronic fence effect
- Planar scan effect: ReferencePlanar scan effect
- 3D anchor point effect: Reference3D anchor point effect
- 3D plane: Reference3D plane
- Floor explosion: ReferenceFloor explosion
- Flame effect: ReferenceFlame effect
- Water surface effect: ReferenceWater surface effect, including water surface, material flow, and water spray effect
- Weather effect: ReferenceWeather effect
- Section box: ReferenceSection box
- Section plane: ReferenceSection plane
- Growth animation: ReferenceGrowth animation
- Skybox and background color: ReferenceSkybox and background color
- Lighting effect: ReferenceLighting effect, including spotlight, directional light, and ambient lighting (IBL)
- Glow effect: ReferenceGlow effect, including overall glow, outline glow, and bloom effect (BloomEffect)
- Display effect configuration: ReferenceDisplay effect configuration, including render mode, wireframe, SSAO, contact shadow, and lens flare
- Flying line effect: ReferenceFlying line effect
- Material texture: ReferenceMaterial texture, including component texture and Canvas dynamic material
- Heatmap: ReferenceHeatmap
- Embed drawing in model: ReferenceEmbed drawing in model
- Video effect: ReferenceVideo effect, including planar mode and projection mode
- Realistic minimap: ReferenceRealistic minimap
2.4 Spatial Analysis
- Spatial analysis: ReferenceSpatial analysis, including viewshed analysis, height control analysis, perspective analysis, skyline analysis, and ray detection
2.5 Annotation Related
- Leader line label: ReferenceLeader line label
- Image label: ReferenceImage label
- Cluster label: ReferenceCluster label
- Model annotation: ReferenceModel annotation
- Model measurement: ReferenceModel measurement
- Custom label: ReferenceCustom label
- 3D label: Reference3D label
- Dimension annotation: ReferenceDimension annotation, used to display preset model dimensions or programmatically create persistent linear dimension annotations
2.6 Other
- Component filtering: ReferenceComponent filtering, when the interface description involves filtering based on the component's objectData information, parameters need to be passed according to the filtering condition format
- Bounding Box (BoundingBox): ReferenceBounding Box, describing how to obtain or construct a bounding box yourself
3. Global Variable Naming Conventions
All reference documents uniformly use the following variable names, without declaring them individually:
| Variable Name | Type/Description | How to Obtain |
|---|---|---|
viewer3D |
3D viewer object | app3D.getViewer() |
app3D |
WebApplication application object | new Glodon.Bimface.Application.WebApplication3D(config) |
model3D |
3D model object | viewer3D.getModel()(single model) or viewer3D.getModel(modelId)(multiple models) |
camera3D |
3D camera object | viewer3D.getCamera() |
drawableContainer |
Label container object | new Glodon.Bimface.Plugins.Drawable.DrawableContainer(config) |
Key Constraints:
model3Dmust be obtained only after theViewAddedevent is triggered; in multi-model scenarios,viewer3D.getModel(modelId)must be used to specify the target model.
4. Code Self-Check
After development is complete, check item by item:
- Feature Traceability: Compare the generated code with the original requirements one by one, confirming that every feature point in the requirements has a corresponding implementation, and that there is no "A was needed but B was generated" or extra generation of unrequested features
- Whether variable names are consistent with the naming conventions (
viewer3D/model3D/app3D/camera3D/drawableContainer) - Whether each API call can find an identical method signature in the corresponding reference (do not fabricate method names or parameter names yourself); if a feature cannot find a clear API in the corresponding reference document, please inform the user that "the current SDK capability scope does not support it", and do not fabricate method names or parameters yourself
- Whether the results of asynchronous operations (
getComponentProperty、getFloors、getBoundingBox、loadObject, etc.) are handled in callback functions - Whether
viewer3D.render() - Whether event handler functions are named functions (ensuring they can be unregistered)
- Whether the filter condition format is consistent with Component Filtering consistent
- Whether color construction uses
new Glodon.Web.Graphics.Color()rather than bare color strings or arrays - Whether
viewer3D.updateSceneBoundingBox()is called after adding external components (to avoid components being invisible outside the camera range) - Whether there are "wild variables" in the code that are not declared in
§3 全局变量命名约定the "wildcard variables" declared in
4.1 Common Errors Quick Reference
| ❌ Incorrect | ✅ Correct |
|---|---|
model.setColor(...) |
Method names differ across modules: component coloring uses overrideComponentsColorById, rooms use setRoomColor, wireframes use setWireframeColor |
Filter condition {category: "Wall"} |
The correct field names are categoryId(numeric string) and family、levelName, format see Component Filtering |
viewer.getModel().setColor(...) |
should use model3D.overrideComponentsColorById(ids, color) |
| Bounding box is not updated after external components move | First call viewer3D.updateSceneBoundingBox() then render() |
markerContainer.onClick(fn) |
marker.onClick(fn) onClick is a method of a single Marker3D object, not a method of the container |