sticksandtriangles
Structural
- Apr 7, 2015
- 473
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:
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 -
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.
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 -