def getBeamLines(self, beam_start_point, total_span_length, column_widths): layer = Constants.LAYER_BEAM_LINES #set up input data column_start_top_width = column_widths[0] column_start_bottom_width = column_widths[1] column_end_top_width = column_widths[2] column_end_bottom_width = column_widths[3] total_length = total_span_length * SpanCoordinates.ONE_M_IN_MM #beam top line top_start_point = self.changeX(beam_start_point, -column_start_top_width / 2) top_end_point = self.changeX(beam_start_point, total_length + column_end_top_width / 2) top_line = EntityLine(top_start_point, top_end_point, layer) #beam bottom line bottom_start_point = self.changeXY(beam_start_point, -column_start_bottom_width / 2, -self.beam_depth) bottom_end_point = self.changeXY( beam_start_point, total_length + column_end_bottom_width / 2, -self.beam_depth) bottom_line = EntityLine(bottom_start_point, bottom_end_point, layer) #left and right closing line left_line = EntityLine(top_start_point, bottom_start_point, layer) right_line = EntityLine(top_end_point, bottom_end_point, layer) return [top_line, bottom_line, left_line, right_line]
def drawZ(self, column_width, end_left, end_right): ''' Z is the the zizzag that closes up or breaks the column at the end 4 /\ 1 _______ 2 / \______ 6 \ / 5 \/ 3 ''' pt1 = self.changeX(end_left, -column_width * Constants.Z_OUTER_SEGMENT) pt2 = self.changeX(end_left, column_width * Constants.Z_INNER_SEGMENT) pt6 = self.changeX(end_right, column_width * Constants.Z_OUTER_SEGMENT) pt5 = self.changeX(end_right, -column_width * Constants.Z_OUTER_SEGMENT) pt3 = self.changeXY(end_left, column_width * Constants.Z_TIP_LENGTH, -column_width * Constants.Z_TIP_DEPTH) pt4 = self.changeXY(end_right, -column_width * Constants.Z_TIP_LENGTH, column_width * Constants.Z_TIP_DEPTH) line_1_2 = EntityLine(pt1, pt2, Constants.LAYER_ZIGZAG_LINES) line_2_3 = EntityLine(pt2, pt3, Constants.LAYER_ZIGZAG_LINES) line_3_4 = EntityLine(pt3, pt4, Constants.LAYER_ZIGZAG_LINES) line_4_5 = EntityLine(pt4, pt5, Constants.LAYER_ZIGZAG_LINES) line_5_6 = EntityLine(pt5, pt6, Constants.LAYER_ZIGZAG_LINES) return [line_1_2, line_2_3, line_3_4, line_4_5, line_5_6]
def getRightLine(self, left_top_point): right_line_top_point = None if self.link_type.length != None: right_line_top_point = self.changeX( left_top_point, self.link_type.length * SpanPoints.ONE_M_IN_MM) else: right_line_top_point = self.changeXY( self.end_point, -self.right_column_width / 2 - self.link_type.offset * SpanPoints.ONE_M_IN_MM, -Constants.LINKS_CUT_OFF_FROM_EDGE_OF_BEAM_LINE) right_line_bottom_point = self.changeY( right_line_top_point, -self.beam_depth + 2 * Constants.LINKS_CUT_OFF_FROM_EDGE_OF_BEAM_LINE) #this point needs to be returned to top of beam without the small cut off self.start_point_links = tuple( self.changeY(right_line_top_point, Constants.LINKS_CUT_OFF_FROM_EDGE_OF_BEAM_LINE)) #with new start point, there is no left column, but column on the right #is still present self.left_column_width = 0 return EntityLine(right_line_top_point, right_line_bottom_point, Constants.LAYER_SHEAR_LINKS)
def getColumnTopLine(self, value, is_left_column): if is_left_column: start_point = list(self.start_point) else: start_point = list(self.end_point) pt1 = self.changeX(start_point, value) pt2 = self.changeY(pt1, self.beam_depth * Constants.COLUMN_LINE_FACTOR) return EntityLine(pt1, pt2, Constants.LAYER_SUPPORT_LINES)
def getLines(self, connectivities): lines = [] for connectivity in connectivities: vertex_start = self.getVertexName(connectivity[0]) vertex_end = self.getVertexName(connectivity[1]) line = EntityLine(self.vertices[vertex_start], self.vertices[vertex_end]) lines.append(line) return lines
def getLeftLine(self): left_line_top_point = self.changeXY( self.start_point_links, self.left_column_width / 2 + self.link_type.offset * SpanPoints.ONE_M_IN_MM, -Constants.LINKS_CUT_OFF_FROM_EDGE_OF_BEAM_LINE) left_line_bottom_point = self.changeY( left_line_top_point, -self.beam_depth + 2 * Constants.LINKS_CUT_OFF_FROM_EDGE_OF_BEAM_LINE) return EntityLine(left_line_top_point, left_line_bottom_point, Constants.LAYER_SHEAR_LINKS)
def getCenterLine(self, is_left_column): if is_left_column: start_point = list(self.start_point) else: start_point = list(self.end_point) top_point = self.changeY( start_point, self.beam_depth * Constants.CENTER_LINE_FACTOR_TOP) bottom_point = self.changeY( start_point, -self.beam_depth - self.beam_depth * Constants.CENTER_LINE_FACTOR) return EntityLine(top_point, bottom_point, Constants.LAYER_CENTER_LINES)
def getSectionLines(self, column_widths, left_section, right_section, beam_name="beam"): ''' Beam name is only required in the event that there is a warning that needs to be shown to the user | | self.start _|___4_____________________________________8_____|___________ | |______________________________________| | | 3 7 | | ______________________________________ | | | 2 6 | | | | | | _|___| 1 5 |____|__ | | | | if points 3 or 7 above 4 or 8 at start of beam depth, don't draw 3 to 7 ''' #define hatch coords hatches_cords = SpanCoordinates.HatchCoords() #define layer for these lines layer = Constants.LAYER_SECTION_LINES #set up in put data left_column_top_width = column_widths[0] left_column_bottom_width = column_widths[1] right_column_top_width = column_widths[2] right_column_bottom_width = column_widths[3] #lines list section_lines = [] pt1 = self.changeXY(self.start_point, self.getHalfWidth(left_column_bottom_width), -self.beam_depth) # if section depth is greater than beam depth, then point should be got # using the section depth if left_section.d > self.beam_depth: pt3 = self.changeY(pt1, self.beam_depth) else: pt3 = self.changeY(pt1, left_section.d) pt2 = self.changeY(pt3, -left_section.df) pt4 = self.changeX(self.start_point, self.getHalfWidth(left_column_top_width)) pt5 = self.changeXY( self.start_point, self.span_length - self.getHalfWidth(right_column_bottom_width), -self.beam_depth) pt7 = self.changeY(pt5, right_section.d) # same logic as point 2 for point 6 if right_section.d > self.beam_depth: pt7 = self.changeY(pt5, self.beam_depth) else: pt7 = self.changeY(pt5, right_section.d) pt6 = self.changeY(pt7, -right_section.df) pt8 = self.changeX( self.start_point, self.span_length - self.getHalfWidth(right_column_top_width)) self.showWarning(pt2, pt4, pt3, pt6, pt7, pt8, left_section, right_section) line_1_2 = EntityLine(pt1, pt2, layer) line_5_6 = EntityLine(pt5, pt6, layer) #add created lines to lines pool section_lines.append(line_1_2) section_lines.append(line_5_6) #Do the neccessary checks so that you do not draw useless lines #line 2 to 6 if both 2 and 6 are not above or equal to 4 and 8 #respectively if pt2[EntityLine.Y] < pt4[EntityLine.Y] or pt6[EntityLine.Y] < pt8[ EntityLine.Y]: #check to make sure this is not a square section, this line will be drawn as #a bottom line if this is square section if pt2[EntityLine.Y] != pt3[EntityLine.Y] and \ pt6[EntityLine.Y] != pt7[EntityLine.Y]: line_2_6 = EntityLine(pt2, pt6, layer) section_lines.append(line_2_6) hatches_cords.setPointsBottom(pt1, pt2, pt5, pt6) #same logic as above for line 3 to 7 if pt3[EntityLine.Y] < pt4[EntityLine.Y] or pt7[EntityLine.Y] < pt8[ EntityLine.Y]: line_3_7 = EntityLine(pt3, pt7, layer) section_lines.append(line_3_7) hatches_cords.setPointsTop(pt3, pt4, pt7, pt8) #Lines 3 to 4 and 7 to 8 will the logic above but each independently #Draw line 3 to 4 if pt3 is below pt4 vertically if pt3[EntityLine.Y] < pt4[EntityLine.Y]: line_3_4 = EntityLine(pt3, pt4, layer) section_lines.append(line_3_4) #Use similar logic for line 7 to 8 if pt7[EntityLine.Y] < pt8[EntityLine.Y]: line_7_8 = EntityLine(pt7, pt8, layer) section_lines.append(line_7_8) return section_lines, hatches_cords
def getSpanLine(self): return EntityLine(self.start_point, self.end_point)