def register(): form = RegistrationForm(request.form) if request.method == 'POST' and form.validate(): user_id = create_id() users_db[create_id()] = form.username.data return render_template("home.html") return render_template('registration.html', form=form)
def RunCommand(is_interactive): #load Derivation and model derivation = Derivation.from_json( rhino_UI_utilities.get_json_file_location()) model = derivation.get_next_step() #user input rc, corners = Rhino.Input.RhinoGet.GetRectangle() if rc != Rhino.Commands.Result.Success: return rc plane = Rhino.Geometry.Plane(corners[0], corners[1], corners[2]) beam_frame = Frame(plane[0], plane[1], plane[2]) length = rs.GetReal("length", 4000, 300, None) #Generate unique name for the Beam name = create_id() #Create Beam model.rule_create_beam(beam_frame, length, 100, 100, name) #Save Derivation (Model is also saved) derivation.to_json(rhino_UI_utilities.get_json_file_location(), pretty=True) #Visualization artist = MeshArtist(None, layer='BEAM::Beams_out') artist.clear_layer() for beam in model.beams: artist = MeshArtist( beam.mesh, layer='BEAM::Beams_out' ) #.mesh is not ideal fix in beam and assemble class artist.draw_faces(join_faces=True) return 0
def RunCommand(is_interactive): """Interactive Rhino Command Creates 90 Lap joint on a seleceted Beam Return: ------ None """ #load Derivation and model derivation = Derivation.from_json(rhino_UI_utilities.get_json_file_location()) model = derivation.get_next_step() #Select mesh Obj_ref = rs.GetObject(message = "select mesh(es)", filter = 32, preselect = False, subobjects = True) selected_beam_name = (rs.ObjectName(Obj_ref)[:-5]) #Loop through all beams in model to identify the selected beam selected_beam = None for beam in model.beams: if(beam.name == selected_beam_name): selected_beam = beam break assert (selected_beam != None) #list of user inputs(face needs to be implemented through UI) face_id = rs.GetInteger("face_id",None,0,5) helper = UI_helpers() joint_point = helper.Get_SelectPointOnMeshEdge("Select mesh edge","Pick point on edge") ext_start = rs.GetReal("extension start ",200,None,None) ext_end = rs.GetReal("extension end ",200,None,None) name = create_id() #adding joints to selected Beam #joint_distance_from_start = Get_distancefromBeamYZFrame(selected_beam,joint_point) joint_distance_from_start = selected_beam.Get_distancefromBeamYZFrame(joint_point) match_beam_origin = model.rule_90lap(selected_beam,joint_distance_from_start,face_id,ext_start,ext_end,name) #Save Derivation (Model is also saved) derivation.to_json(rhino_UI_utilities.get_json_file_location(), pretty = True) #Visualization viz_point = [] for pt in match_beam_origin: a = (pt[0],pt[1],pt[2]) viz_point.append({ 'pos': a, 'color': (0,255,0) }) #Visualization artist = MeshArtist(None, layer ='BEAM::Beams_out') artist.clear_layer() artist.draw_points(viz_point) for beam in model.beams: artist = MeshArtist(beam.mesh, layer ='BEAM::Beams_out')#.mesh is not ideal fix in beam and assemble class artist.draw_faces(join_faces=True)
def add_instrument(): content = request.form new_instrument = Instrument(content) instrument_id = create_id() instruments_db[instrument_id] = new_instrument response = {"instrumentId": instrument_id} return app.response_class(response=json.dumps(response), status=200, mimetype='application/json')