def load(self): filename, _ = QFileDialog.getOpenFileName(self, 'load project', self.lastDirectory, "json(*.json)") if filename == '': return config.load(self, filename) self.calculate()
def load_config(self): etabs_filename = self.etabs.get_filename() json_file = etabs_filename.with_suffix('.json') if json_file.exists(): config.load(json_file, self.form) param = FreeCAD.ParamGet( "User parameter:BaseApp/Preferences/Mod/civilTools") show_at_startup = param.GetBool("FirstTime", True) self.form.show_at_startup.setChecked(show_at_startup) ostan = param.GetString("ostan", 'قم') city = param.GetString("city", 'قم') index = self.form.ostanBox.findText(ostan) self.form.ostanBox.setCurrentIndex(index) index = self.form.cityBox.findText(city) self.form.cityBox.setCurrentIndex(index)
def current_building(self, tx, ty): d = config.load(self.json_file) risk_level = d['risk_level'] height_x = d['height_x'] importance_factor = float(d['importance_factor']) soil = d['soil_type'] city = d['city'] noStory = d['no_of_story_x'] xSystemType = d['x_system_name'] xLateralType = d['x_lateral_name'] ySystemType = d['y_system_name'] yLateralType = d['y_lateral_name'] is_infill = d['infill'] xSystem = StructureSystem(xSystemType, xLateralType, "X") ySystem = StructureSystem(ySystemType, yLateralType, "Y") build = Building( risk_level, importance_factor, soil, noStory, height_x, is_infill, xSystem, ySystem, city, tx, ty, ) return build
def apply_factors_to_etabs(self): d = config.load(self.json_file) bot_story = d.get("bot_x_combo", '') top_story = d.get("top_x_combo", '') ret = self.etabs.apply_cfactor_to_edb( self.final_building, bot_story, top_story, ) if ret == 1: msg = "Data can not be written to your Etabs file,\n If you want to correct this problem, try Run analysis." title = "Remove Error?" QMessageBox.information(None, title, msg) return msg = "Successfully written to Etabs." self.save_config() QMessageBox.information(None, "done", msg)
def set_properties_from_json(self): if self.json_file is None: etabs_filename = self.etabs.get_filename() self.json_file = etabs_filename.with_suffix('.json') d = config.load(self.json_file) self.risk_level = d['risk_level'] self.height_x = d['height_x'] self.importance_factor = float(d['importance_factor']) self.soil = d['soil_type'] self.city = d['city'] self.noStory = d['no_of_story_x'] self.xSystemType = d['x_system_name'] self.xLateralType = d['x_lateral_name'] self.ySystemType = d['y_system_name'] self.yLateralType = d['y_lateral_name'] self.is_infill = d['infill'] self.xSystem = StructureSystem(self.xSystemType, self.xLateralType, "X") self.ySystem = StructureSystem(self.ySystemType, self.yLateralType, "Y")
def accept(self): d = config.load(self.json_file) no_of_stories = d['no_of_story_x'] cdx = d['cdx'] cdy = d['cdy'] bot_story = d["bot_x_combo"] top_story = d["top_x_combo"] create_t_file = self.form.create_t_file_box.isChecked() loadcases = [] for lw in (self.form.x_loadcase_list, self.form.y_loadcase_list): for i in range(lw.count()): item = lw.item(i) if item.checkState() == Qt.Checked: loadcases.append(item.text()) if create_t_file: tx, ty, _ = self.etabs.get_drift_periods() config.save_analytical_periods(self.json_file, tx, ty) building = self.current_building(tx, ty) self.etabs.apply_cfactor_to_edb(building, bot_story, top_story) drifts, headers = self.etabs.get_drifts(no_of_stories, cdx, cdy, loadcases) import table_model table_model.show_results(drifts, headers, table_model.DriftModel)
def load_config(self, json_file=os.path.join(abs_path, 'exporter', 'config.json')): config.load(self, json_file)