Skip to content

Commit 1405a70

Browse files
committed
Port core_display_quality to pythonocc-core-7.5.1
1 parent d87e700 commit 1405a70

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

examples/core_display_quality.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,41 @@
2323
#
2424

2525
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeCylinder
26+
from OCC.Core.Prs3d import Prs3d_Drawer
2627
from OCC.Display.SimpleGui import init_display
2728
display, start_display, add_menu, add_function_to_menu = init_display()
2829

29-
3030
#
3131
# Get Context
3232
#
3333
ais_context = display.GetContext()
3434
#
3535
# Display current quality
3636
dc = ais_context.DeviationCoefficient()
37-
dc_hlr = ais_context.HLRDeviationCoefficient()
3837
da = ais_context.DeviationAngle()
39-
da_hlr = ais_context.HLRAngle()
40-
print("Default display quality settings:")
38+
print("Default AISInteractiveContext display quality settings:")
4139
print("Deviation Coefficient: %f" % dc)
42-
print("Deviation Coefficient Hidden Line Removal: %f" % dc_hlr)
4340
print("Deviation Angle: %f" % da)
44-
print("Deviation Angle Hidden Line Removal: %f" % da_hlr)
4541
#
4642
# Improve quality by a factor 10
4743
#
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+
5348
print("Quality display improved by a factor {0}".format(factor))
5449
#
5550
# Displays a cylinder
5651
#
5752
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+
5961
#
6062
# Display settings and display loop
6163
#

0 commit comments

Comments
 (0)