예제 #1
0
 def __make_edge(a, b):
     try:
         return BRepBuilderAPI_MakeEdge(to_Pnt(a), to_Pnt(b)).Edge()
     except:
         raise Exception(f"Cannot make edge segment from points {a}, {b}")
예제 #2
0
def _segment(a, b) -> Shape:
    a, b = points((a, b))
    return Shape(BRepBuilderAPI_MakeEdge(to_Pnt(a), to_Pnt(b)).Edge())
예제 #3
0
파일: project.py 프로젝트: mirmik/zencad
def project_point_on_curve(pnt, crv):
    algo = GeomAPI_ProjectPointOnCurve(to_Pnt(pnt), crv.Curve())
    return point3(algo.NearestPoint())
예제 #4
0
def _circle_arc(p1, p2, p3):
    aArcOfCircle = GC_MakeArcOfCircle(to_Pnt(p1), to_Pnt(p2), to_Pnt(p3))
    return Shape(BRepBuilderAPI_MakeEdge(aArcOfCircle.Value()).Edge())
예제 #5
0
    def set_center(self, pnt, redraw=True):
        self._display.View.Camera().SetCenter(to_Pnt(pnt))
        self.set_orient1()

        if redraw:
            self.redraw()
예제 #6
0
def opencascade_array1_of_pnt(arr):
    ret = TColgp_Array1OfPnt(1, len(arr))
    for i in range(len(arr)):
        ret.SetValue(i + 1, to_Pnt(arr[i]))
    return ret
예제 #7
0
def opencascade_array2_of_pnt(arr):
    ret = TColgp_Array2OfPnt(1, len(arr), 1, len(arr[0]))
    for r in range(len(arr)):
        for c in range(len(arr[0])):
            ret.SetValue(r + 1, c + 1, to_Pnt(arr[r][c]))
    return ret
예제 #8
0
파일: line.py 프로젝트: mirmik/zencad
 def set_points(self, p1, p2):
     self.p1 = point3(p1)
     self.p2 = point3(p2)
     p1 = Geom_CartesianPoint(to_Pnt(self.p1))
     p2 = Geom_CartesianPoint(to_Pnt(self.p2))
     self.ais_object.SetPoints(p1, p2)
예제 #9
0
파일: line.py 프로젝트: mirmik/zencad
 def make_ais(self):
     p1 = Geom_CartesianPoint(to_Pnt(self.p1))
     p2 = Geom_CartesianPoint(to_Pnt(self.p2))
     return AIS_Line(p1, p2)