def draw(pipe, index):
    materialIndex = rs.AddMaterialToObject(pipe)
    rs.MaterialColor(
        materialIndex,
        (random.uniform(0, 255), random.uniform(0, 255), 150 + index * 5))
    rs.MaterialShine(materialIndex, index * 0.1)
    rs.MaterialTransparency(materialIndex, random.uniform(0, 0.15 * index))
Beispiel #2
0
def SplitRecursive(surface, splitValue, direction, generation, index):
    if generation > 0:
        domain_u = rs.SurfaceDomain(surface, direction)
        domainRange = domain_u[1] - domain_u[0]
        split = domainRange * splitValue + domain_u[0]
        surface1 = rs.TrimSurface(surface, direction, (split, domain_u[1]))
        surface2 = rs.TrimSurface(surface, direction, (domain_u[0], split))
        rs.DeleteObject(surface)
        SplitRecursive(surface1, random.uniform(0.4, 0.6), 0, generation - 1,
                       index)
        SplitRecursive(surface2, random.uniform(0.4, 0.6), 1, generation - 1,
                       index)
    else:
        materialIndex = rs.AddMaterialToObject(surface)
        rs.MaterialColor(
            materialIndex,
            (random.uniform(0, 255), random.uniform(0, 255), 150 + index * 5))
        rs.MaterialShine(materialIndex, index * 0.1)
        rs.MaterialTransparency(materialIndex, random.uniform(0, 0.15 * index))
Beispiel #3
0
def AssignMaterial(object_id, Material):
    # Adds simple, pre-defined material surface property sets to objects. Note that
    # these are simply visual properties, they do not make the model suitable for
    # centre of gravity, etc. calculations.
    MatInd = rs.AddMaterialToObject(object_id)
    if Material == "White_composite_external":
        rs.MaterialColor(MatInd, (255, 255, 255))
        rs.MaterialShine(MatInd, 100)
        rs.MaterialTransparency(MatInd, 0)
        rs.MaterialReflectiveColor(MatInd, (255, 255, 255))
    elif Material == "Plexiglass":
        rs.MaterialColor(MatInd, (255, 255, 255))
        rs.MaterialShine(MatInd, 255)
        rs.MaterialTransparency(MatInd, 0.8)
    elif Material == "Skin":
        rs.MaterialColor(MatInd, (229, 184, 143))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "Panel":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "PropDisk":
        rs.MaterialColor(MatInd, (255, 255, 255))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0.9)
    elif Material == "Structure":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 0)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "ShinyBABlueMetal":
        rs.MaterialColor(MatInd, (0, 32, 91))
        rs.MaterialShine(MatInd, 150)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "ShinyBARedMetal":
        rs.MaterialColor(MatInd, (218, 41, 28))
        rs.MaterialShine(MatInd, 150)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "UnpaintedMetal":
        rs.MaterialColor(MatInd, (188, 198, 204))
        rs.MaterialShine(MatInd, 30)
        rs.MaterialTransparency(MatInd, 0)
    elif Material == "FanDisk":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 30)
        rs.MaterialTransparency(MatInd, 0.2)
    elif Material == "ShinyBlack":
        rs.MaterialColor(MatInd, (0, 0, 0))
        rs.MaterialShine(MatInd, 120)
        rs.MaterialTransparency(MatInd, 0)
Beispiel #4
0
 point_list = sweep_2D_data(point_list)
 norm_list = sweep_2D_data(norm_list)
 """
 print( len(string_data), len(string_data[0]) )
 print( len(point_list), len(point_list[0]) )
 print( len(norm_list), len(norm_list[0]) )
 """
 for i, team in enumerate(string_data):
     
     new_color = random_color()
     new_layer = rs.AddLayer(name = team[0], color = new_color)
     mat = rs.AddMaterialToLayer(new_layer)
     # test = rs.LayerMaterialIndex("base_surf")
     # rs.MatchMaterial(rs.ObjectMaterialIndex(new_layer), rs.ObjectMaterialIndex(mat) )
     rs.MaterialColor(mat, new_color)
     rs.MaterialShine(mat, 255 * 0.03)
     
     for j, value in enumerate(team):
         
         if(j == 0):
             # print("ok")
             name_dot = rs.AddTextDot(value, point_list[i][j])
             rs.ObjectLayer(name_dot, new_layer)
         else:
             # convert to string to float
             value = float(value)
             if(value > 0):
                 value = value * factor
             # select vector
             vec_coord = norm_list[i][j]
             print(vec_coord)