Hello rscassar,
I made a progress in the API script . I managed to get length of all columns and area ,but I have one problem for model.PropFrame.GetRectangle("ConcCol")
function . It only gets width ,depth of the name of section column in function . I want to get (width,depth) of all of them and to be in a tuple .
I tried to use get selected funtion . but it didn't work out for me . below is the code I done
{
import os
import sys
import comtypes.client
def get_all_frames(model):
""" Retrieves select data for all frame objects in the model."""
res = model.FrameObj.GetAllFrames()
total_frames = res[0]
z1=res[8]
z2=res[11]
length = tuple(x-y for x,y in zip(z2,z1))
print("Total frames",total_frames)
print("length",length)
def select_columns(model):
#"select all columns in model to use it later for section_area function "
select = model.FrameObj.GetSelected("ConcCol")
# columns_names=[0]
def get_section_area(model):
#""retrieves section area of frames ""
sec_area = model.PropFrame.GetRectangle("ConcCol")
width = sec_area[2]
depth = sec_area[3]
print("width",width)
print("depth",depth)
ProgramPath = r"C:\Program Files\Computers and Structures\ETABS 17\ETABS.exe"
ModelPath = r"C:\Users\Mostafa\Desktop\python_exercise\example.EDB"
helper = comtypes.client.CreateObject('ETABSv17.Helper')
helper = helper.QueryInterface(comtypes.gen.ETABSv17.cHelper)
#create API helper object
myETABSObject = helper.CreateObject(ProgramPath)
#start ETABS application
myETABSObject.ApplicationStart()
#create SapModel object
SapModel = myETABSObject.SapModel
#initialize model
ret = SapModel.InitializeNewModel()
#open an existing file
ret = SapModel.File.OpenFile(ModelPath)
#run model (this will create the analysis model)
ret = SapModel.Analyze.RunAnalysis()
# selected_objects=SapModel.SelectObj.GetSelected();
# (number_objects_selected,(object_enumeration),(object_id),return_value
result=get_all_frames(SapModel)
result2=select_columns(SapModel)
result3=get_section_area(SapModel)
}
the output is
Total frames 64
length (3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0, 3000.0)
width 375.0
depth 375.0
I need to get width and depth in tuples of all 64 frames . (not only section name in propframe function )
What do you think ?