Skip to content
Discussion options

You must be logged in to vote

Based on your code snippet, you create and add a new SmartDeviceDecorator every 5 seconds, and never drop the previously-added ones.
Try something like:

setInterval(() => {
  const oldDecorator = IModelApp.viewManager.decorators.find((dec) => dec instanceof SmartDeviceDecorator);
  if (oldDecorator)
    IModelApp.viewManager.dropDecorator(oldDecorator);

  IModelApp.viewManager.addDecorator(new SmartDeviceDecorator(vp));
}, 5000);

Alternatively, if there's only ever one SmartDeviceDecorator, just store the most recent one in some variable instead of searching for it.

Note: add/dropDecorator take care of invalidating decorations - you should not have to do that yourself here.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Johannes-repos
Comment options

Answer selected by Johannes-repos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants