EBSILON®Professional Online Documentation
本主题中
    对象的显示
    本主题中

    对象的显示


    通用

    可以根据要求定制对象的显示(颜色和厚度)。按以下要求:


    示例

    下面是一个实现 onUpdateObject 的例子,通过这个例子,管道的颜色会根据压力而改变,管道的厚度会根据质量流量而改变:

    procedure onUpdateObject(obj:ebsobject);
    
    var
    pipe:ebspipe;
    mass:real;
    pressure:real;
    width:integer;
    color:integer;
    begin
    
    pipe := ebspipe(obj);
    
    if isKindOf( pipe, "ebspipewater" ) or isKindOf( pipe, "ebspipesteam" ) then
    begin
    pressure:=pipe.p;
    
    if isKindOf( pipe, "ebspipewater" ) then
    begin
    if pressure < 1 then color := $ffa0a0 else
    
    if pressure < 5 then color := $ff8080 else
    
    if pressure < 10 then color := $ff4040 else
    
    if pressure < 40 then color := $ff0000 else
    
    if pressure < 100 then color := $d00000 else
    
    color := $a00000;
    
    end else
    begin
    if pressure < 1 then color := $a0a0ff else
    
    if pressure < 5 then color := $8080ff else
    
    if pressure < 10 then color := $4040ff else
    
    if pressure < 40 then color := $0000ff else
    
    if pressure < 100 then color := $0000d0 else
    
    color := $0000a0;
    
    end;
    
    pipe.color:=color;
    mass:=pipe.m;
    if mass < 10 then width := 1 else
    
    if mass < 30 then width := 2 else
    
    if mass < 60 then width := 3 else
    
    if mass < 100 then width := 4 else
    
    if mass < 150 then width := 5 else
    
    if mass < 200 then width := 6 else
    
    if mass < 300 then width := 7 else
    
    if mass < 400 then width := 8 else
    
    if mass < 500 then width := 9 else
    
    width := 10;
    
    pipe.width:=width;
    
    end;
    
    end;