function [w_conc, w_steel] = sapapi(FloorCoord, bayX, bayY, s, h, bayx_num, bayy_num, bayx_info, bayy_info, wall_thickness, nx, ny, columnLine, Bx, By) fc = 5; %ksi (concrete) fy = 50; %ksi (steel) floor_thickness = 10; % Floor thickness in inches %% SAP2000 API Initialization feature('COM_SafeArraySingleDim', 1); % Pass data to Sap2000 as one-dimensional arrays feature('COM_PassSafeArrayByRef', 1); % Pass non-scalar arrays to Sap2000 API by reference SapObject = actxserver('sap2000v15.SapObject'); % Create SAP2000 object SapObject.ApplicationStart; % Start SAP2000 application ret = SapObject.Hide; % Hide SAP from displaying on screen %ret = SapObject.Unhide; % Unhide SAP from displaying on screen SapModel = SapObject.SapModel; % Create SapModel object ret = SapModel.InitializeNewModel; % Initialize model ret = SapModel.File.NewBlank; % Create new blank model %% Material Definition ret = SapModel.PropMaterial.Delete('4000Psi'); ret = SapModel.PropMaterial.Delete('A992fy50'); ret = SapModel.PropMaterial.SetMaterial('Mat_steel', 1, -1); ret = SapModel.PropMaterial.SetMaterial('Mat_floor', 2, -1); ret = SapModel.PropMaterial.SetMaterial('Mat_wall', 2, -1); ret = SapModel.SetPresentUnits(3); ret = SapModel.PropMaterial.SetOSteel_1('Mat_steel', fy, 68, 60, 70, 1, 0, 0.02, 0.1, 0.2, -0.1); ret = SapModel.PropMaterial.SetONoDesign('Mat_floor'); ret = SapModel.PropMaterial.SetOConcrete_1('Mat_wall', fc, false, 0, 1, 0, 0.0022, 0.0052, -0.1); ret = SapModel.SetPresentUnits(4); %% Setting Groups ret = SapModel.GroupDef.SetGroup('Group_steelcol'); ret = SapModel.GroupDef.SetGroup('Group_beam_mom'); ret = SapModel.GroupDef.SetGroup('Group_beam_pin'); ret = SapModel.GroupDef.SetGroup('Group_brace'); ret = SapModel.GroupDef.SetGroup('Group_gravitycol'); ret = SapModel.GroupDef.SetGroup('Group_floor'); ret = SapModel.GroupDef.SetGroup('Group_wall'); for i = 1:(s+1) str1 = 'Group_level_'; str2 = num2str(i-1); str = strcat(str1,str2); ret = SapModel.GroupDef.SetGroup(str); end %% Property Definition ret = SapModel.PropArea.SetShell_1('Prop_floor', 5, true, 'Mat_floor', 0, (floor_thickness/12), (floor_thickness/12), -1);% Defining floor area property ret = SapModel.PropArea.SetShell_1('Prop_wall', 1, true, 'Mat_wall', 0, (wall_thickness/12), (wall_thickness/12), -1);% Defining wall area property ret = SapModel.PropArea.SetShellDesign('Prop_wall', 'Mat_wall', 2, (1.5/12), (2.5/12), (1.5/12), (2.5/12)); % Assigning design parameters for walls %Defining Auto-select list for Steel I shapes SteelI = {'W36X441'; 'W36X302'; 'W36X231'; 'W36X194'; 'W36X150'; 'W33X318'; 'W33X221'; 'W33X141'; 'W30X357'; 'W30X235'; 'W30X148'; 'W30X108'; 'W27X368'; 'W27X258'; 'W27X178'; 'W27X114'; 'W24X370'; 'W24X250'; 'W24X176'; 'W24X117'; 'W24X84'; 'W24X55'; 'W21X147'; 'W21X101'; 'W21X68'; 'W21X57'; 'W18X283'; 'W18X192'; 'W18X130'; 'W18X86'; 'W18X60'; 'W18X40'; 'W16X77'; 'W16X45'; 'W16X26'; 'W14X550'; 'W14X398'; 'W14X283'; 'W14X193'; 'W14X132'; 'W14X90'; 'W14X61'; 'W14X38'; 'W14X22'}; [n, temp] = size(SteelI); for i =1:n ret = SapModel.PropFrame.ImportProp(SteelI{i}, 'Mat_steel', 'AISC13.pro', SteelI{i}); end ret = SapModel.PropFrame.SetAutoSelectSteel('Auto_SteelI', n, SteelI, 'W14X22'); %Defining Auto-select list for Steel double angles Steel2L = {'2L3X3X1/2'; '2L3X3X3/8'; '2L4X4X1/2'; '2L4X4X3/8'; '2L4X4X7/16'; '2L6X6X1';... '2L6X6X3/8'; '2L6X6X5/16'; '2L6X6X7/8'; '2L8X8X1/2'; '2L8X8X7/8'; '2L8X8X9/16';}; [n, temp] = size(Steel2L); for i =1:n ret = SapModel.PropFrame.ImportProp(Steel2L{i}, 'Mat_steel', 'AISC13.pro', Steel2L{i}); end ret = SapModel.PropFrame.SetAutoSelectSteel('Auto_Steel2L', n, Steel2L, '2L3X3X1/2'); %% Modelling Floors % Creating area objects to define floors for i = 1:s x = transpose(FloorCoord{i,1}); y = transpose(FloorCoord{i,2}); z = transpose(FloorCoord{i,3}); ret = SapModel.AreaObj.AddByCoord(4, x, y, z, num2str(i)); ret = SapModel.AreaObj.SetGroupAssign(num2str(i), 'Group_floor'); % Assigning floor plane to 'Group_floor' end %% Creating bayxmain and bayymain Matrices [bayx_num_temp, temp] = size(bayx_info); [bayy_num_temp, temp] = size(bayy_info); bayxmain = cell(bayx_num_temp,s,4); % bayX reformatted to omit unused bays bayymain = cell(bayy_num_temp,s,4); % bayY reformatted to omit unused bays counter = 1; counter2 = 0; columnLine_temp = zeros((bayx_num_temp*2)+(bayy_num_temp*2),2); for i = 1:bayx_num_temp for j = 1:bayx_num if j == bayx_info(i,1) for k = 1:s bayxmain(counter,k,1) = bayX(j,k,1); bayxmain(counter,k,2) = bayX(j,k,2); bayxmain(counter,k,3) = bayX(j,k,3); bayxmain(counter,k,4) = bayX(j,k,4); columnLine_temp(counter2+1,1) = bayxmain{counter,k,1}(1); columnLine_temp(counter2+1,2) = bayxmain{counter,k,1}(2); columnLine_temp(counter2+2,1) = bayxmain{counter,k,2}(1); columnLine_temp(counter2+2,2) = bayxmain{counter,k,2}(2); end counter = counter + 1; counter2 = counter2 + 2; end end end counter = 1; for i = 1:bayy_num_temp for j = 1:bayy_num if j == bayy_info(i,1) for k = 1:s bayymain(counter,k,1) = bayY(j,k,1); bayymain(counter,k,2) = bayY(j,k,2); bayymain(counter,k,3) = bayY(j,k,3); bayymain(counter,k,4) = bayY(j,k,4); columnLine_temp(counter2+1,1) = bayymain{counter,k,1}(1); columnLine_temp(counter2+1,2) = bayymain{counter,k,1}(2); columnLine_temp(counter2+2,1) = bayymain{counter,k,2}(1); columnLine_temp(counter2+2,2) = bayymain{counter,k,2}(2); end counter = counter + 1; counter2 = counter2 + 2; end end end %% Modelling Lateral Elements Surf_wall = 0; counter_elem_p = s; counter_elem_f = 0; for i = 1:bayx_num_temp for j = 1:s c_b = 0; c_t = c_b + bayx_info(i,4); b_b = c_t; b_t = b_b + bayx_info(i,3); m_b = b_t; m_t = m_b + bayx_info(i,2); if j <= c_t x = [(bayxmain{i,j,1}(1));(bayxmain{i,j,2}(1));(bayxmain{i,j,3}(1));(bayxmain{i,j,4}(1))]; y = [(bayxmain{i,j,1}(2));(bayxmain{i,j,2}(2));(bayxmain{i,j,3}(2));(bayxmain{i,j,4}(2))]; z = [(bayxmain{i,j,1}(3));(bayxmain{i,j,2}(3));(bayxmain{i,j,3}(3));(bayxmain{i,j,4}(3))]; ret = SapModel.AreaObj.AddByCoord(4, x, y, z, num2str(counter_elem_p + 1), 'Prop_wall', num2str(counter_elem_p + 1)); % Shear wall ret = SapModel.AreaObj.SetGroupAssign(num2str(counter_elem_p + 1), 'Group_wall'); Surf_wall_temp = ((bayxmain{i,j,2}(1)) - (bayxmain{i,j,1}(1)))*h; Surf_wall = Surf_wall + Surf_wall_temp; counter_elem_p = counter_elem_p + 1; end if j <= b_t && j > c_t ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,1}(1)), (bayxmain{i,j,1}(2)), (bayxmain{i,j,1}(3)), (bayxmain{i,j,4}(1)), (bayxmain{i,j,4}(2)), (bayxmain{i,j,4}(3)), num2str(counter_elem_f + 1), 'Auto_SteelI', num2str(counter_elem_f + 1)); % Left Column ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,2}(1)), (bayxmain{i,j,2}(2)), (bayxmain{i,j,2}(3)), (bayxmain{i,j,3}(1)), (bayxmain{i,j,3}(2)), (bayxmain{i,j,3}(3)), num2str(counter_elem_f + 2), 'Auto_SteelI', num2str(counter_elem_f + 2)); % Right Column ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,1}(1)), (bayxmain{i,j,1}(2)), (bayxmain{i,j,1}(3)), (bayxmain{i,j,3}(1)), (bayxmain{i,j,3}(2)), (bayxmain{i,j,3}(3)), num2str(counter_elem_f + 3), 'Auto_Steel2L', num2str(counter_elem_f + 3)); % Brace #1 ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,2}(1)), (bayxmain{i,j,2}(2)), (bayxmain{i,j,2}(3)), (bayxmain{i,j,4}(1)), (bayxmain{i,j,4}(2)), (bayxmain{i,j,4}(3)), num2str(counter_elem_f + 4), 'Auto_Steel2L', num2str(counter_elem_f + 4)); % Brace #2 ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,3}(1)), (bayxmain{i,j,3}(2)), (bayxmain{i,j,3}(3)), (bayxmain{i,j,4}(1)), (bayxmain{i,j,4}(2)), (bayxmain{i,j,4}(3)), num2str(counter_elem_f + 5), 'Auto_SteelI', num2str(counter_elem_f + 5)); % Beam ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 1), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 2), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 3), 'Group_brace'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 4), 'Group_brace'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 5), 'Group_beam_pin'); counter_elem_f = counter_elem_f + 5; end if j <= m_t && j > b_t ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,1}(1)), (bayxmain{i,j,1}(2)), (bayxmain{i,j,1}(3)), (bayxmain{i,j,4}(1)), (bayxmain{i,j,4}(2)), (bayxmain{i,j,4}(3)), num2str(counter_elem_f + 1), 'Auto_SteelI', num2str(counter_elem_f + 1)); % Left Column ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,2}(1)), (bayxmain{i,j,2}(2)), (bayxmain{i,j,2}(3)), (bayxmain{i,j,3}(1)), (bayxmain{i,j,3}(2)), (bayxmain{i,j,3}(3)), num2str(counter_elem_f + 2), 'Auto_SteelI', num2str(counter_elem_f + 2)); % Right Column ret = SapModel.FrameObj.AddByCoord((bayxmain{i,j,3}(1)), (bayxmain{i,j,3}(2)), (bayxmain{i,j,3}(3)), (bayxmain{i,j,4}(1)), (bayxmain{i,j,4}(2)), (bayxmain{i,j,4}(3)), num2str(counter_elem_f + 3), 'Auto_SteelI', num2str(counter_elem_f + 3)); % Beam ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 1), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 2), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 3), 'Group_beam_mom'); counter_elem_f = counter_elem_f + 3; end end end for i = 1:bayy_num_temp for j = 1:s c_b = 0; c_t = c_b + bayy_info(i,4); b_b = c_t; b_t = b_b + bayy_info(i,3); m_b = b_t; m_t = m_b + bayy_info(i,2); if j <= c_t x = [(bayymain{i,j,1}(1));(bayymain{i,j,2}(1));(bayymain{i,j,3}(1));(bayymain{i,j,4}(1))]; y = [(bayymain{i,j,1}(2));(bayymain{i,j,2}(2));(bayymain{i,j,3}(2));(bayymain{i,j,4}(2))]; z = [(bayymain{i,j,1}(3));(bayymain{i,j,2}(3));(bayymain{i,j,3}(3));(bayymain{i,j,4}(3))]; ret = SapModel.AreaObj.AddByCoord(4, x, y, z, num2str(counter_elem_p + 1), 'Prop_wall', num2str(counter_elem_p + 1)); % Shear wall ret = SapModel.AreaObj.SetGroupAssign(num2str(counter_elem_p + 1), 'Group_wall'); Surf_wall_temp = ((bayymain{i,j,2}(2)) - (bayymain{i,j,1}(2)))*h; Surf_wall = Surf_wall + Surf_wall_temp; counter_elem_p = counter_elem_p + 1; end if j <= b_t && j > c_t ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,1}(1)), (bayymain{i,j,1}(2)), (bayymain{i,j,1}(3)), (bayymain{i,j,4}(1)), (bayymain{i,j,4}(2)), (bayymain{i,j,4}(3)), num2str(counter_elem_f + 1), 'Auto_SteelI', num2str(counter_elem_f + 1)); % Left Column ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,2}(1)), (bayymain{i,j,2}(2)), (bayymain{i,j,2}(3)), (bayymain{i,j,3}(1)), (bayymain{i,j,3}(2)), (bayymain{i,j,3}(3)), num2str(counter_elem_f + 2), 'Auto_SteelI', num2str(counter_elem_f + 2)); % Right Column ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,1}(1)), (bayymain{i,j,1}(2)), (bayymain{i,j,1}(3)), (bayymain{i,j,3}(1)), (bayymain{i,j,3}(2)), (bayymain{i,j,3}(3)), num2str(counter_elem_f + 3), 'Auto_Steel2L', num2str(counter_elem_f + 3)); % Brace #1 ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,2}(1)), (bayymain{i,j,2}(2)), (bayymain{i,j,2}(3)), (bayymain{i,j,4}(1)), (bayymain{i,j,4}(2)), (bayymain{i,j,4}(3)), num2str(counter_elem_f + 4), 'Auto_Steel2L', num2str(counter_elem_f + 4)); % Brace #2 ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,3}(1)), (bayymain{i,j,3}(2)), (bayymain{i,j,3}(3)), (bayymain{i,j,4}(1)), (bayymain{i,j,4}(2)), (bayymain{i,j,4}(3)), num2str(counter_elem_f + 5), 'Auto_SteelI', num2str(counter_elem_f + 5)); % Beam ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 1), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 2), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 3), 'Group_brace'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 4), 'Group_brace'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 5), 'Group_beam_pin'); counter_elem_f = counter_elem_f + 5; end if j <= m_t && j > b_t ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,1}(1)), (bayymain{i,j,1}(2)), (bayymain{i,j,1}(3)), (bayymain{i,j,4}(1)), (bayymain{i,j,4}(2)), (bayymain{i,j,4}(3)), num2str(counter_elem_f + 1), 'Auto_SteelI', num2str(counter_elem_f + 1)); % Left Column ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,2}(1)), (bayymain{i,j,2}(2)), (bayymain{i,j,2}(3)), (bayymain{i,j,3}(1)), (bayymain{i,j,3}(2)), (bayymain{i,j,3}(3)), num2str(counter_elem_f + 2), 'Auto_SteelI', num2str(counter_elem_f + 2)); % Right Column ret = SapModel.FrameObj.AddByCoord((bayymain{i,j,3}(1)), (bayymain{i,j,3}(2)), (bayymain{i,j,3}(3)), (bayymain{i,j,4}(1)), (bayymain{i,j,4}(2)), (bayymain{i,j,4}(3)), num2str(counter_elem_f + 3), 'Auto_SteelI', num2str(counter_elem_f + 3)); % Beam ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 1), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 2), 'Group_steelcol'); ret = SapModel.FrameObj.SetGroupAssign(num2str(counter_elem_f + 3), 'Group_beam_mom'); counter_elem_f = counter_elem_f + 3; end end end %% Adding Rigid Diaphragm constraints for i = 1:(nx + 1)*(ny + 1) for j = 1:(s+1) ret = SapModel.PointObj.AddCartesian(columnLine{i,j}(1), columnLine{i,j}(2), columnLine{i,j}(3), num2str(i + (j*1000)), num2str(i + (j*1000))); str1 = 'Group_level_'; str2 = num2str(j-1); str = strcat(str1,str2); ret = SapModel.PointObj.SetGroupAssign(num2str(i + (j*1000)), str); end end for i = 1:s str1 = 'const_'; str2 = num2str(i); str = strcat(str1,str2); ret = SapModel.ConstraintDef.SetDiaphragm(str, 3); end for i = 1:s str1 = 'Group_level_'; str2 = num2str(i); str3 = 'const_'; str4 = strcat(str1,str2); str5 = strcat(str3,str2); ret = SapModel.PointObj.SetConstraint(str4, str5, 1); end %% Modifying Groups % Assigning Properties ret = SapModel.AreaObj.SetAutoMesh('Group_floor', 1, nx, ny, 0, 0, 0, 0, 0, 0, 0, true, true, false, false, 'Group_floor', false, 0, 1); % Meshing floors ret = SapModel.AreaObj.SetAutoMesh('Group_wall', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, true, true, false, false, 'Group_wall', false, 0, 1); % Meshing walls modifiers = [10000000; 10000000; 10000000; 10000000; 10000000; 10000000; 1; 1; 1; 0]; % Property modifiers for floor elements ret = SapModel.AreaObj.SetModifiers('Group_floor', modifiers, 1); % Modelling floors as infinitely stiff members % Setting restraint at foundation level Restraint = logical(zeros(6,1)); for i = 1:4 Restraint(i,1) = true(); end for i = 5:6 Restraint(i,1) = false(); end ret = SapModel.PointObj.SetRestraint('Group_level_0', Restraint, 1); % Setting restraint at for pin-pin frame objects Restraint = logical(zeros(6,1)); for i = 1:4 Restraint(i,1) = false(); end for i = 5:6 Restraint(i,1) = true(); end StartEndValue = [0;0;0;0;0;0]; ret = SapModel.FrameObj.SetReleases('Group_brace', Restraint, Restraint, StartEndValue, StartEndValue, 1); ret = SapModel.FrameObj.SetReleases('Group_beam_pin', Restraint, Restraint, StartEndValue, StartEndValue, 1); ret = SapObject.SapModel.FrameObj.SetTCLimits('Group_brace', true, 0, false, 1, 1); % Modelling braces as tension only %% Defining Load Patterns and Cases ret = SapModel.LoadPatterns.Add('WIND1', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND2', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND3', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND4', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND5', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND6', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND7', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND8', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND9', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND10', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND11', 6, 0, true); ret = SapModel.LoadPatterns.Add('WIND12', 6, 0, true); ret = SapModel.LoadPatterns.Add('QuakeX', 5, 0, true); ret = SapModel.LoadPatterns.Add('QuakeY', 5, 0, true); % Lateral Load Patterns ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND1', 1, 0, 0.8, 0.5, 1, 0, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND2', 1, 90, 0.8, 0.5, 1, 0, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND3', 1, 0, 0.8, 0.5, 2, 0.15, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND4', 1, 0, 0.8, 0.5, 2, -0.15, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND5', 1, 90, 0.8, 0.5, 2, 0.15, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND6', 1, 90, 0.8, 0.5, 2, -0.15, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND7', 1, 0, 0.8, 0.5, 3, 0, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND8', 1, 90, 0.8, 0.5, 3, 0, 0, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND9', 1, 0, 0.8, 0.5, 4, 0.15, 0.15, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND10', 1, 0, 0.8, 0.5, 4, -0.15, -0.15, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND11', 1,90, 0.8, 0.5, 4, 0.15, 0.15, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoWind.SetASCE705('WIND12', 1,90, 0.8, 0.5, 4, -0.15, -0.15, false, 0, 0, 98, 2, 1.15, 1, 0.85, 0.85); ret = SapModel.LoadPatterns.AutoSeismic.SetIBC2006('QuakeX', 1, 0.05, 1, 1, 0, false, 0, 0, 6, 2.5, 5, 1.25, 2, 0, 0, '', 0.28, 0.072, 6, 4, 1.58, 2.40); ret = SapModel.LoadPatterns.AutoSeismic.SetIBC2006('QuakeY', 2, 0.05, 1, 1, 0, false, 0, 0, 6, 2.5, 5, 1.25, 2, 0, 0, '', 0.28, 0.072, 6, 4, 1.58, 2.40); %% Defining Load Combos ret = SapModel.RespCombo.AddDesignDefaultCombos(true, false, false, false); % Defining auto load combos for steel %% Deleting Groups ret = SapModel.GroupDef.Delete('Group_brace'); ret = SapModel.GroupDef.Delete('Group_beam_pin'); ret = SapModel.GroupDef.Delete('Group_beam_mom'); %% Steel and Concrete Design Parameters ret = SapModel.DesignSteel.SetCode('AISC360-05/IBC2006'); % Setting steel design code ret = SapModel.DesignConcrete.SetCode('ACI 318-05/IBC2003'); % Setting concrete design code %% Saving and Running Model ret = SapModel.View.RefreshView(0, false()); % Refresh view, update (initialize) zoom ret = SapModel.File.Save('C:\API\API1.sdb'); % Save model ret = SapModel.Analyze.RunAnalysis(); % run model (this will create the analysis model) %% Running Steel Design ret = SapModel.DesignSteel.AISC360_05_IBC2006.SetPreference(2, 2); % Setting seismic design category ret = SapModel.DesignSteel.AISC360_05_IBC2006.SetPreference(13, 1); % Ignore seismic code ret = SapModel.DesignSteel.AISC360_05_IBC2006.SetPreference(14, 1); % Ignore special seismic load ret = SapModel.DesignSteel.AISC360_05_IBC2006.SetPreference(18, 1); % Consider deflections %% Closing Model ret = SapObject.ApplicationExit(false()); % Closing SAP2000 SapModel = 0; % Closing SAP2000 SapObject = 0; % Closing SAP2000 %% Reopening Model and Running Analysis feature('COM_SafeArraySingleDim', 1); % Pass data to Sap2000 as one-dimensional arrays feature('COM_PassSafeArrayByRef', 1); % Pass non-scalar arrays to Sap2000 API by reference SapObject = actxserver('sap2000v15.SapObject'); % Create SAP2000 object SapObject.ApplicationStart; % Start SAP2000 application %ret = SapObject.Hide; % Hide SAP from displaying on screen ret = SapObject.Unhide; % Unhide SAP from displaying on screen SapModel = SapObject.SapModel; % Create SapModel object FileName = 'C:\API\API1.sdb'; ret = SapModel.File.OpenFile(FileName); ret = SapModel.DesignSteel.StartDesign; ret = SapModel.Analyze.RunAnalysis(); % rerunning analysis %% Calculating Output Variables w_conc = Surf_wall*(wall_thickness/12)*0.145; % Weight of concrete in kips w_steel = Surf_wall*(wall_thickness/12)*0.005; % Weight of steel rebars in kips ret = SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput; ret = SapModel.Results.Setup.SetCaseSelectedForOutput('DEAD'); NumberResults = 0; LoadCase = cellstr(' '); StepType = cellstr(' '); StepNum = zeros(1,1,'double'); Fx = zeros(1,1,'double'); Fy = zeros(1,1,'double'); Fz = zeros(1,1,'double'); Mx = zeros(1,1,'double'); My = zeros(1,1,'double'); Mz = zeros(1,1,'double'); gx = zeros(1,1,'double'); gy = zeros(1,1,'double'); gz = zeros(1,1,'double'); [ret, NumberResults, LoadCase, StepType, StepNum, Fx, Fy, Fz, Mx, My, Mz, gx, gy, gz] = SapModel.Results.BaseReact(NumberResults, LoadCase, StepType, StepNum, Fx, Fy, Fz, Mx, My, Mz, gx, gy, gz); w_steel = (Fz - (Surf_wall*(wall_thickness/12)*0.150)) + w_steel; %% Closing Model ret = SapObject.ApplicationExit(false()); % Closing SAP2000 SapModel = 0; % Closing SAP2000 SapObject = 0; % Closing SAP2000 end