# -*- coding: utf-8 -*- import rhinoscriptsyntax as rs def create_two_floors_with_columns(): # Parametri za prvi sprat (donji box) floor_width = 10 floor_length = 10 floor_height = 4 # Parametri za gornji sprat (gornji box) upper_floor_width = floor_width + 4 # 2 metra širi sa svake strane upper_floor_length = floor_length + 4 # 2 metra širi sa svake strane upper_floor_height = 1 # Visina gornjeg box-a (od 4m do 5m) # Parametri za donji sprat (od -3 do 0) lower_floor_width = 18 # 2m širi sa svake strane od srednjeg sprata lower_floor_length = 18 lower_floor_height = 6 # Donji sprat sada ide od -3 do 0 # Parametri za stubove column_height = 4 column_radius = 0.2 # Poluprečnik stuba column_spacing = 4 # Razmak između stubova offset = 2 # Odstojanje stubova od ivica gornjeg box-a (1 metar) # Centralna tačka za pozicioniranje oba box-a center_x = floor_width / 2 center_y = floor_length / 2 # Kreiraj donji sprat (od -3 do 0) lower_floor_box = rs.AddBox([ (center_x - lower_floor_width / 2, center_y - lower_floor_length / 2, -3), (center_x + lower_floor_width / 2, center_y - lower_floor_length / 2, -3), (center_x + lower_floor_width / 2, center_y + lower_floor_length / 2, -3), (center_x - lower_floor_width / 2, center_y + lower_floor_length / 2, -3), (center_x - lower_floor_width / 2, center_y - lower_floor_length / 2, 0), (center_x + lower_floor_width / 2, center_y - lower_floor_length / 2, 0), (center_x + lower_floor_width / 2, center_y + lower_floor_length / 2, 0), (center_x - lower_floor_width / 2, center_y + lower_floor_length / 2, 0) # Kreiraj prvi box (donji sprat) # Donji sprat - kutija 10x10 metara, visina 4 metra floor_box = rs.AddBox([(center_x - floor_width / 2, center_y - floor_length / 2, 0), (center_x + floor_width / 2, center_y - floor_length / 2, 0), (center_x + floor_width / 2, center_y + floor_length / 2, 0), (center_x - floor_width / 2, center_y + floor_length / 2, 0), (center_x - floor_width / 2, center_y - floor_length / 2, floor_height), (center_x + floor_width / 2, center_y - floor_length / 2, floor_height), (center_x + floor_width / 2, center_y + floor_length / 2, floor_height), (center_x - floor_width / 2, center_y + floor_length / 2, floor_height)]) # Kreiraj gornji box (gornji sprat), širi za 2 metra u svakom smeru upper_floor_box = rs.AddBox([(center_x - upper_floor_width / 2, center_y - upper_floor_length / 2, floor_height), (center_x + upper_floor_width / 2, center_y - upper_floor_length / 2, floor_height), (center_x + upper_floor_width / 2, center_y + upper_floor_length / 2, floor_height), (center_x - upper_floor_width / 2, center_y + upper_floor_length / 2, floor_height), (center_x - upper_floor_width / 2, center_y - upper_floor_length / 2, floor_height + upper_floor_height), (center_x + upper_floor_width / 2, center_y - upper_floor_length / 2, floor_height + upper_floor_height), (center_x + upper_floor_width / 2, center_y + upper_floor_length / 2, floor_height + upper_floor_height), (center_x - upper_floor_width / 2, center_y + upper_floor_length / 2, floor_height + upper_floor_height)]) # Dodaj stubove sa svake strane za podršku gornjem spratu, udaljene 1m od ivica gornjeg box-a columns = [] for x in range(offset + column_spacing, upper_floor_width - offset, column_spacing): # Stubovi sa prednje i zadnje strane (odmaknuti 1m od ivice gornjeg box-a) for y in [0, upper_floor_length]: column_base = rs.AddCircle(rs.WorldXYPlane(), column_radius) column = rs.ExtrudeCurveStraight(column_base, (0, 0, 0), (0, 0, column_height)) rs.MoveObject(column, (center_x + x - upper_floor_width / 2, center_y + y - upper_floor_length / 2, 0)) # Pozicioniranje stubova columns.append(column) for y in range(offset + column_spacing, upper_floor_length - offset, column_spacing): # Stubovi sa bočnih strana (odmaknuti 1m od ivice gornjeg box-a) for x in [0, upper_floor_width]: column_base = rs.AddCircle(rs.WorldXYPlane(), column_radius) column = rs.ExtrudeCurveStraight(column_base, (0, 0, 0), (0, 0, column_height)) rs.MoveObject(column, (center_x + x - upper_floor_width / 2, center_y + y - upper_floor_length / 2, 0)) # Pozicioniranje stubova columns.append(column) # Vraćanje objekata return floor_box, upper_floor_box, columns # Pozovi funkciju za kreiranje objekta create_two_floors_with_columns()