Sorry about that, I was having trouble posting earlier. Yes it's for steel design, here's the code and dynamo file:
import clr
clr.AddReferenceToFileAndPath(r"C:\Program Files\Dynamo1.0.0\Dynamo\Dynamo Core\1.0\ProtoGeometry.dll")
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN[0]
Span=IN[1]
NSpans=IN[2]
h=IN[3]
DefaultSection=IN[4]
Releases=IN[5]
LiveLoad=IN[6]
NPoints=NSpans*2+1
Lx=NSpans+1
x1=[i*(Span/NSpans) for i in range(Lx)]
x2_=x1[0:NSpans]
x2=[i+(Span/(2*NSpans)) for i in x2_]
z1=[]
lll=NSpans+1
z1=[0 for i in range(lll)]
z2=[]
z2=[h for i in range(NSpans)]
x1.extend(x2)
z1.extend(z2)
XCoords=x1
ZCoords=z1
# add Robot Structural Analysis API reference
from System import Environment
# get the current user folder i.e C:\Users\<you>\AppData\Roaming
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
# add the reference to the interop file shipped with the package
clr.AddReferenceToFileAndPath(r"C:\Program Files\Autodesk\Autodesk Robot Structural Analysis Professional 2016\System\Exe\Interop1.RobotOM.dll")
# add needed import to be able to use Robot Structural Analysis objects
from RobotOM import *
from System import Object
application=RobotApplicationClass()
project=application.Project
structure=project.Structure
prefs=project.Preferences
labels=structure.Labels
application=RobotApplicationClass()
project=application.Project
close=project.Close()
new=project.New(7)
active=prefs.SectionsActive
data=active.GetDatabase(1)
all=data.GetAll()
count=all.Count
sectionlist=[]
for i in range(1,count):
name=all.Get(i)
if "W 200x15" in name:
if labels.Exist(3,name)==0:
if "F" not in name:
if "T" not in name:
sectionlist=labels.Create(3,name)
labels.Store(sectionlist)
materials=prefs.Materials.SetDefault(1,"STEEL 350W")
view=project.ViewMngr
view1=view.GetView(1)
view1.Projection=3
view1.Redraw(True)
project=application.Project
point=RobotGeoPoint3DClass()
j=range(3*NSpans)
structure=project.Structure
nodes=structure.Nodes
bars=structure.Bars
#create nodes
for i in j[0:NPoints]:
nodes.Create(i+1,XCoords[i],0,ZCoords[i])
#create bars
#bottom
for i in j[1:NSpans+1]:
bars.Create(i,i,i+1)
#top
for i in j[NSpans+1:NPoints-1]:
bars.Create(i,i+1,i+2)
#diagonals
for i in j[2*NSpans:3*NSpans]:
bars.Create(i,i-2*NSpans+1,i-NSpans+2)
bars.Create(i+NSpans,i-2*NSpans+2,i-NSpans+2)
#create supports
labels=structure.Labels
pin1=labels.Create(0,"Roller X")
pin1.Data.UX=0
pin1.Data.UY=1
pin1.Data.UZ=1
pin1.Data.RX=1
pin1.Data.RY=0
pin1.Data.RZ=1
labels.Store(pin1)
nodes.Get(1).SetLabel(0,"Pinned")
nodes.Get(NSpans+1).SetLabel(0,"Roller X")
NBars=bars.GetAll().Count
j=range(NBars)
for i in j:
bar=bars.Get(i+1)
bar.SetLabel(3,DefaultSection)
bar.SetLabel(4,Releases)
labels=structure.Labels
cases=structure.Cases
#delete existing load cases
simple=structure.Selections.CreatePredefined(2)
combo=structure.Selections.CreatePredefined(3)
code=structure.Selections.CreatePredefined(4)
cases.DeleteMany(simple)
cases.DeleteMany(combo)
cases.DeleteMany(code)
#selfweight load case
SW1=cases.CreateSimple(1,"SelfWeight",0,1)
SWRecord=SW1.Records.New(7)
SWGetRecord=SW1.Records.Get(1)
SWGetRecord.SetValue(2,-1)
SWGetRecord.SetValue(15, 1)
#live load case
LL1=cases.CreateSimple(2,"LiveLoad1",1,1)
LL1Record=LL1.Records.New(0)
LL1GetRecord=LL1.Records.Get(1)
LL1GetRecord.SetValue(2,LiveLoad*-1000)
LL1GetRecord.Objects.FromText(3)
#load combinations
combogen=cases.CodeCmbEngine
combogen.Params.GenType=2
gen=combogen.Generate()
application.Preferences.multiprocessing=1
calca=project.CalcEngine
anaparams=calca.AnalysisParams
anaparams.IgnoreWarnings=1
anaparams.EquationSolvingMethod=7
calcproject=calca.Calculate()
dim=project.DimServer
allbars=bars.GetAll()
members=dim.MembersService
gen=members.Generate(allbars)
connect=dim.Connection
#define groups
groups=dim.GroupsService
g1=groups.New(0,1)
g1.Name="Chords"
g1.Material="STEEL 350W"
strm=connect.GetStream()
strm.Clear()
strm.WriteText("1 2 3 4 5 6 7")
g1.SetMembList(strm)
grpprof=connect.GetGrpProfs()
grpprof.Clear()
strm.Clear()
strm.WriteText("W")
grpprof.SetFamilies("CISC",strm)
g1.SetProfs(grpprof)
groups.Save(g1)
g2=groups.New(0,1)
g2.Name="Diagonals"
g2.Material="STEEL 350W"
clrstrm=strm.Clear()
strm.WriteText("8 9 10 11 12 13 14 15")
g2.SetMembList(strm)
g2.SetProfs(grpprof)
groups.Save(g2)
calc=dim.CalculEngine
calcpars=calc.GetCalcParam()
calcconfs=calc.GetCalcConf()
strm.Clear()
calcconfs.SetParamValue(3,0.9)
strm.WriteText("1 2")
#for memeber verification calcpars.SetObjsList(1,strm)
#for group verification calcpars.SetObjsList(2,strm)
calcpars.SetObjsList(3,strm)
calcpars.SetLimitState(1,1) #ULS on
calcpars.SetLimitState(2,0) #SLS off
strm.Clear()
calcpars.SetLoadsList(strm)
optpars=calcpars.GetOptimParam()
optpars.Optimization=1
optpars.SetOption(1,1)
optpars.SetOption(2,1)
optpars.SetLimit(2,0.5)
optpars.SetOption(3,1)
optpars.SetLimit(3,0.1)
optpars.SetOption(4,1)
optpars.SetLimit(4,0.01)
optpars.SetOption(5,0)
optpars.SetLimit(5,0.01)
optpars.SetOption(6,0)
optpars.SetOption(7,0)
calcpars.SetOptimParam(optpars)
calc.SetCalcParam(calcpars)
calc.SetCalcConf(calcconfs)
calc.Solve(None)