Package: skyciv
The SkyCiv Pip PackageThis package provides helpful tools to create objects and interact with the SkyCiv API. These components can be used to quickly construct models by providing code completion, parameter information and examples.Note: We strongly recommend using VSCode and the Pylance plugin for VSCode. Pylance is still in preview mode and requires some polishing however, it will help provide intellisense options as seen in the image below.DocumentationThe SkyCiv API documentation can be found here:https://skyciv.com/api/v3/The Python Pip package documentation is a work in progress but for now, you can refer to theJavaScript package docswhich are not exactly the same but very similar. The main difference being that methods usesnake_casein python rather thancamelCasein JavaScript.For example,sections.loadCustomFromLibrary()in the NPM package would translate tosections.load_custom_from_library()for the Pip package.Installpip3 install skycivExampleThe recommended use of this package is by using theModel()andApiObject()classes.importskyciv# Create an instance of the Model classmodel=skyciv.Model("metric")# Nodesmodel.nodes.add(0,0,0)model.nodes.add(0,0.5,0)model.nodes.add(0,1,0)model.nodes.add(0.5,1,0)model.nodes.add(0.5,0.5,0)model.nodes.add(1,0.6,0)model.nodes.add(1,0.1,0)model.nodes.add(1.5,0.1,0)model.nodes.add(1.5,0.6,0)model.nodes.add(1.5,0,0)model.nodes.add(1.5,-0.4,0)model.nodes.add(1,-0.6,0)model.nodes.add(2,0,0)model.nodes.add(2,0.7,0)model.nodes.add(2,1,0)model.nodes.add(1.7,0.7,0)model.nodes.add(2.3,0.7,0)model.nodes.add(2.5,1,0)model.nodes.add(2.5,0.5,0)model.nodes.add(2.5,0,0)model.nodes.add(3,0.5,0)model.nodes.add(3,0,0)model.nodes.add(3.3,0.5,0)model.nodes.add(3.3,0.14,0)model.nodes.add(3.7,0.14,0)model.nodes.add(3.7,0.5,0)model.nodes.add(4,0.5,0)model.nodes.add(4,0.4,0)model.nodes.add(4,0,0)model.nodes.add(4.5,0.5,0)model.nodes.add(4.5,0,0)model.nodes.add(-0.5,0,0)model.nodes.add(3.3,0,0)model.nodes.add(3.7,0,0)model.nodes.add(4.9,0,0)# Membersmodel.members.add(1,2,1)model.members.add(2,3,1)model.members.add(3,4,1)model.members.add(4,5,1)model.members.add(5,2,1)model.members.add(6,7,1)model.members.add(7,8,1)model.members.add(8,9,1)model.members.add(8,10,1)model.members.add(10,11,1)model.members.add(11,12,1)model.members.add(15,14,1)model.members.add(14,13,1)model.members.add(16,14,1)model.members.add(14,17,1)model.members.add(18,19,1)model.members.add(19,20,1)model.members.add(19,21,1)model.members.add(21,22,1)model.members.add(24,25,1)model.members.add(25,26,1)model.members.add(26,23,1)model.members.add(23,24,1)model.members.add(27,28,1)model.members.add(28,29,1)model.members.add(28,30,1)model.members.add(30,31,1)model.members.add(32,1,2)model.members.add(1,10,2)model.members.add(10,13,2)model.members.add(13,20,2)model.members.add(20,22,2)model.members.add(22,33,2)model.members.add(33,34,2)model.members.add(34,29,2)model.members.add(29,31,2)model.members.add(31,35,2)model.members.add(24,33,None,"FFFfff","FFFfff","rigid")model.members.add(25,34,None,"FFFfff","FFFfff","rigid")# Platesmodel.plates.add([5,4,3,2],12,1,is_meshed=True)# Meshed platemodel.meshed_plates.add(1,5,4,3,2)# Sectionsmodel.sections.add_library_section(skyciv.sections.Australian_Steel_300_Grade_CHS_Grade_350_101_6x3_2_CHS,1)model.sections.add_library_section(skyciv.sections.Australian_Steel_300_Grade_Universal_beams_150_UB_14_0,1)# Materialmodel.materials.add("Structural Steel")# For metric# model.materials.add("Structural Steel", "imperial") # For imperial# model.materials.add("Structural Steel", model.settings.units.get_unit_system())  # For the model's current units# model.materials.addCustom("Custom Steel", 7850, 210000, 0.29, 300, 440, "steel") # For custom material# Supportsmodel.supports.add(32,"FFFFRR")model.supports.add(35,"FFFFRR")# Settlementsmodel.settlements.add(35,ty=-10)# Add point loadmodel.point_loads.add("m",member=3,position=30.4,y_mag=-5,load_group="LG1")model.point_loads.add("n",node=13,y_mag=1.6,load_group="LG1")model.point_loads.add("n",node=12,y_mag=-3.7,load_group="LG1")# Add momentmodel.moments.add("n",node=12,y_mag=0.3,load_group="LG1")model.moments.add("m",member=16,position=0,x_mag=-0.1,load_group="LG1")# Add distributed loadmodel.distributed_loads.add(32,y_mag_A=-10,y_mag_B=-2,position_B=100,load_group="LG1")# Pressuremodel.pressures.add(1,"global",0,0,0.1,"LG1")# Area loadmodel.area_loads.add("one_way",[23,24,25,26],1.3,"Z",column_direction=[23,26],LG="LG1")# Selfweightmodel.self_weight.add(y=-1,LG="SW1")# Make a load combinationmodel.load_combinations.add("SW1 + LG1",{"SW1":1,"LG1":1})# Create an API Objectao=skyciv.ApiObject()# Set authao.auth.username="YOUR_SKYCIV_USERNAME"ao.auth.key="YOUR_SKYCIV_API_KEY"# Set functionsao.functions.add("S3D.session.start",{"keep_open":True})ao.functions.add("S3D.model.set",{"s3d_model":model})# Uncomment the next line to run a solve as well.# ao.functions.add("S3D.model.solve", {"analysis_type": "linear"})ao.functions.add("S3D.file.save",{"name":"package-debut","path":"api/PIP/"})res=ao.request()print(res["response"])Now, we can even view the model inS3D.Sections DatabaseSection library paths for all sections can be found in theskyciv.sectionsobject.For example:By typing something like this:skyciv.sections.aus300150ub.Intellisense will offer the closest sections which you can select with autocompletion. Resulting in the path shown below.path=skyciv.sections.Australian_Steel_300_Grade_Universal_beams_150_UB_14_0# path is now equal to:["Australian","Steel (300 Grade)","Universal beams","150 UB 14.0"]Although it does not look great, this way, auto completion will ensure the string arrays are correct.Global Methodsskyciv.request(api_object, options?)Make a request to the SkyCiv API.skyciv_response=skyciv.request(api_object,options)# Do something with the responseOptions (optional dictionary)version-2 | 3(Defaults to 3)http_or_https-http | https(Defaults to https)options={"http_or_https":"http","version":3,}Manually building the API ObjectVisit theAPI docsfor instructions on how to create an instance of the SkyCiv API object.ChangelogVersionBreakingDescription2.0.4falseFixed dependency issue affecting Python 3.7 It should fix the errorTypeError: 'type' object is not subscriptableand the errorcannot import name 'Literal' from 'typing'.2.0.3falseFixed packaging bug.2.0.0Breaksmodel.plates.• Plates can now have additional attributes:diaphragm,membrane_thickness,bending_thickness,shear_thickness,holes. This may misalign inputs of existing plates.•plate.typenow defaults to"auto".1.2.0false•Materials.add()method now takes a second parameter for units. See sample above.1.1.3Breaksmodel.self_weight.•Model().setmethod now can now accept a downloaded JSON model from platform.skyciv.com/structural.• Fixed self_weight data structure.•FunctionsandFunctionclass now defaultsargsto an empty object.1.1.2false• Typos.• Improved in-code docs.• Fixed Canadian bridging channel lookup inskyciv.sections.• Therequest()method of theApiObject()will now automatically store thelast_session_idto theauth.session_idproperty of theApiObjectinstance.1.1.1false• README.md patch.1.1.0false• Added 37 new classes including theApiObject()andModel()classes.1.0.4false• Package will now only use dumps on input ifapi_objectis not a string.1.0.3false• Fixed options dictionary to be optional.1.0.2false• Updated readme.1.0.1false• Changedskyciv.request(). to print msg if SkyCiv returns error rather than throw an exception.1.0.0-Initial release.