×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

ETABS API - GetGridSys_2

ETABS API - GetGridSys_2

ETABS API - GetGridSys_2

(OP)
I'm writing some code to draw gridlines through the API using Python, but for some reason the ETABS model does doesn't reflect the data. There is no error showing in my console so it seems like the code passes.

CODE

xGrids = [0,5,15]
yGrids = [0,5,15]
xGridNames = ["1","2","3"]
yGridNames = ["A","B","C"]
xVisible = [True,True,True]
yVisible = [True,True,True]
xBubbleLoc = ["Start", "Start", "Start"]
yBubbleLoc = ["Start", "Start", "Start"]

SapModel.GridSys.GetGridSys_2("G1",0,0,0,"Cartesian",3,3,xGridNames,yGridNames,xGrids,yGrids,xVisible,yVisible,xBubbleLoc,yBubbleLoc) 

This is based on the CSI API info:

CODE

int GetGridSys_2(
	string Name,
	ref double Xo,
	ref double Yo,
	ref double RZ,
	ref string GridSysType,
	ref int NumXLines,
	ref int NumYLines,
	ref string[] GridLineIDX,
	ref string[] GridLineIDY,
	ref double[] OrdinateX,
	ref double[] OrdinateY,
	ref bool[] VisibleX,
	ref bool[] VisibleY,
	ref string[] BubbleLocX,
	ref string[] BubbleLocY 

Is anyone able to identify my issue?

RE: ETABS API - GetGridSys_2

I do not think the GetGridSys_2 allows you to draw/create gridlines, it will only return gridlines that have already been defined in the model.

Searching the API, I do not see a function that allows you to create gridlines unfortunately.

S&T

RE: ETABS API - GetGridSys_2

(OP)

Quote (sticksandtriangles)

I do not think the GetGridSys_2 allows you to draw/create gridlines, it will only return gridlines that have already been defined in the model.

Searching the API, I do not see a function that allows you to create gridlines unfortunately.

Interesting. I thought named the feature 'Get' was unusual but the inputs required seemed to make me think this method would draw grids, seeing as though it requires an array of numbers.

I have emailed CSI for official confirmation. I'll check back once I have a response.

RE: ETABS API - GetGridSys_2

(OP)
I got the following response from CSI:

(I haven't tested it yet)

Quote:

If you are using ETABS v18 or v19, you can use the cDatabaseTables functions in the API to modify the "Grid Definitions - Grid Lines" table, which can be used to change the location of gridlines. The cDatabaseTables interface is documented in the ETABS API documentation, the file "CSi API ETABS v1.chm" in the directory where ETABS v18 or v19 has been installed.

RE: ETABS API - GetGridSys_2

Looks like GridSys has getters but no setters.

CODE --> python

SapModel.GridSys.GetNameList()
Out[6]: [1, ('G1',), 0]

SapModel.GridSys.GetGridSys('G1')
Out[8]: [0.0, 0.0, 0.0, 0]

SapModel.GridSys.GetGridSysCartesian('G1')
Out[9]: 
[0.0,
 0.0,
 0.0,
 True,
 None,
 None,
 1250.0,
 0,
 4,
 ('1', '2', '3', '4'),
 (-66.7, 5753.0, 12460.0, 18050.0),
 (True, True, True, True),
 ('b', 'b', 'b', 'b'),
 5,
 ('E', 'D', 'C', 'B', 'A'),
 (-27310.0, -19810.0, -14940.0, -7493.0, -2336.0),
 (True, True, True, True, True),
 ('a', 'a', 'a', 'a', 'a'),
 0,
 (),
 (),
 (),
 (),
 (),
 (),
 (),
 0] 

There is no method GridSys.SetGridSysCartesian

RE: ETABS API - GetGridSys_2

I just started playing with the cDatabaseTables methods (for a different reason than grids) and these methods seem quite powerful.

Anything that you could manipulate in the interactive database is now available to you through the API. It took a good bit of playing around to get the functions to work though which was frustrating, not the most intuitive.

S&T

RE: ETABS API - GetGridSys_2

(OP)

Quote (sticksandtriangles)

It took a good bit of playing around to get the functions to work though which was frustrating, not the most intuitive

Any chance you can share some of your findings? What type of playing around did you have to do?

Cheers!

RE: ETABS API - GetGridSys_2

@Fracture_point, for sure. I will try out the grid systems at lunch tomorrow.

S&T

RE: ETABS API - GetGridSys_2

Below is some sample code that makes one gridline with the CDatabaseTables methods.

CODE --> Python

FieldsKeysIncluded = ['Name',
 'Grid Line Type',
 'ID',
 'Ordinate',
 'Angle',
 'X1',
 'Y1',
 'X2',
 'Y2',
 'Bubble Location',
 'Visible']
NumberRecords = 1
data = [ 'G1',
 'Y (Cartesian)',
 'test',
 '1500',
 '',
 '',
 '',
 '',
 '',
 'Start',
 'Yes',]
        

y = SapModel.DatabaseTables.SetTableForEditingArray(TableKey,TableVersion,FieldsKeysIncluded, NumberRecords,data)              
    
FillImport = True
z= SapModel.DatabaseTables.ApplyEditedTables(FillImport) 
Reviewing the grids, you can see that the test grid has been added.




S&T

RE: ETABS API - GetGridSys_2

Fracturepoint, does this work for you?

It was working for me, but after reinstalling some stuff, I now get the following error:

CODE --> Python

y = SapModel.DatabaseTables.SetTableForEditingArray(TableKey,TableVersion,FieldsKeysIncluded, NumberRecords,data)

COMError: (-2147467262, 'No such interface supported', (None, None, None, 0, None)) 

I am running comtypes 1.1.8 and Etabs version 19.0.2.


S&T

RE: ETABS API - GetGridSys_2

Hi,
I had the same error for some of methods in FrameObj class. If you have access plz try to run your code by ETABs 18.1.1. I did that and every things work well. I don't know why! but my code sometimes have problem with ETABs 19.0.2 and sometimes is OK. I think there is something with comtypes and windows. I am trying to figure it out. will share my experience here.
remember you need to export and import model as .e2k to be able to run it on version 18.1.1
Regards,

RE: ETABS API - GetGridSys_2

Hi again,
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 - GetGridSys_2

Thanks Ruhi, appreciate the follow through. I will have to try this out.

At this point our IT guy hates me...

S&T

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close