Exemplo n.º 1
0
def make_AIS(obj : Union[cq.Workplane, cq.Shape], options={}):

    shape = to_compound(obj)
    ais = AIS_ColoredShape(shape.wrapped)
    
    if 'alpha' in options:
        ais.SetTransparency(options['alpha'])
    if 'color' in options:
        ais.SetColor(to_occ_color(options['color']))
    if 'rgba' in options:
        r,g,b,a = options['rgba']
        ais.SetColor(to_occ_color((r,g,b)))
        ais.SetTransparency(a)

    return ais,shape
Exemplo n.º 2
0
def make_AIS(obj : Union[cq.Workplane, cq.Shape], options={}):
    
    if isinstance(obj, cq.Shape):
        obj = to_workplane(obj)
    elif isinstance(obj, TopoDS_Shape):
        obj = to_workplane(cq.Shape.cast(obj))

    shape = to_compound(obj)
    ais = AIS_ColoredShape(shape.wrapped)
    
    if 'alpha' in options:
        ais.SetTransparency(options['alpha'])
    if 'color' in options:
        ais.SetColor(to_occ_color(options['color']))
    if 'rgba' in options:
        r,g,b,a = options['rgba']
        ais.SetColor(to_occ_color((r,g,b)))
        ais.SetTransparency(a)

    return ais,shape