예제 #1
0
    def __init__(self, length, casingod, casingid, liningod, liningid, flange):

        """
        Initializes a PipeStraight instance.

        Arguments:
        length -- length of straight, in mm
        casingod -- outside diameter of casing, in mm
        casingid -- inside diameter of casing, in mm
        liningod -- outside diameter of lining, in mm
        liningid -- inside diameter of lining, in mm
        """

        # Call superclass constructor

        Pipe.__init__(self, casingod, casingid, liningod, liningid, flange)

        # Straight properties

        self.length = length
        self.len_dim_line_length = 0
        self.len_dim_line_length_offset_m = 1
        self.len_dim_line_length_width_m = 2

        # Calculate straight component points

        pc_pts_out = {}
        pc_pts_in = {}
        pc_pts_ctr = []

        for comp in ["co", "ci", "lo", "li"]:
            pc_pts_out[comp] = []
            pc_pts_in[comp] = []
            for y in [0, -self.length]:
                pc_pts_out[comp].append(Point(self.p_rad[comp], y))
                pc_pts_in[comp].append(Point(-self.p_rad[comp], y))
            pc_pts_in[comp].reverse()

        for y in [0, -self.length]:
            pc_pts_ctr.append(Point(0, y))

        self.pc_pts = {"in": pc_pts_in, "out": pc_pts_out,
                       "ctr": pc_pts_ctr}
예제 #2
0
    def __init__(self, nomrad, casingod, casingid, liningod,
                 liningid, bendangle, segangle, ctype, flange,
                 exdimdrg, exdimbox):

        """
        Initializes a PipeBend instance.

        Arguments:
        nomrad -- nominal radius, in mm
        casingod -- outside diameter of casing, in mm
        casingid -- inside diameter of casing, in mm
        liningod -- outside diameter of lining, in mm
        liningid -- inside diameter of lining, in mm
        bendangle -- angle, in degrees, of overall bend
        segangle -- angle, in degrees, of each bend segment
        ctype -- type of casing, either "onepiece" or "segmented"
        exdimdrg -- True to show segment dimensions on main drawing
        exdimbox -- True to show segment dimensions in an infobox
        """

        # Call superclass constructor

        Pipe.__init__(self, casingod, casingid, liningod, liningid, flange)

        # Page dimensions and properties

        self.dos_dim_line_length = 30
        self.dos_dim_dp = 3

        # Bend angles, properties and information

        self.bend_arc_d = bendangle
        self.segment_angle_d = segangle
        self.bend_arc = radians(bendangle)
        self.segment_angle = radians(segangle)
        self.num_segments = int(self.bend_arc / self.segment_angle)
        self.casing_type = ctype
        self.ex_dim_box = exdimbox
        self.ex_dim_drg = exdimdrg

        # Bend diameters and radii

        fod = self.flange.flange_diameter

        self.diameters["nom"] = nomrad * 2

        outer_radii = {"nom": nomrad,
                       "co": nomrad + casingod / 2.0,
                       "ci": nomrad + casingid / 2.0,
                       "lo": nomrad + liningod / 2.0,
                       "li": nomrad + liningid / 2.0,
                       "fo": nomrad + fod / 2.0}
        inner_radii = {"nom": nomrad,
                       "co": nomrad - casingod / 2.0,
                       "ci": nomrad - casingid / 2.0,
                       "lo": nomrad - liningod / 2.0,
                       "li": nomrad - liningid / 2.0,
                       "fo": nomrad - fod / 2.0}
        self.radii = {"inner": inner_radii,
                      "outer": outer_radii,
                      "nom": nomrad}

        # Calculate and store segment dimensions

        # pylint: disable=C0103

        self.segdims = {}
        for k, i, d, l in zip(["cex", "cin", "lex", "lin", "mean"],
                              ["outer", "inner", "outer", "inner", "outer"],
                              ["co", "co", "lo", "lo", "nom"],
                              ["Casing seg. extra. length",
                               "Casing seg. intra. length",
                               "Lining seg. extra. length",
                               "Lining seg. intra. length",
                               "Mean seg. length"]):
            dim = self.radii[i][d] * tan(self.segment_angle / 2) * 2
            self.segdims[k] = LabeledValue(l, dim)

        # pylint: enable=C0103

        # Calculate segmented component points

        pc_pts_out = {}
        pc_pts_in = {}

        for k in ["co", "ci", "lo", "li"]:
            pc_pts_out[k] = self.get_segment_points(self.radii["outer"][k])
            pc_pts_in[k] = self.get_segment_points(self.radii["inner"][k])
            pc_pts_in[k].reverse()
        pc_pts_ctr = self.get_segment_points(self.radii["nom"])
        self.pc_pts = {"in": pc_pts_in, "out": pc_pts_out,
                       "ctr": pc_pts_ctr}