|
23 | 23 | # |
24 | 24 |
|
25 | 25 | from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeCylinder |
| 26 | +from OCC.Core.Prs3d import Prs3d_Drawer |
26 | 27 | from OCC.Display.SimpleGui import init_display |
27 | 28 | display, start_display, add_menu, add_function_to_menu = init_display() |
28 | 29 |
|
29 | | - |
30 | 30 | # |
31 | 31 | # Get Context |
32 | 32 | # |
33 | 33 | ais_context = display.GetContext() |
34 | 34 | # |
35 | 35 | # Display current quality |
36 | 36 | dc = ais_context.DeviationCoefficient() |
37 | | -dc_hlr = ais_context.HLRDeviationCoefficient() |
38 | 37 | da = ais_context.DeviationAngle() |
39 | | -da_hlr = ais_context.HLRAngle() |
40 | | -print("Default display quality settings:") |
| 38 | +print("Default AISInteractiveContext display quality settings:") |
41 | 39 | print("Deviation Coefficient: %f" % dc) |
42 | | -print("Deviation Coefficient Hidden Line Removal: %f" % dc_hlr) |
43 | 40 | print("Deviation Angle: %f" % da) |
44 | | -print("Deviation Angle Hidden Line Removal: %f" % da_hlr) |
45 | 41 | # |
46 | 42 | # Improve quality by a factor 10 |
47 | 43 | # |
48 | | -factor = 20 |
49 | | -ais_context.SetDeviationCoefficient(dc/factor) |
50 | | -ais_context.SetDeviationAngle(da/factor) |
51 | | -ais_context.SetHLRDeviationCoefficient(dc_hlr/factor) |
52 | | -ais_context.SetHLRAngle(da_hlr/factor) |
| 44 | +factor = 10 |
| 45 | +ais_context.SetDeviationCoefficient(dc / factor) |
| 46 | +ais_context.SetDeviationAngle(da / factor) |
| 47 | + |
53 | 48 | print("Quality display improved by a factor {0}".format(factor)) |
54 | 49 | # |
55 | 50 | # Displays a cylinder |
56 | 51 | # |
57 | 52 | s = BRepPrimAPI_MakeCylinder(50., 50.).Shape() |
58 | | -display.DisplayShape(s) |
| 53 | +ais_shp = display.DisplayShape(s)[0] |
| 54 | + |
| 55 | +drawer = Prs3d_Drawer() |
| 56 | +da_hlr = drawer.HLRAngle() |
| 57 | +print("Deviation Angle Hidden Line Removal: %f" % da_hlr) |
| 58 | +drawer.SetHLRAngle(da_hlr / factor) |
| 59 | +ais_shp.SetAttributes(drawer) |
| 60 | + |
59 | 61 | # |
60 | 62 | # Display settings and display loop |
61 | 63 | # |
|
0 commit comments