×
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 Troubles - Section Cut Definition

ETABs API Troubles - Section Cut Definition

ETABs API Troubles - Section Cut Definition

(OP)
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 --> C#

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.



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



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.



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 - www.re-tug.com

RE: ETABs API Troubles - Section Cut Definition

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

CODE --> Text

"********** 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:


Quads or Groups and Quads, 16 columns:


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 - www.re-tug.com

RE: ETABs API Troubles - Section Cut Definition

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.

RE: ETABs API Troubles - Section Cut Definition

(OP)
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.



CODE --> C#

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 - www.re-tug.com

RE: ETABs API Troubles - Section Cut Definition

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 Calcs.app and let me know what you think

RE: ETABs API Troubles - Section Cut Definition

Quote:

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.


RE: ETABs API Troubles - Section Cut Definition

(OP)

Quote (JoshPlumSE)

I don't have a release date for it.

Trained well I see bigsmile, figured I would ask.

Quote (JoshPlumSE)

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 - www.re-tug.com

RE: ETABs API Troubles - Section Cut Definition

(OP)
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.




Thanks Josh and ggcdn

S&T - www.re-tug.com

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