cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Atribuição de Cores através do Thingworx

csilva1
7-Bedrock

Atribuição de Cores através do Thingworx

Boa tarde, conforme orientação do Ewerton Moreira​ gostaria de compartilhar uma dificuldade que estou tento no Thingworx View.

Na aplicação que estou construindo os principais componentes possuem Model Items, nesse caso um Compressor, dois Inversores de Frequência e dois Ventiladores.

O equipamento possui monitoramento IoT através do Thingworx Composer. Todos esses componentes que citei possuem propriedades no Thingworx que monitoram seus Status. Então o objetivo é atribuir uma cor específica para os Models Items de acordo com uma propriedade no Thingworx.

Qual a forma que foi feita?

   - Inicialmente o teste foi feito com o Model Item Compressor.

   - No Composer crei uma propriedade chamada "cor_compressor". E criei um serviço "Cores" com o seguinte script:

                       if(me.Compressor_TENSAO_COMP > 10.0) {

                                      me.cor_compressor = "rgb(31,131,5)";

                        }

                        else me.cor_compressor = "rgb(0,0,0)";

   - No Studio associei a propriedade externa "cor_compressor" com "Color" do Model Item Compressor.

Resultado:

    A variável é atualizada corretamente (fiz o teste colocando um Label com o Valor na tela), e no preview no PC as cores mudam corretamente:

Porém, no dispositivo (tablet ou Smartphone) o item não muda de cor.

Desde já, agradeço.

Eng Christyam Alcantara

7 REPLIES 7
emoreira
14-Alexandrite
(To:csilva1)

Sushant Pandey

This is an use case that the customer has where he wants to change the model item color based on a property from TWX. He created a service in TWX that sets the variable cor_compressor

                       if(me.Compressor_TENSAO_COMP > 10.0) {

                                      me.cor_compressor = "rgb(31,131,5)";

                        }

                        else me.cor_compressor = "rgb(0,0,0)";

After this they link this property to the model link color.

It is working in the PREVIEW but not in the View App.

supandey
19-Tanzanite
(To:emoreira)

Adding @giri for help

katte
12-Amethyst
(To:emoreira)

Ewerton MoreiraChristyam Silva​ Can you please try the resolution suggested in the article - https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS251748&lang=en_US

emoreira
14-Alexandrite
(To:katte)

giri​,

I looked at the support and it is teaching how to change the color. This is already done in the app and it is working in the preview but it is not working in the App.

I will ask Christyam Silva​ to take a look and try to implement it but what he really wants is that this value is driven from TWX.

Thanks

Ewerton

katte
12-Amethyst
(To:emoreira)

If that is the case, I would contemplate on connection b/w TWX and Studio/ES, or atleast delay in connection. Also, may be the entity built in TWX is not being accessible.

emoreira
14-Alexandrite
(To:katte)

Hi giri​, We tested your recommendation and it is working.

I believe this Application Parameter did the trick. We also were using rgb() instead of rgba().

We were having issues with the gauges updating and it worked when we started using the Application Parameter.\

Sushant Pandey​, thanks for helping too!

emoreira
14-Alexandrite
(To:emoreira)

btw giriSushant Pandey​,

Looks like the solution worked well for Android devices but still did not work for iOS.

Any idea why?

Cheers

Announcements

Top Tags