Control element color in setColorFilter

Hi!

I have a list of elements Ids and I’m looking for a way of coloring those elements, let’s say blue.

In older versions, this was done with applyFilter and assigning colorBy.

in the new version it suppose to be using PorpertyInfo and setColorFilter

if i go that way i get the elements colored randomly and i need to be able to control which color i use for all the elements.

what would be the best approach to do this ?

Hi @Ricardo_Zepeda! I think this is not yet possible via the new viewer api, but it should be easy to implement once we figure out the correct pattern. I’ve raised an issue:

To continue the conversation here, i’m pasting it below:

There are several usecases, with different treatments:

  1. allow for users to set the values of each filter group in the case of setStringColorFilter
  2. allow users to set custom colors to various id lists

(1) should be easy, though might need re-architecting the value groups data structure coming from the property manager to not directly depend on the string-to-color lib if user provided color exists

(2) for more flexibility, allow users to pass in a list of [{ids:[], color] to directly paint the viewer elements. this requires an extra pass in the filtering manager, ie customColorState.

Which one would you best be served by, 1 or 2?

Hi @dimitrie thanks for the reply ! I think option 2 will work better for my use case, since the ids I usually pass between components

Let me know when it could be ready for testing since it will be a cool functionality

Regards
Ricardo

No worries! (2) is actually easier to implement, so glad to hear :slight_smile: Would also be super curious to know what you’re building if you’ll have time to share.

Will ping as soon as we’ve got some progress on the issue!

thanks man!

Im building a platform to centralize IoT sensor information and data visualization for our innovation park here in Chile, which has different types of projects (prefabs, renewable energies, green buildings…).

i like the flexibility that speckle brings to add different streams of data for the buildings we have in the park, also the speckle viewer gives flexibility to animate/simulate stuff using three.js

Hey @Ricardo_Zepeda, @Exilliar just asked a similar question and I realised I forgot to follow up on this thread: Dim/viewer 1201 by didimitrie · Pull Request #1205 · specklesystems/speckle-server · GitHub - is merged, and you’re good to go! Quick example usage is in the link above.

What’s also super embarrassing is that it seems we added this feature basically one day later and we forgot to mention it :see_no_evil:

1 Like