summaryrefslogtreecommitdiff
path: root/utilities/__init__.py
blob: d7ca17bc83dec1348531af7cd3e0a59933bf5070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from OCC.AIS import AIS_Shape
from OCC.TopAbs import TopAbs_EDGE
from OCC.TopExp import TopExp_Explorer
from OCC.TopoDS import topods, TopoDS_Shape
from OCC.Quantity import Quantity_NOC_BLACK


def colorTheEdges(shp, display,color,width):
    shapeList  =  []
    Ex = TopExp_Explorer(shp,TopAbs_EDGE)
    ctx = display.Context
    while Ex.More():
        aEdge = topods.Edge(Ex.Current())
        ais_shape = AIS_Shape(aEdge).GetHandle()
        ctx.SetColor(ais_shape,color, False)
        ctx.SetWidth(ais_shape,width, False)
        ctx.Display(ais_shape, False)
        Ex.Next()
        
def setDefaultEdgeStyle(shp, display):
    colorTheEdges(shp, display, Quantity_NOC_BLACK, 1.0)
    #return shps
    
    
def osdagDisplayShape (display, shapes,material=None, texture=None, color=None, transparency=None, update=False):
    setDefaultEdgeStyle(shapes, display)
    display.DisplayShape(shapes,material,texture,color,transparency,update = True)