ETABs API - FrameObj.GetSection
ETABs API - FrameObj.GetSection
(OP)
I am trying to retrieve the section properties of specific frame elements with python; it seems like this should be really easy.
Sample code is shown below:
This is the error that I get:
After receiving this error, ETABs proceeds to crash and shut down, any ideas on how to solve?
Thanks!
Sample code is shown below:
CODE --> Python
Frame = "33" PropName = "" SAuto = "" x = SapModel.FrameObj.GetSection(Frame, SAuto, PropName)
This is the error that I get:
CODE --> Python
Traceback (most recent call last): File "C:/______/Desktop/Python/v1_Get_Section_Property.py", line 16, in <module> x = SapModel.FrameObj.GetSection(Frame, SAuto, PropName) File "C:\Users\____\AppData\Local\Continuum\anaconda3\lib\site-packages\comtypes\__init__.py", line 655, in call_with_inout rescode = func(self_, *args, **kw) _ctypes.COMError: (-2147417851, 'The server threw an exception.', (None, None, None, 0, None))
After receiving this error, ETABs proceeds to crash and shut down, any ideas on how to solve?
Thanks!
S&T
RE: ETABs API - FrameObj.GetSection
I wrote this a while back, it may be worth going thru. After getting the assigned section for frame '33', you need to get the type of section given by a CSi enumerator, such as 'rectangle', 'circle' 'I'. And from that you can get the section properties. There is a basic function that will extract the basic data SapModel.PropFrame.GetGeneral(name), this function will give you the general section properties.
CODE --> python
RE: ETABs API - FrameObj.GetSection
For now, I am still stuck as I can not identify the section property of frame object '33', in my case a W18x35
Is there any other API function that takes unique name and returns section property?
I am at a loss on why
CODE --> Python
CSI technical support has been of little help
S&T
RE: ETABs API - FrameObj.GetSection
Still curious why the first function does not work
S&T
RE: ETABs API - FrameObj.GetSection
S&T
RE: ETABs API - FrameObj.GetSection
CODE --> python
If you look thru the cFrameObj methods, you'll come to GetSection. The only input that is the frame name. 'PropName', 'SAuto and 'pRetVal' will be returned as output.
CODE --> python
RE: ETABs API - FrameObj.GetSection
CODE --> Python
Error code:
CODE --> Python
S&T
RE: ETABs API - FrameObj.GetSection
>> outputs = SapModel.FrameObj.GetSection(frame);
If that works than have a look at what is stored in outputs.
RE: ETABs API - FrameObj.GetSection
CODE --> Python
I appreciate all help rscassar, I will let you know what tecch support says when they get back to me.
S&T
RE: ETABs API - FrameObj.GetSection
S&T
RE: ETABs API - FrameObj.GetSection
I have the same problem with some of the API methods such as: FrameObj.GetAllFrames(), FrameObj.GetDesignOrientation(), FrameObj.GetNameList() and so on
It is interesting that when I run my code on another Laptop, all are ok and no error occurs. here is some information about both laptops:
1) win 10, Lenovo Legion5 core i7 10th Gen, Using Etabs 18.1.1 (methods do not work on this one)
2) win 10, Samsung series5 core i2 3rd Gen, Using Etabs 18.1.1 (methods work well)
I wrote the code by second laptop and when try to test the .exe file on the first one, errors appears. I found that the second laptop can not get some parameters from the SapModel and then tried to test more methods and found that happens for lots of methods in FrameObj while some of them such as GetElm or GetGUID works well. I should mention that I tested the main code by VSCode on both laptops.
I am trying to figure it out, I will share my experience here and will be glad to here from you.
Regards
RE: ETABs API - FrameObj.GetSection
I have both etabs 19.0.2 and 18.1.1 on my laptop. I ran my code using ETABs 19.0.2 and surprisingly it worked while it didn't work before! I did nothing expect reinstalling comtypes version 1.1.10
my code has two part, it can start a new instance of Etabs or can get the active object since for complex models it takes some time to analyze the model. By this, If I analyze the model one time, I can run my code for that model several times without reanalyze. I can not find out why my code can not get information about frame objects when it uses existing Etabs object, while the same code works well by opening a new instance of Etabs. Wow! FrameObj.GetAllFrame() should work always! I'm confused.
After this experience I start to check Etabs version 18.1.1 again and every thing works well!!!! the code is doing well for both cases, even open new instance of Etabs or get the active object!
So as a result, I think that there is something with comtypes and windows. I will post more if I found anything especial.
Regrads
RE: ETABs API - FrameObj.GetSection
CODE --> python
RE: ETABs API - FrameObj.GetSection
I still have problem with FrameObj.GetAllFrames() and FrameObj.GetDesignOrientation(frameName). I asked from support@csiamerica.com and will let you know if I get a proper response.
RE: ETABs API - FrameObj.GetSection
It is just required to re-register ETABS.
Here is what you need to do: (CSI response)
We suggest re-registering the ETABS API on your machine:
1. Close all instances of ETABS and any software accessing the ETABS API (e.g. Excel).
2. Open an administrative command prompt (open Command Prompt using right-click, “Run as administrator”).
3. Within the administrative command prompt, navigate to the directory of ETABS v18.1.1.
4. Within the administrative command prompt, run “UnregisterETABS.exe”.
5. Repeat steps 3 and 4 for all versions of ETABS installed on the machine.
6. Within the administrative command prompt, navigate to the installed ETABS v18.1.1.
7. Within the administrative command prompt, run “RegisterETABS.exe”.
Regrads,
RE: ETABs API - FrameObj.GetSection
S&T