SuperAPI AI Directory

bimface-helper-v3-2d

Frontend & websites

View repository

Updated 10-15 20:06

About this skill

BIMFACE Vector Drawing Web Application Development Skills

Usage Notes

  • Only BIMFACE platform web applications are supported, using JSSDK v3
  • Strictly follow references/ the code style of the corresponding documentation in the directory; do not change the API calling methods on your own
  • Only implement the functionality explicitly requested by the user

API Calling Guide

1. Page Initialization

1.1 Requirement Analysis (mandatory before coding)

After receiving the user's requirements, complete the following steps before starting to code:

  1. Capability mapping: match the keywords of the user's requirements against §2 功能模块 to find the matching reference documentation
  2. Scope confirmation: if the requirement involves more than 3 modules, list the modules planned to be called and let the user confirm the priority
  3. Unsupported notification: if the requirement cannot match any existing reference, immediately inform the user that "it is not supported within the current SDK capability scope" to avoid silently generating incorrect code
  4. Multi-drawing determination: if the requirement involves switching between or simultaneously loading multiple drawings, confirm whether it is necessary to use drawing2D.getDrawing(modelId) to specify the target drawing

2. Functional Modules

2.1 Drawing Interaction Related

2.2 Element Operation Related

2.3 Layer Related

2.4 Annotation Related

3. Global Variable Naming Conventions

All reference documents uniformly use the following variable names, which are no longer declared individually:

Variable name Type/Description How to obtain
viewer2D 2D drawing viewer object app2D.getViewer()
app2D WebApplicationDrawing application object new Glodon.Bimface.Application.WebApplicationDrawing(config)
drawing2D Drawing object viewer2D.getDrawing(modelId)(if modelId is not passed, the default drawing object is returned)
drawableContainer 2D label container object new Glodon.Bimface.Plugins.Drawable.DrawableContainer(config)

Key constraints:drawing2D must be obtained only after the drawing's Loaded event is triggered; before operating on layers/elements, obtain the target drawing object via viewer2D.getDrawing(modelId) .

4. Code Self-Check

After development is complete, check item by item:

  • Functionality traceability: Compare the generated code against the original requirements one by one, confirm that every feature point in the requirements has a corresponding implementation, and that there is no "A was required but B was generated" or extra generation of features that were not requested.
  • Do variable names conform to the naming convention (viewer2D / app2D / drawing2D / drawableContainer)
  • Can the exact same method signature be found in the corresponding reference for each API call (without inventing method names or parameter names yourself)? If a feature has no explicit API in the corresponding reference documentation, tell the user that "the current SDK capability scope does not support it" and do not invent method names or parameters yourself.
  • Are the results of asynchronous operations (getObjectDataById、getAllObjectIds、createSnapshotAsync , etc.) handled in callback functions?
  • After a state change, is viewer2D.render()
  • Is the event handler a named function (to ensure it can be unregistered)?
  • Before drawing operations, has the drawing finished loading been confirmed through the Loaded event?
  • Does color construction use new Glodon.Web.Graphics.Color() rather than a bare color string or array?
  • Are there any "wild variables" in the code that are not declared in §3 全局变量命名约定 ?

4.1 Common Errors Quick Reference

❌ Incorrect ✅ Correct
new WebApplication3DConfig() + WebApplication3D For vector drawings, use WebApplicationDrawingConfig + WebApplicationDrawing, see BIMFACE initialization
viewMetaData.viewType == "3DView" For vector drawings, determine viewMetaData.viewType == "dwgView", see BIMFACE initialization
In the ViewAdded event, operate on the element For 2D drawings, listen to the Loaded event rather than ViewAdded, see Listen to events
For 2D coordinates, pass in {x, y, z} The world coordinates of the drawing are {x, y} without a z value; passing in a z value will be ignored or cause an error
viewer2D.getObjectDataById(id, cb) Use drawing2D.getObjectDataById(id, cb), which is a method of the drawing object, not a method of the viewer