コード例 #1
0
    def curvature(self, points=None):
        """"""
        if not points:
            points = self.heightfield()

        curvature = []

        if rs.IsPolysurface(self.guid):
            rs.EnableRedraw(False)
            faces = {}
            for point in points:
                bcp = rs.BrepClosestPoint(self.guid, point)
                uv = bcp[1]
                index = bcp[2][1]
                try:
                    face = faces[index]
                except (TypeError, IndexError):
                    face = rs.ExtractSurface(self.guid, index, True)
                    faces[index] = face
                props = rs.SurfaceCurvature(face, uv)
                curvature.append((point, (props[1], props[3], props[5])))
            rs.DeleteObjects(faces.values())
            rs.EnableRedraw(False)
        elif rs.IsSurface(self.guid):
            for point in points:
                bcp = rs.BrepClosestPoint(self.guid, point)
                uv = bcp[1]
                props = rs.SurfaceCurvature(self.guid, uv)
                curvature.append((point, (props[1], props[3], props[5])))
        else:
            raise RhinoSurfaceError('object is not a surface')

        return curvature
コード例 #2
0
    def descent(self, points=None):
        """"""
        if not points:
            points = self.heightfield()

        tol = rs.UnitAbsoluteTolerance()

        descent = []

        if rs.IsPolysurface(self.guid):
            rs.EnableRedraw(False)
            faces = {}
            for p0 in points:
                p = p0[:]
                p[2] -= 2 * tol
                bcp = rs.BrepClosestPoint(self.guid, p)
                uv = bcp[1]
                index = bcp[2][1]
                try:
                    face = faces[index]
                except (TypeError, IndexError):
                    face = rs.ExtractSurface(self.guid, index, True)
                    faces[index] = face
                p1 = rs.EvaluateSurface(face, uv[0], uv[1])
                vector = [p1[_] - p0[_] for _ in range(3)]
                descent.append((p0, vector))
            rs.DeleteObjects(faces.values())
            rs.EnableRedraw(True)
        elif rs.IsSurface(self.guid):
            for p0 in points:
                p = p0[:]
                p[2] -= 2 * tol
                bcp = rs.BrepClosestPoint(self.guid, p)
                uv = bcp[1]
                p1 = rs.EvaluateSurface(self.guid, uv[0], uv[1])
                vector = [p1[_] - p0[_] for _ in range(3)]
                descent.append((p0, vector))
        else:
            raise RhinoSurfaceError('object is not a surface')

        return descent
#print insulation_Panels
for item in range(0, len(insulation_Panels), 1):
    item = insulation_Panels[item]
    if item == None:
        rs.DeleteObject(item)
    else:
        insulation_Panels_temp.append(item)

insulation_Panels = insulation_Panels_temp
insulation_Panels_temp = []

#print insulation_Panels

for i in range(0, len(insulation_Panels), 1):
    item = insulation_Panels[i]
    face = rs.ExtractSurface(item, 2, True)
    #print face
    for j in range(0, len(window_frame_all), 1):
        window_frame = window_frame_all[j]
        window_frame_bbox = rs.BoundingBox(window_frame)

        test = rs.IsObjectInBox(item, window_frame_bbox, True)
        if test == False:
            insulation_Panels_temp.append(item)
            rs.DeleteObject(face)
        else:
            rs.DeleteObject(item)
            rs.DeleteObject(face)

insulation_Panels = insulation_Panels_temp
#print insulation_Panels