Book a Demo

Author Topic: Is there a way to colour an element based on the links it has?  (Read 3749 times)

kents

  • EA Novice
  • *
  • Posts: 16
  • Karma: +1/-0
    • View Profile
Is there a way to colour an element based on the links it has?
« on: September 30, 2017, 12:31:50 am »
(Sorry if this has been asked before, but I have searched both the user manual and the user forum without success)

I want to show all elements of a particular type everywhere in my model, with one of two background colours, the choice of colour being determined by whether or not the element is connected by one or more realization links from elements of another type.

Does anyone know of a way to do this?

Thanks in advance for any help you can give.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Is there a way to colour an element based on the links it has?
« Reply #1 on: September 30, 2017, 01:03:05 am »
Have you tried setting the background colour  in a RelatedElement subshape?

/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Is there a way to colour an element based on the links it has?
« Reply #2 on: September 30, 2017, 03:57:49 am »
No, that won't work. The SetFillColor is ignored in the compartment. You have to turn showing the compartment on for each element. The only way I see to get this realized is to call an add-in inside the shape script. That's everything but performant. Not talking of "easy to implement".

Eventually a coloring script might be an alternative.

I haven't worked with diagram filters (much). Eventually they offer something for you.

q.

kents

  • EA Novice
  • *
  • Posts: 16
  • Karma: +1/-0
    • View Profile
Re: Is there a way to colour an element based on the links it has?
« Reply #3 on: October 02, 2017, 11:57:08 pm »
@Uffe, @qwerty - Thank you for your responses. It sounds as though I'll have to wait for Sparx to add a feature that allows auto colouring based on a custom query. I will raise a feature request. If it comes to it, I'll write a script that I can run from time to time to update colours based on my criteria, but clearly that is not as convenient as the colouring being set automatically, as the model is changed.

John