Dr. Kavin 2019-06-09 21:27
浏览 528

TypeError: in method 'new_gp_Pnt', argument 1 of type 'Standard_Real'试了几次 还是这出现这种情况

import math

from OCC.Core.gp import (gp_Pnt, gp_Sphere, gp_Ax3, gp_Dir, gp_Circ, gp_Ax2,
gp_Pnt2d, gp_Dir2d)
from OCC.Core.BRepBuilderAPI import (BRepBuilderAPI_MakeEdge,
BRepBuilderAPI_MakeFace,
BRepBuilderAPI_MakeWire)
from OCC.Core.TColgp import TColgp_Array2OfPnt
from OCC.Core.GeomAPI import GeomAPI_PointsToBSplineSurface
from OCC.Core.GeomAbs import GeomAbs_C2
from OCC.Core.Geom2d import Geom2d_Line
from OCC.Core.BRepLib import breplib_BuildCurves3d
from OCC.Core.Quantity import Quantity_Color, Quantity_NOC_PINK

from OCC.Display.SimpleGui import init_display
display, start_display, add_menu, add_function_to_menu = init_display()
import numpy as np

def face():
numpy_array = np.array([[-15,200,10],[5,204,0],[15,200,0],[-15,20,15],[-5,20,0],[15,20,35]])
pythonOCC_array = TColgp_Array2OfPnt(1,3,1,2)
for index in range(0,np.size(numpy_array)):
if index == 0:
pythonOCC_array.SetValue(1,index+1,gp_Pnt(numpy_array[2*index][0],numpy_array[2*index][1],numpy_array[2*index][2]))
pythonOCC_array.SetValue(2,index+1,gp_Pnt(numpy_array[2*index+1][0],numpy_array[2*index+1][1],numpy_array[2*index+1][2]))
pythonOCC_array.SetValue(3,index+1,gp_Pnt(numpy_array[2*index+2][0], numpy_array[2*index + 2][1],
numpy_array[2*index + 2][2]))
if index == 1:
pythonOCC_array.SetValue(1, index +1,gp_Pnt(numpy_array[2*index+1][0], numpy_array[2*index+1][1], numpy_array[2*index+1][2]))
pythonOCC_array.SetValue(2, index+1, gp_Pnt(numpy_array[2*index + 2][0], numpy_array[2 * index + 2][1],numpy_array[2*index + 2][2]))
pythonOCC_array.SetValue(3, index + 1, gp_Pnt(numpy_array[2*index+3][0], numpy_array[2 * index + 3][1],
numpy_array[2 * index + 3][2]))
return pythonOCC_array
curve = GeomAPI_PointsToBSplineSurface(pythonOCC_array, 3, 8, GeomAbs_C2,
0.001).Surface()
red_face = BRepBuilderAPI_MakeFace(curve, 1e-6)
display.DisplayColoredShape(red_face.Face())
if name == '__main__':
face()
start_display()图片说明


  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?