PythonOCC基础使用:点的性质(glsl定义)

此处用于定义点的性质(例如起点,落定点,中心点等)PythonOCC基础使用:点的性质(glsl定义)

import sys
from OCC.Core.gp import gp_Pnt
from OCC.Core.Geom import Geom_CartesianPoint
from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB
from OCC.Core.Aspect import (Aspect_TOM_POINT,
                             Aspect_TOM_PLUS,
                             Aspect_TOM_STAR,
                             Aspect_TOM_X,
                             Aspect_TOM_O,
                             Aspect_TOM_O_POINT,
                             Aspect_TOM_O_PLUS,
                             Aspect_TOM_O_STAR,
                             Aspect_TOM_O_X,
                             Aspect_TOM_RING1,
                             Aspect_TOM_RING2,
                             Aspect_TOM_RING3,
                             Aspect_TOM_BALL)
from OCC.Core.AIS import AIS_Point
from OCC.Core.Prs3d import Prs3d_PointAspect, Prs3d_Drawer

from OCC.Display.SimpleGui import init_display

display, start_display, add_menu, add_function_to_menu = init_display()

ALL_ASPECTS = [Aspect_TOM_POINT,
               Aspect_TOM_PLUS,
               Aspect_TOM_STAR,
               Aspect_TOM_X,
               Aspect_TOM_O,
               Aspect_TOM_O_POINT,
               Aspect_TOM_O_PLUS,
               Aspect_TOM_O_STAR,
               Aspect_TOM_O_X,
               Aspect_TOM_RING1,
               Aspect_TOM_RING2,
               Aspect_TOM_RING3,
               Aspect_TOM_BALL]


def pnt():
    # create a point
    for idx in range(10):
        for idy in range(10):
            for idz, aspect in enumerate(ALL_ASPECTS):
                x = 0 + idx * 0.1
                y = 0 + idy * 0.1
                z = 0 + idz / len(ALL_ASPECTS)
                p = Geom_CartesianPoint(gp_Pnt(x, y, z))
                color = Quantity_Color(x / len(ALL_ASPECTS), 0, z, Quantity_TOC_RGB)
                ais_point = AIS_Point(p)

                drawer = ais_point.Attributes()
                asp = Prs3d_PointAspect(aspect, color, 3)
                drawer.SetPointAspect(asp)
                ais_point.SetAttributes(drawer)

                display.Context.Display(ais_point, False)
    display.FitAll()
    start_display()


def exit(event=None):
    sys.exit()


if __name__ == '__main__':
    pnt()
PythonOCC基础使用:点的性质(glsl定义)PythonOCC基础使用:点的性质(glsl定义) 小新快跑123 发布了102 篇原创文章 · 获赞 39 · 访问量 6万+ 私信 关注
上一篇:JAVA I/O系统


下一篇:Javascript点击图片提示