Cancel
Showing results for 
Search instead for 
Did you mean: 

Change conveyor(Line) color

Builder
Builder

@PeterKomarek  @IgorKunjavskij  I want to change the Line color using simtalk. Is it possible to change conveyor(Line) color. Please help

7 REPLIES

Re: Change conveyor(Line) color

Phenom
Phenom

for a standard conveyor try _3D.setGraphicMaterial(["lanes"]...)

 

e.g.

 

var obj := conveyor


var difColor:= makeRGBValue(255,0,0) 
var envColor:=makeRGBValue(200,200,200) 
var mirColor:=makeRGBValue(250,250,250)
var selColor:= makeRGBValue(150,150,150)
var trans:= 0.7
var shine :=0.3
obj._3d.setGraphicMaterial(["lanes"],difColor,envColor,mirColor,selColor,trans,shine)

Re: Change conveyor(Line) color

Builder
Builder

@simulator I added the code and got below error:

"An implicit list access using '[x,y]' can only be made within a list formula".

Re: Change conveyor(Line) color

Phenom
Phenom

Here's the model, I tested the code with

 

 

Unbenannt.PNG

 

Re: Change conveyor(Line) color

Siemens Phenom Siemens Phenom
Siemens Phenom

Actually, that attempt will not be persistent in your model file unless you remove the length orientation of your conveyor which I would not recommend short of very special exceptions.

So, you can read and write the extrusion configuration via the SimTalk attribute _3D.ExtConfiguration.

That configuration contains the entire visual specification of your conveyor short of the curve it follows.

My standard attempt is the following:

  • Write a method with the following code (assuming Line is the conveyor you want to modify):
    var t : table := Line._3D.ExtConfiguration
    debug --This forces the interpreter stopping here and letting you examine whatever local variables you might have
    Line._3D.ExtConfiguration := t
  • While you are standing at debug, you can make whatever change you want in the table - it will be assigned anew when you continue - then you see whether the result is what you want.
  • You can then replace "debug by setting your material, e.g.
    t["Material", "Lanes"]["Diffuse Color", 1] := makeRGBValue(255, 0, 0)
    to color the lane of a belt conveyor in red.
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution

Re: Change conveyor(Line) color

Builder
Builder

@simulator Could you please send me v14.?

Re: Change conveyor(Line) color

Phenom
Phenom

please find attached v14 model.

 

1. as Peter Komarek posted, this way of setting graphic colors is not persistent.

 

2. v14.0 does not accept the array parameter as 14.1 does.

 

var obj :=conveyor



var difColor:= makeRGBValue(0,0,255) 
var envColor:=makeRGBValue(200,200,200) 
var mirColor:=makeRGBValue(250,250,250)
var selColor:= makeRGBValue(150,150,150)

var trans:= 0.7
var shine :=0.3


--obj._3d.setGraphicMaterial(["array"],difColor,envColor,mirColor,selColor,trans,shine)  --v14.1 code

var array := makeArray("lanes")
obj._3d.setGraphicMaterial(array,difColor,envColor,mirColor,selColor,trans,shine) --v14.0 code

Re: Change conveyor(Line) color

Builder
Builder

Thank you Smiley Happy