示例#1
0
    def add_joins_right(self, build_ele, com_prop_stroke, type=1):
        wall_length = build_ele.Length1_1.value
        wall_width = build_ele.Width1_1.value
        wall_thickness = build_ele.Thickness1_1.value

        j_a = build_ele.type2_a.value
        j_c = build_ele.type2_c.value
        j_d = build_ele.type2_d.value

        join2_point = AllplanGeo.Polygon2D()

        path2 = AllplanGeo.Polyline3D()

        ref_pnt = AllplanGeo.Point2D(0, 0)

        if (type == 1):
            j_b = wall_thickness / 2

            join2_point += AllplanGeo.Point2D(0, -j_a / 2)
            join2_point += AllplanGeo.Point2D(-j_c, -j_d / 2)
            join2_point += AllplanGeo.Point2D(-j_c, j_d / 2)
            join2_point += AllplanGeo.Point2D(0, j_a / 2)
            join2_point += AllplanGeo.Point2D(0, -j_a / 2)

            if not GeometryValidate.is_valid(join2_point):
                return

            path2 += AllplanGeo.Point3D(wall_length, j_b, 0)
            path2 += AllplanGeo.Point3D(wall_length, j_b, wall_width)

        if (type == 2):
            j_b = build_ele.type2_b.value
            join2_point += AllplanGeo.Point2D(-j_a / 2, 0)
            join2_point += AllplanGeo.Point2D(-j_d / 2, j_c)
            join2_point += AllplanGeo.Point2D(j_d / 2, j_c)
            join2_point += AllplanGeo.Point2D(j_a / 2, 0)
            join2_point += AllplanGeo.Point2D(-j_a / 2, 0)

            if not GeometryValidate.is_valid(join2_point):
                return

            path2 += AllplanGeo.Point3D(wall_length - j_b, 0, 0)
            path2 += AllplanGeo.Point3D(wall_length - j_b, 0, wall_width)

            handle_b2 = HandleProperties(
                "Moveb2", AllplanGeo.Point3D(wall_length - j_b, 0, 0),
                AllplanGeo.Point3D(wall_length, 0,
                                   0), [("type2_b", HandleDirection.x_dir)],
                HandleDirection.x_dir, True)
            self.handle_list.append(handle_b2)

        if (type == 3):

            join2_point += AllplanGeo.Point2D(0, 0)
            join2_point += AllplanGeo.Point2D(-j_c, 0)
            join2_point += AllplanGeo.Point2D(-j_c, j_d)
            join2_point += AllplanGeo.Point2D(0, j_a)
            join2_point += AllplanGeo.Point2D(0, 0)

            if not GeometryValidate.is_valid(join2_point):
                return

            path2 += AllplanGeo.Point3D(wall_length, 0, 0)
            path2 += AllplanGeo.Point3D(wall_length, 0, wall_width)

        err, join2 = AllplanGeo.CreatePolyhedron(join2_point, ref_pnt, path2)
        if not GeometryValidate.polyhedron(err):
            return

        self.model_ele_list.append(
            AllplanBasisElements.ModelElement3D(com_prop_stroke, join2))
        return join2
示例#2
0
    def add_joins_left(self, build_ele, com_prop_stroke, type=1):
        wall_length = build_ele.Length1_1.value
        wall_width = build_ele.Width1_1.value
        wall_thickness = build_ele.Thickness1_1.value

        j_a = build_ele.type1_a.value
        j_c = build_ele.type1_c.value
        j_d = build_ele.type1_d.value

        join1_point = AllplanGeo.Polygon2D()

        path1 = AllplanGeo.Polyline3D()

        ref_pnt = AllplanGeo.Point2D(0, 0)

        if (type == 1):
            j_b = wall_thickness / 2

            join1_point += AllplanGeo.Point2D(0, -j_a / 2)
            join1_point += AllplanGeo.Point2D(j_c, -j_d / 2)
            join1_point += AllplanGeo.Point2D(j_c, j_d / 2)
            join1_point += AllplanGeo.Point2D(0, j_a / 2)
            join1_point += AllplanGeo.Point2D(0, -j_a / 2)

            if not GeometryValidate.is_valid(join1_point):
                return

            path1 += AllplanGeo.Point3D(0, j_b, 0)
            path1 += AllplanGeo.Point3D(0, j_b, wall_width)

        if (type == 2):
            j_b = build_ele.type1_b.value
            join1_point += AllplanGeo.Point2D(-j_a / 2, 0)
            join1_point += AllplanGeo.Point2D(-j_d / 2, j_c)
            join1_point += AllplanGeo.Point2D(j_d / 2, j_c)
            join1_point += AllplanGeo.Point2D(j_a / 2, 0)
            join1_point += AllplanGeo.Point2D(-j_a / 2, 0)

            if not GeometryValidate.is_valid(join1_point):
                return

            path1 += AllplanGeo.Point3D(j_b, 0, 0)
            path1 += AllplanGeo.Point3D(j_b, 0, wall_width)

            handle_b1 = HandleProperties("Moveb1",
                                         AllplanGeo.Point3D(j_b, 0, 0),
                                         AllplanGeo.Point3D(0, 0, 0),
                                         [("type1_b", HandleDirection.x_dir)],
                                         HandleDirection.x_dir, False)
            self.handle_list.append(handle_b1)

        if (type == 3):

            join1_point += AllplanGeo.Point2D(0, 0)
            join1_point += AllplanGeo.Point2D(j_c, 0)
            join1_point += AllplanGeo.Point2D(j_c, j_d)
            join1_point += AllplanGeo.Point2D(0, j_a)
            join1_point += AllplanGeo.Point2D(0, 0)

            if not GeometryValidate.is_valid(join1_point):
                return

            path1 += AllplanGeo.Point3D(0, 0, 0)
            path1 += AllplanGeo.Point3D(0, 0, wall_width)

        err, join1 = AllplanGeo.CreatePolyhedron(join1_point, ref_pnt, path1)
        if not GeometryValidate.polyhedron(err):
            #NemAll_Python_Utility.ShowMessageBox("error",1)
            return

        #NemAll_Python_Utility.ShowMessageBox("pass2",1)
        self.model_ele_list.append(
            AllplanBasisElements.ModelElement3D(com_prop_stroke, join1))
        return join1