def get_wing_reference_quantities(wing_name=None, wing_id=None): """ Gets wing reference area, reference span, and reference chord (sref, bref, cref) from the TotalArea, TotalSpan, and TotalChord properties of Wing component :param wing_name: Name of the wing (will find the first wing with this name) :param wing_id: ID of the wing object, if None wing name will be used to find the wing id. Wing ID takes precedence over wing_name :return: sref, bref, and cref """ # Check that the wing_name and wing_id are not both none if wing_name is None and wing_id is None: raise ValueError("wing_name and wing_id cannot both be None") # If wing_id is None, then use wing name to find the wing id if wing_id is None: found_wing_id = vsp.FindGeom(wing_name, 0) if not found_wing_id: raise ValueError( "could not find wing with name \"{}\"".format(wing_name)) wing_id = found_wing_id # Get reference parameters # TODO: Error check that the wing_id is actually the id to a wing component bref = vsp.GetParmVal(wing_id, "TotalSpan", "WingGeom") sref = vsp.GetParmVal(wing_id, "TotalArea", "WingGeom") cref = vsp.GetParmVal(wing_id, "TotalChord", "WingGeom") return sref, bref, cref
vsp.SetParmVal(y_loc_id, 1.0) # Change X Location vsp.SetParmVal(pod_id, "X_Location", "XForm", 3.0) # Change Symmetry sym_flag_id = vsp.GetParm(pod_id, "Sym_Planar_Flag", "Sym") vsp.SetParmVal(sym_flag_id, vsp.SYM_XZ) # Copy Pod Geom vsp.CopyGeomToClipboard(pod_id) vsp.PasteGeomClipboard(fuse_id) # make fuse parent # Set Name vsp.SetGeomName(pod_id, "Original_Pod") second_pod_id = vsp.FindGeom("Pod", 0) # Change Location and Symmetry vsp.SetParmVal(second_pod_id, "Sym_Planar_Flag", "Sym", 0) vsp.SetParmVal(second_pod_id, "Y_Location", "XForm", 0.0) vsp.SetParmVal(second_pod_id, "Z_Location", "XForm", 1.0) fname = "apitest1.vsp3" vsp.WriteVSPFile(fname) geoms = vsp.FindGeoms() print("All geoms in Vehicle.") print(geoms)