Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

ETABs API Troubles - Section Cut Definition

Status
Not open for further replies.

sticksandtriangles

Structural
Apr 7, 2015
468
0
16
US
Paging Jeremy Atkins, rscassar and maybe JoshPlum since I think he works at CSI. I made a diaphragm section cutting tool in python for ETABs and have documented the process here.

The python code worked in ETABs version 19, but does not work in ETABs version 20. I noticed some small tweaks to the database table for the section cut definitions and attempted some tweaks to the code to get it to work, but to no avail.

I have moved onto trying to code this in C# to make an addin in v20, but I am running into the same odd behavior with the database tables and I can not seem to fix it. I have posted the C# code on github if you want to review.

The code in question is in the Form1.cs file:

Code:
private void makeSectionCutBtn(object sender, EventArgs e)
        {
            string TableKey = "Section Cut Definitions";

            //retrieving the table data review

            string[] FieldKeyList = new string[0];
            string GroupName = "";
            int TableVersion = 0;
            string[] FieldKeysIncluded = new string[0];
            int NumberRecords = 0;
            string[] TableData = new string[0];

            _SapModel.DatabaseTables.GetTableForDisplayArray(TableKey, ref FieldKeyList, GroupName, ref TableVersion, ref FieldKeysIncluded, ref NumberRecords, ref TableData);

            DatabaseTableResult resultsDatabaseTables = new DatabaseTableResult();
            resultsDatabaseTables.FieldKeyList = FieldKeyList;
            resultsDatabaseTables.TableVersion = TableVersion;
            resultsDatabaseTables.FieldKeysIncluded = FieldKeysIncluded;
            resultsDatabaseTables.NumberRecords = NumberRecords;
            resultsDatabaseTables.TableData = TableData;

            //trying to createa custom section cut, not working

            string[] testETABs_Section_Cut_Data = new string[] { };
            string[] teststring1 = new string []
                { "0001", "Quads", "All", "Analysis", "Default", "0","0","0","Top or Right or Positive3","1", "1", "1",
                    "0", "10", "0", "1"
                };
            string[] teststring2 = new string[]
                { "0001", null , null, null, null, null, null, null, null, null, "1", "2",
                    "10", "10", "0", null
                };
            string[] teststring3 = new string[]
                { "0001", null, null,null, null, null, null, null, null,null, "1", "3",
                    "10", "10", "1", null
                };
            string[] teststring4 = new string[]
                { "0001", null, null,null, null, null, null, null, null,null, "1", "4",
                    "0", "10", "1", null
                };
            testETABs_Section_Cut_Data = teststring1.Concat(teststring2).ToArray();
            testETABs_Section_Cut_Data = testETABs_Section_Cut_Data.Concat(teststring3).ToArray();
            testETABs_Section_Cut_Data = testETABs_Section_Cut_Data.Concat(teststring4).ToArray();


            
            int TableVersiontest = 1;
            string[] FieldKeysIncludedtest = new string[] {"Name", "Defined By", "Group","Result Type", "Result Location", "Rotation About Z", "Rotation About Y", "Rotation About X",
                "Element Side", "Number of Quads", "Quad Number", "Point Number", "Quad X", "Quad Y", "Quad Z", "GUID"};
            int NumberRecordstest = 4;

            _SapModel.DatabaseTables.SetTableForEditingArray(TableKey, ref TableVersiontest, ref FieldKeysIncludedtest, NumberRecordstest, ref testETABs_Section_Cut_Data);

            bool FillImportLog = true;
            int NumFatalErrors = 0;
            int NumErrorMsgs = 0;
            int NumWarnMsgs = 0;
            int NumInfoMsgs = 0;
            string ImportLog = "";


            _SapModel.DatabaseTables.ApplyEditedTables(FillImportLog,ref NumFatalErrors, ref NumErrorMsgs, ref NumWarnMsgs, ref NumInfoMsgs, ref ImportLog);



        }


In the example above, I am trying make one section cut, based on the quadrilateral definition, with the four points being [0,10,0], [10,10,0], [10,10,1], [0,10,1].

The result of running this code creates (6) section cuts, all being defined by group and not quadrilateral, weird behavior.

Capture_lv8o2j.png


The result that I am looking for would look something like this:

Capture1_iba3ib.png


The data I have prepared to be input in the database table mimics this appearance, save the GUID first row last column. When I made the python script in v19, I just set this to "1" and it worked.

I also ran the GetTableForDisplayArray function to review the data output from ETABs and I cannot spot any difference in the data I am feeding the program verse what the program is returning.

Capture3_uqfz0q.png


If you have any ideas on how to resolve, in either python or C#, I would appreciate it. It's frustrating that I had it working in ETABs 19 and now I cannot get it to work.

Thanks!



S&T -
 
Replies continue below

Recommended for you

I reviewed the import log warnings, you can see the program throws an error on import:

Code:
"********** DATABASE IMPORT DEFINITION DATA **********\r\n\r\nETABS Version 20.3.0 Interactive Database Import
\r\nImport Type and Options:  Interactive Database Editing\r\n     Elements Deleted from DB:  Delete object from model\r\n     
Other Items Deleted from DB:  Delete item from model\r\n     
Elements with Same Name in Model and DB:  Replace object in model\r\n     Other Items with Same Name in Model and DB:  Replace item in model\r\n     
Elements (Except Links) in the Same Location:  Allow duplicates in the same location\r\n     Link Elements in the Same Location:  Allow duplicates in the same location\r\n     
Items With Same Name in a DB Table:  Overwrite previous item\r\n     
Import Control for Errors:  Abort import after 20 errors\r\n     
Import Control for Warnings:  Abort import after 200 warnings\r\n\r\nImport started at \r\n\r\nImport completed at 8:55:04 AM\r\nNumber of errors:  10\r\nNumber of warnings:  0\r\nNumber of informational messages:  
0\r\n\r\n\r\n********** DATABASE IMPORT SUMMARY LOG **********\r\n\r\nSection Cut Definitions Table:  12 of 22 records successfully read\r\n\r\n\r\n\r\n\r\n********** DATABASE IMPORT DETAILED LOG 
**********\r\n\r\n*** Error Message 1 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  2\r\nItem 0 not recognized; default value assumed
\r\n\r\n*** Error Message 2 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  3\r\nItem Top or Right or Positive3 not recognized; default value assumed
\r\n\r\n*** Error Message 3 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  4\r\nItem 1 not recognized; default value assumed

\r\n\r\n*** Error Message 4 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  5\r\nItem 0 not recognized; default value assumed

\r\n\r\n*** Error Message 5 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  NAME\r\nRecord:  9\r\nName field is blank; record skipped

\r\n\r\n*** Error Message 6 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  10\r\nItem 10 not recognized; default value assumed

\r\n\r\n*** Error Message 7 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  11\r\nItem 0001 not recognized; default value assumed

\r\n\r\n*** Error Message 8 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  15\r\nItem 10 not recognized; default value assumed

\r\n\r\n*** Error Message 9 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  NAME\r\nRecord:  20\r\nName field is blank; record skipped

\r\n\r\n*** Error Message 10 ***\r\nTable name:  SECTION CUT DEFINITIONS\r\nField name:  GROUP\r\nRecord:  21\r\nItem 1 not recognized; default value assumed\r\n\r\nSection Cut Definitions Table:  12 of 22 records successfully read\r\n"

I am not quite sure how to resolve this, one of the odds things I noticed when reviewing the database table was that the size of the table changes depending on how you define the section cut. If the section cut is defined by groups, the tables has 9 columns. If the table consists of either both groups and quadrilaterals or just quadrilaterals, there are 16 columns in the table.

Groups, 9 columns:
Capture_o6w9fr.png


Quads or Groups and Quads, 16 columns:
Capture1_nmufn6.png


I wish I still had access to ETABs v19 to see if this behavior was the same back in the day. It looks like our license no longer works for v19.

S&T -
 
I'm not sure.... The API stuff REALLY isn't my specialty as I'm not a programmer. However, I believe there have been changes to the database stuff in the API recently. So, that would be my bet.

When I get a chance, I'm going to take a look at the help file (CSI API ETABS v1.chm) for the version I'm using (the soon to be released v22). Hopefully, that will point me towards some changes that have been made with particular functions / calls that might explain your issue.
 
Josh,

Thanks for the reply. I am guessing that there is something funky going on with the database tables as well in v20. You mentioned v22, is that v21? Any ideas on release date? Hopefully the new release might shine some light on this.

Playing a bit more, I was able to make section cut definitions based on groups, but still with some odd extra results.

Capture_atysjn.png


Code:
string[] testETABs_Section_Cut_Data = new string[] { };
            string[] teststring1 = new string[]
                { "THIS_IS_A_TEST", "Group", "All", "Analysis", "Default", "0","0","0","1"};
            string[] teststring2 = new string[]
                { "THIS_IS_A_TEST_2", "Group", "All", "Analysis", "Default", "0","0","0","1"};

            testETABs_Section_Cut_Data = teststring1.Concat(teststring2).ToArray();

            int TableVersiontest = 1;
            string[] FieldKeysIncludedtest = new string[] {"Name", "Defined By", "Group", "Result Type", "Rotation About Z", "Rotation About Y", "Rotation About X", "GUID"};
            int NumberRecordstest = 2;

            _SapModel.DatabaseTables.SetTableForEditingArray(TableKey, ref TableVersiontest, ref FieldKeysIncludedtest, NumberRecordstest, ref testETABs_Section_Cut_Data);

            bool FillImportLog = true;
            int NumFatalErrors = 0;
            int NumErrorMsgs = 0;
            int NumWarnMsgs = 0;
            int NumInfoMsgs = 0;
            string ImportLog = "";


            _SapModel.DatabaseTables.ApplyEditedTables(FillImportLog,ref NumFatalErrors, ref NumErrorMsgs, ref NumWarnMsgs, ref NumInfoMsgs, ref ImportLog);

Josh, do you have a contact at CSI that can assist with these sorts of questions? I do not really want to pay for the developer's program, but it would be nice to get this in the front of someone that can get this on the bug fix list if it is truly a bug.



S&T -
 
Interesting. You've pretty much done everything I would suggest in terms of debugging. Unfortunately I haven't worked too much with the API for setting DB tables. Most things I've done used the built-in methods or only read data from the tables.

If I have some time this week I will grab your code off Github and try it out. Also, thanks for the shoutout on your post. Reminds me I should update it for v1 of the API

-JA
try [link calcs.app]Calcs.app[/url] and let me know what you think
 
Thanks for the reply. I am guessing that there is something funky going on with the database tables as well in v20. You mentioned v22, is that v21? Any ideas on release date? Hopefully the new release might shine some light on this.

Yes, sorry. I meant version 21. I'm currently working on a number of things for ASCE 7-22, so that 21 and 22 got conflated in my mind. [smile]

I don't have a release date for it. I not good at guessing this sort of thing, so I try not to. Personally, I feel like we're really getting close to an ETABS and SAFE v21 release.... To be perfectly honest, I've had that feeling for a couple of months now. It really just depends on the testing and validation for the main features. Sometimes this takes awhile for the bigger releases.

Also, I shouldn't give out contact information for developers on a forum like this. But, I will try to dig into some of our release notes / bug tickets to see what we've documented for ETABS for this v21 release. That way I can check to see if they cover the issue you're dealing with. I have a feeling they do.


 
JoshPlumSE said:
I don't have a release date for it.

Trained well I see [bigsmile], figured I would ask.

JoshPlumSE said:
Also, I shouldn't give out contact information for developers on a forum like this.

Easy enough to find my email address if you want to send it. Thanks for digging into it.

ggcdn, Thanks for the feedback as well. I will keep tinkering with a few more ideas, but I believe this to be a bug. The code worked in v19 and now does not.

S&T -
 
I was able to figure this out finally, turns out the headers of the tables do not always match the "coded" headers.

An example, you can see "Rotation About Z" in the visible column header has become "RotAboutZ" in the coded output.

Capture_qaezgb.png

Capture1_i8mltz.png


Thanks Josh and ggcdn

S&T -
 
Status
Not open for further replies.
Back
Top