双立柱光伏支架结构自动建模

前言

该例子是一个双立柱的光伏支架结构,对相应的一些结构形式做了简化(案例是次要的,主要是对里面的一些逻辑要有十分清晰的认识才是关键的),下面的图是单榀、平面图和三维框架结构图,对应的参数如下所示:

img

图一 立面图

img

图二 平面图

img

图三 三维图

  1. 5榀框架
  2. 每榀之间的间距是3.6m
  3. 檩条的外挑距离是0.92m
  4. 立柱南北向间距3.3m
  5. 立柱边距0.65m
  6. 斜梁最低点的高度1.8m
  7. 立柱到支撑的距离0.6m
  8. 斜梁倾角19°
  9. 前撑杆到檩条的距离:0.4m
  10. 后撑杆到檩条的距离:0.4m
  11. 檩条间距:1.4m

内容主要分为以下两部分:

  • 建模
  • 施加荷载
import os
import sys
import comtypes.client
import math
from openpyxl import Workbook


class SLiZhu:
    def __init__(self,num,jj,b1,B,A,h1,h2,ang,d1,d2,ltjj):
        self.num = int(num)#榀数
        self.jj = float(jj)#榀间距
        self.b1 = float(b1)#榀外挑距离
        self.B = float(B)#立柱间距
        self.A = float(A)#立柱边距
        self.h1 = float(h1)#斜梁最低点的高度
        self.h2= float(h2)#立柱到支撑的距离
        self.ang= float(ang)*3.1415926/180#斜梁倾角
        self.d1=float(d1)#前撑杆到第一根檩条的距离
        self.d2=float(d2)#后撑杆到第三根檩条的距离
        self.ltjj = ltjj #檩条间距
        
    def createmodel(self):
        SapObject = comtypes.client.GetActiveObject("CSI.SAP2000.API.SapObject")
        SapModel = SapObject.SapModel
        ret = SapModel.SetPresentUnits(6)
        ##'add cold formed material
        matName = "ColdFormed" 
        ret = SapModel.PropMaterial.SetMaterial(matName,5, -1)
        rho = 7.850  # 材料的质量密度
        ret = SapModel.PropMaterial.SetWeightAndMass(matName, 2, rho)  # 设置材料的重度

        e = 2.034e8  # 弹性模量
        mu = 0.33  # 泊松比
        alpha = 1.17e-5  # 线膨胀系数
        ret = SapModel.PropMaterial.SetMPIsotropic(matName, e, mu, alpha)
        ret = SapModel.PropFrame.SetPipe("column",matName, 60e-3,2.0e-3)
        ret = SapModel.PropFrame.SetColdC("column2",matName,260e-3,75e-3,2.5e-3, 0,20e-3)
        ret = SapModel.PropFrame.SetColdBox("column1",matName,100e-3,50e-3,2.0e-3,0)
        ret = SapModel.PropFrame.SetColdC("beam",matName,100e-3,50e-3,2e-3, 0,20e-3)
        ret = SapModel.PropFrame.SetColdC("LT",matName,80e-3,40e-3,2e-3, 0,20e-3)
        ret = SapModel.PropFrame.SetColdC("QXC",matName,60e-3,40e-3,1.8e-3, 0,10e-3)
        ret = SapModel.PropFrame.SetColdC("HXC",matName,60e-3,40e-3,1.8e-3, 0,10e-3)
        
        # 开始进行节点编号
        for i in range(0,self.num+2):
            if i ==0:
                #x z y
                ret =SapModel.PointObj.AddCartesian(-self.b1,0,self.h1,"","Pt%s"%(i+1))
                ret =SapModel.PointObj.AddCartesian(-self.b1,self.ltjj*math.cos(self.ang),self.h1+self.ltjj*math.sin(self.ang),"","Pt%s"%(i+2))
                ret =SapModel.PointObj.AddCartesian(-self.b1,2*self.A+self.B-self.ltjj*math.cos(self.ang),self.h1+(2*self.A+self.B-self.ltjj*math.cos(self.ang))*math.tan(self.ang),"","Pt%s"%(i+3))
                ret =SapModel.PointObj.AddCartesian(-self.b1,2*self.A+self.B,self.h1+(2*self.A+self.B)*math.tan(self.ang),"","Pt%s"%(i+4))

  
            elif i<self.num+1 and i >0:                
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),self.A,0      ,"","Pt%s"%(5+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),self.A,self.h2,"","Pt%s"%(6+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),self.A,self.h1+self.A*math.tan(self.ang),"","Pt%s"%(7+12*(i-1)))

                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),self.A + self.B,0      ,"","Pt%s"%(8+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),self.A + self.B,self.h2,"","Pt%s"%(9+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),self.A + self.B,self.h1+(self.A + self.B)*math.tan(self.ang),"","Pt%s"%(10+12*(i-1)))
                
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),0,self.h1,"","Pt%s"%(11+12*(i-1)))                
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1), self.ltjj*math.cos(self.ang) ,self.h1+self.ltjj*math.sin(self.ang) ,"","Pt%s"%(12+12*(i-1)))                
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),(self.ltjj+self.d1)*math.cos(self.ang),self.h1+(self.ltjj+self.d1)*math.sin(self.ang),"","Pt%s"%(13+12*(i-1)))
                
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),2*self.A+self.B-(self.ltjj + self.d2)*math.cos(self.ang),self.h1+(2*self.A+self.B-(self.ltjj + self.d2)*math.cos(self.ang))*math.tan(self.ang),"","Pt%s"%(14+12*(i-1)))                
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),2*self.A+self.B-self.ltjj*math.cos(self.ang),self.h1+(2*self.A+self.B-self.ltjj*math.cos(self.ang))*math.tan(self.ang) ,"","Pt%s"%(15+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(i-1),2*self.A+self.B                             ,self.h1+(2*self.A+self.B)*math.tan(self.ang) ,"","Pt%s"%(16+12*(i-1)))
            elif i == self.num+1:
                ret =SapModel.PointObj.AddCartesian(self.jj*(self.num-1)+self.b1,0                           , self.h1,"","Pt%s"%(5+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(self.num-1)+self.b1,self.ltjj*math.cos(self.ang), self.h1+self.ltjj*math.sin(self.ang),"","Pt%s"%(6+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(self.num-1)+self.b1,2*self.A+self.B-self.ltjj*math.cos(self.ang) , self.h1+(2*self.A+self.B-self.ltjj*math.cos(self.ang))*math.tan(self.ang),"","Pt%s"%(7+12*(i-1)))
                ret =SapModel.PointObj.AddCartesian(self.jj*(self.num-1)+self.b1,2*self.A+self.B,self.h1+(2*self.A+self.B)*math.tan(self.ang),"","Pt%s"%(8+12*(i-1)))

        ret = SapModel.SetPresentUnits(6)
        # 开始进行单元编号,采用首尾两节点确定一个单元的编号方式
        # 对首段悬挑檩条进行编号
        ret= SapModel.FrameObj.AddByPoint("Pt1","Pt11","1","LT","1")
        ret= SapModel.FrameObj.SetLocalAxes("1",self.ang*180/3.14)
        ret= SapModel.FrameObj.AddByPoint("Pt2","Pt12","2","LT","2")
        ret= SapModel.FrameObj.SetLocalAxes("2",self.ang*180/3.14)
        ret = SapModel.FrameObj.AddByPoint("Pt3","Pt15","3","LT","3")
        ret= SapModel.FrameObj.SetLocalAxes("3",self.ang*180/3.14)
        ret = SapModel.FrameObj.AddByPoint("Pt4","Pt16","4","LT","4")
        ret= SapModel.FrameObj.SetLocalAxes("4",self.ang*180/3.14)
        
        # 第一榀框架的四段立柱及与梁相交位置的弯矩释放
        ret = SapModel.FrameObj.AddByPoint("Pt5","Pt6","5","column","5")
        ret = SapModel.FrameObj.AddByPoint("Pt6","Pt7","6","column","6")        
        ret = SapModel.FrameObj.SetReleases("6",[False,False,False,False,False,False],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])
        ret = SapModel.FrameObj.AddByPoint("Pt8","Pt9","7","column","7")
        ret = SapModel.FrameObj.AddByPoint("Pt9","Pt10","8","column","8")
        ret = SapModel.FrameObj.SetReleases("8",[False,False,False,False,False,False],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])
        # 第一榀框架的7段斜梁的单元编号
        ret = SapModel.FrameObj.AddByPoint("Pt11","Pt7","9","beam","9")
        ret = SapModel.FrameObj.AddByPoint("Pt7","Pt12","10","beam","10")
        ret = SapModel.FrameObj.AddByPoint("Pt12","Pt13","11","beam","11")
        ret = SapModel.FrameObj.AddByPoint("Pt13","Pt14","12","beam","12")
        ret = SapModel.FrameObj.AddByPoint("Pt14","Pt15","13","beam","13")
        ret = SapModel.FrameObj.AddByPoint("Pt15","Pt10","14","beam","14")
        ret = SapModel.FrameObj.AddByPoint("Pt10","Pt16","15","beam","15")
        # 第一榀框架的两段支撑的单元编号以及相应的弯矩释放
        ret = SapModel.FrameObj.AddByPoint("Pt6","Pt13","16","QXC","16")
        ret = SapModel.FrameObj.AddByPoint("Pt9","Pt14","17","HXC","17")        
        ret = SapModel.FrameObj.SetReleases("16",[False,False,False,True,True,True],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])        
        ret = SapModel.FrameObj.SetReleases("17",[False,False,False,True,True,True],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])
        # 当只有一榀框架的时候
        if self.num ==1:
            ret = SapModel.FrameObj.AddByPoint("Pt11","Pt17","LT","18")
            ret= SapModel.FrameObj.SetLocalAxes("18",self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt12","Pt18","LT","19")
            ret= SapModel.FrameObj.SetLocalAxes("19",self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt15","Pt19","LT","20")
            ret= SapModel.FrameObj.SetLocalAxes("20",self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt16","Pt20","LT","21")
            ret= SapModel.FrameObj.SetLocalAxes("21",self.ang*180/3.14)
        # 对第j+1第榀框架进行编号,以下的这个循环包含第二榀到第5榀的部分,j值取值1~4(含)
        for j in range(1,self.num):
            # 对第j+1榀的柱进行单元编号
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(5+12*j),"Pt%d"%(6+12*j),"%d"%(1+17*j),"column","%d"%(1+17*j))    
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(6+12*j),"Pt%d"%(7+12*j),"%d"%(2+17*j),"column","%d"%(2+17*j))
            ret = SapModel.FrameObj.SetReleases("%d"%(2+17*j),[False,False,False,False,False,False],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])

            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(8+12*j),"Pt%d"%( 9+12*j),"%d"%(3+17*j),"column","%d"%(3+17*j))    
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(9+12*j),"Pt%d"%(10+12*j),"%d"%(4+17*j),"column","%d"%(4+17*j))
            ret = SapModel.FrameObj.SetReleases("%d"%(4+17*j),[False,False,False,False,False,False],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])
            # 对第j+1榀的梁进行单元编号
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(11+12*j),"Pt%d"%(7+12*j),"%d"%(5+17*j),"beam","%d"%(5+17*j))
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(7+12*j),"Pt%d"%(12+12*j),"%d"%(6+17*j),"beam","%d"%(6+17*j))
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(12+12*j),"Pt%d"%(13+12*j),"%d"%(7+17*j),"beam","%d"%(7+17*j))
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(13+12*j),"Pt%d"%(14+12*j),"%d"%(8+17*j),"beam","%d"%(8+17*j))
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(14+12*j),"Pt%d"%(15+12*j),"%d"%(9+17*j),"beam","%d"%(9+17*j))
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(15+12*j),"Pt%d"%(10+12*j),"%d"%(10+17*j),"beam","%d"%(10+17*j))
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(10+12*j),"Pt%d"%(16+12*j),"%d"%(11+17*j),"beam","%d"%(11+17*j))
            # 对第j+1榀的支撑进行单元编号
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(6+12*j),"Pt%d"%(13+12*j),"%d"%(12+17*j),"QXC","%d"%(12+17*j))            
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(9+12*j),"Pt%d"%(14+12*j),"%d"%(13+17*j),"HXC","%d"%(13+17*j))
            ret = SapModel.FrameObj.SetReleases("%d"%(12+17*j),[False,False,False,True,True,True],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])
            ret = SapModel.FrameObj.SetReleases("%d"%(13+17*j),[False,False,False,True,True,True],[False,False,False,False,True,True], [False,False,False,False,True,True],[False,False,False,False,True,True])
            # 对第j榀和第j+1榀之间的檩条进行编号
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(11+12*(j-1)),"Pt%d"%(23+12*(j-1)),"%d"%(14+17*j),"LT","%d"%(14+17*j))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(14+17*j),self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(12+12*(j-1)),"Pt%d"%(24+12*(j-1)),"%d"%(15+17*j),"LT","%d"%(15+17*j))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(15+17*j),self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(15+12*(j-1)),"Pt%d"%(27+12*(j-1)),"%d"%(16+17*j),"LT","%d"%(16+17*j))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(16+17*j),self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt%d"%(16+12*(j-1)),"Pt%d"%(28+12*(j-1)),"%d"%(17+17*j),"LT","%d"%(17+17*j))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(17+17*j),self.ang*180/3.14)
    # 当有多榀框架的时候(对末端檩条悬挑进行编号)
        if self.num >1:
            ret = SapModel.FrameObj.AddByPoint("Pt%s"%(11+12*(self.num-1)),"Pt%s"%(5+12*(self.num)),"%d"%(1+17*self.num),"LT","%d"%(1+17*self.num))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(1+17*self.num),self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt%s"%(12+12*(self.num-1)),"Pt%s"%(6+12*(self.num)),"%d"%(2+17*self.num),"LT","%d"%(2+17*self.num))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(2+17*self.num),self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt%s"%(15+12*(self.num-1)),"Pt%s"%(7+12*(self.num)),"%d"%(3+17*self.num),"LT","%d"%(3+17*self.num))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(3+17*self.num),self.ang*180/3.14)
            ret = SapModel.FrameObj.AddByPoint("Pt%s"%(16+12*(self.num-1)),"Pt%s"%(8+12*(self.num)),"%d"%(4+17*self.num),"LT","%d"%(4+17*self.num))
            ret= SapModel.FrameObj.SetLocalAxes("%d"%(4+17*self.num),self.ang*180/3.14)

        #设置支座约束
        # k的取值在0~4之间(含)
        for k in range(self.num):
            ret = SapModel.PointObj.SetRestraint("Pt%d"%(5+12*k),[True,True,True,True,True,True])
            ret = SapModel.PointObj.SetRestraint("Pt%d"%(8+12*k),[True,True,True,True,True,True])
            
###########################################################################
    def load(self):
        SapObject = comtypes.client.GetActiveObject("CSI.SAP2000.API.SapObject")
        SapModel = SapObject.SapModel
        #设置荷载工况
        
        ret = SapModel.LoadPatterns.Add('W+x', 6, 0, True)
        ret = SapModel.LoadPatterns.Add('W-x', 6, 0, True)
        ret = SapModel.LoadPatterns.Add('S', 6, 0, True)
        ret = SapModel.LoadPatterns.Add('EX',5, 0,True)
        ret = SapObject.SapModel.LoadPatterns.AutoSeismic.SetChinese2010("EX", 1, 0.05, 2, 0, False, 0, 0, 0.3, 1, 0.04, 0.3, 1, 1)#0.04表示最大水平影响系数,0.04表示阻尼比,0.3特征周期
        
        # 对首段的4根悬挑檩条施加分布荷载,,用单元编号进行相应的定位,ii的取值从0~3(含)
        for ii in range(4):            
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(ii+1), 'DEAD', 1, 10, 0, 1, 0.16,0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(ii+1), 'W+x', 1, 2, 0, 1,-0.306,-0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(ii+1), 'W-x', 1, 2, 0, 1,0.36,0.36,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(ii+1), 'S', 1, 10, 0, 1, 0.28,0.28,)

#################################################################################
        # 对中间跨的4根檩条施加分布荷载,,用单元编号进行相应的定位,jj的取值从1~5(含)
        # 这里对单元的编号有一定的讲究:一榀框架有13个单元,之前有4个檩条单元
        # 这里如果想更加精简的话可以通过双层循环,在选定的两榀之间的4根檩条之间循环施加4种荷载工况,可以减少一定的代码量(可读性差一点)
        for jj in range(1,self.num+1):            
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(5+13*(jj+1)+4*(jj-1)), 'DEAD', 1, 10, 0, 1, 0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(6+13*(jj+1)+4*(jj-1)), 'DEAD', 1, 10, 0, 1, 0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(7+13*(jj+1)+4*(jj-1)), 'DEAD', 1, 10, 0, 1, 0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(8+13*(jj+1)+4*(jj-1)), 'DEAD', 1,10, 0, 1, 0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(5+13*(jj+1)+4*(jj-1)), 'S', 1, 10, 0, 1, 0.28, 0.28,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(6+13*(jj+1)+4*(jj-1)), 'S', 1, 10, 0, 1, 0.28, 0.28,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(7+13*(jj+1)+4*(jj-1)), 'S', 1, 10, 0, 1, 0.28, 0.28,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(8+13*(jj+1)+4*(jj-1)), 'S', 1,10, 0, 1, 0.28, 0.28,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(5+13*(jj+1)+4*(jj-1)), 'W+x', 1, 2, 0, 1,-0.306,-0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(6+13*(jj+1)+4*(jj-1)), 'W+x', 1, 2, 0, 1,-0.306,-0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(7+13*(jj+1)+4*(jj-1)), 'W+x', 1, 2, 0, 1,-0.306,-0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(8+13*(jj+1)+4*(jj-1)), 'W+x', 1, 2, 0, 1,-0.306,-0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(5+13*(jj+1)+4*(jj-1)), 'W-x', 1, 2, 0, 1,0.36,0.36,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(6+13*(jj+1)+4*(jj-1)), 'W-x', 1, 2, 0, 1,0.36,0.36,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(7+13*(jj+1)+4*(jj-1)), 'W-x', 1, 2, 0, 1,0.36,0.36,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(8+13*(jj+1)+4*(jj-1)), 'W-x', 1, 2, 0, 1,0.36,0.36,"Local")
        # 对末端的4根檩条循环添加4种荷载模式   
        # 同首段的檩条施加荷载类似,这里也可以适当的减少代码量
        if self.num >1:
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(1+17*self.num), 'DEAD', 1, 10, 0, 1, 0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(2+17*self.num), 'DEAD', 1, 10, 0, 1,0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(3+17*self.num), 'DEAD', 1, 10, 0, 1, 0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(4+17*self.num), 'DEAD', 1, 10, 0, 1, 0.16, 0.16,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(1+17*self.num), 'W+x', 1, 2, 0, 1, -0.306, -0.306,"Local")#0.153,0.306
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(2+17*self.num), 'W+x', 1, 2, 0, 1, -0.306, -0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(3+17*self.num), 'W+x', 1, 2, 0, 1, -0.306, -0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(4+17*self.num), 'W+x', 1, 2, 0, 1, -0.306, -0.306,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(1+17*self.num), 'W-x', 1, 2, 0, 1, 0.36, 0.36 ,"Local")#0.18,0.36
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(2+17*self.num), 'W-x', 1, 2, 0, 1, 0.36, 0.36,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(3+17*self.num), 'W-x', 1, 2, 0, 1, 0.36, 0.36,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(4+17*self.num), 'W-x', 1, 2, 0, 1, 0.36, 0.36,"Local")
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(1+17*self.num), 'S', 1, 10, 0, 1, 0.28, 0.28,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(2+17*self.num), 'S', 1, 10, 0, 1,0.28, 0.28,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(3+17*self.num), 'S', 1, 10, 0, 1, 0.28, 0.28,)
            ret = SapModel.FrameObj.SetLoadDistributed("%d"%(4+17*self.num), 'S', 1, 10, 0, 1, 0.28, 0.28,)
            
        #定义荷载组合
        # 组合一:ZCS_COMB1=D+W+x+0.7S
        ret = SapModel.RespCombo.Add("ZCS_COMB1", 0)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB1",0, "DEAD", 1)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB1",0, "W+x", 1)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB1",0, "S", 0.7)
      
        # 组合二:ZCS_COMB2=D+W-x+0.7S
        ret = SapModel.RespCombo.Add("ZCS_COMB2", 0)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB2",0, "DEAD", 1)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB2",0, "W-x", 1)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB2",0, "S", 0.7)
        
        # 组合三:ZCS_COMB3=D+0.6W+x+S
        ret = SapModel.RespCombo.Add("ZCS_COMB3", 0)        
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB3",0, "DEAD", 1)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB3",0, "W+x", 0.6)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB3",0, "S", 1)
        
      # 组合四:ZCS_COMB4=D+0.6W-x+S
        ret = SapModel.RespCombo.Add("ZCS_COMB4", 0)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB4",0, "DEAD", 1)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB4",0, "W-x", 0.6)
        ret = SapModel.RespCombo.SetCaseList("ZCS_COMB4",0, "S", 1)
        
        ################################################################
        # 组合一:CZL_COMB1=1.3D+1.5W+x+1.05S
        ret = SapModel.RespCombo.Add("CZL_COMB1", 0)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB1",0, "DEAD", 1.3)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB1",0, "W+x", 1.5)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB1",0, "S", 1.05)
        # 组合二:CZL_COMB2=1.3D+1.5W-x+1.05S
        ret = SapModel.RespCombo.Add("CZL_COMB2", 0)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB2",0, "DEAD", 1.3)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB2",0, "W-x", 1.5)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB2",0, "S", 1.05)
        # 组合三:CZL_COMB3=1.3D+0.9W+x+1.5S
        ret = SapModel.RespCombo.Add("CZL_COMB3", 0)        
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB3",0, "DEAD", 1.3)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB3",0, "W+x", 0.9)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB3",0, "S", 1.5)
        # 组合四:CZL_COMB4=1.3D+0.9W-x+1.5S
        ret = SapModel.RespCombo.Add("CZL_COMB4", 0)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB4",0, "DEAD", 1.3)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB4",0, "W-x", 0.9)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB4",0, "S", 1.5)
        # 组合五:CZL_COMB5=1.2D+1.3Ex+0.3W+x
        ret = SapModel.RespCombo.Add("CZL_COMB5", 0)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB5",0, "DEAD", 1.2)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB5",0, "Ex", 1.3)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB5",0, "W+x", 0.3)
        # 组合六:CZL_COMB6=1.2D+1.3Ex+0.3W-x
        ret = SapModel.RespCombo.Add("CZL_COMB6", 0)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB6",0, "DEAD", 1.2)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB6",0, "Ex", 1.3)
        ret = SapModel.RespCombo.SetCaseList("CZL_COMB6",0, "W-x",0.3)

my = SLiZhu(5,3.6,0.92,3.3,0.65,1.8,0.6,19,0.4,0.4,1.4)
my.createmodel()
my.load()

img

图四 节点编号

img

图五 单元编号

img

图六 恒荷载

img

图七 雪荷载

img

图八 风压力

img

图九 风吸力

img

图十 荷载工况

img

图十一 荷载组合

后记

以上只是涉及到自动建模的一个过程,实际上后面还有分析的过程,包括对内力的提取,进行规范的检核与输出,这一块自己还要花时间去琢磨一下,而且在理解上,每个人都有不同的理解。如果是单纯的为了节省建模的时间,其实做到这里其实已经差不多了,但是对于像其他软件比较成熟的模块来说:这样的便捷性还是不够,而且一旦有些参数变化,就需要对代码就行相应的修改,想要大面积的推广也不是特别的容易(现在已经有成熟的模块,其实没必要去折腾,但是本着学习的想法去整理也不失为一种乐趣,毕竟谁不想能够打破黑匣子,自己能够去操控)。

ToTOP