Hi All,
I am looking for a .NET function to replicate the GUI function of 'Steel - Modelling - Modify Steelwork - Compare Parts' which compares two parts in the same drawing.
What I am trying to achieve is to check if all parts with the same PosNum are exactly the same.
I have tried going through the ProStructuresNet help documentation and found some suspects.
I have played with
PsCompareDrawing.CheckTwoPartsAreEqual()
and
PsCompareDrawing.CheckTwoPartsAreEqualWithPosDiff()
To my surprise, on my test model file, the above returned different results.
Neither of them gave me the same result as the GUI function does. Eg, what those two functions think are different are considered same by the GUI function.
Another side question is, I was assuming that
UnequalAction
would be called when an unequal has been detected by either of the above two functions so I can access
string pReasonWhyUnequal
and understand what is going on, but apparently this is not the case.
See below for code snippet:
public static void CompareElement(string unparsed) { const string modelFile = @"test.dgn"; // scan model file for prosteel elements BM.Session.Instance.NewDesignFile(modelFile); Scanner scanner = new Scanner(BM.Session.Instance.GetActiveDgnModel()); scanner.Scan(false); // group by PosNum List<MyPSPart> modelParts = scanner.myPSParts; var groupedList = modelParts.GroupBy(x => x.Posnum); List<int> listOfNonMatchIDs = new List<int>(); PsCompareDrawing Engine = new PsCompareDrawing(); //Engine.SetVerbose(true); Engine.SetFoundUnequalAction(UnequalAction); foreach (var posnumGroup in groupedList) { // loop thru every combination for (int i = 0; i < posnumGroup.Count() - 1; i++) { for (int j = i + 1; j < posnumGroup.Count(); j++) { bool result = Engine.CheckTwoPartsAreEqual(posnumGroup.ElementAt(i).PSId, posnumGroup.ElementAt(j).PSId, new PsMatrix()); if (!result) { listOfNonMatchIDs.Add(i); listOfNonMatchIDs.Add(j); } } } } } public static void UnequalAction(PsObjectProperties pTemplateProperty, PsObjectProperties pCheckProperty, string pReasonWhyUnequal) { System.Windows.Forms.MessageBox.Show(pReasonWhyUnequal); }
ProStructures Version: Connect Edition Update 7
ProStructures SDK Version: 10.07.00.079
Any help appreaciated.
We will come back to you, a developer is notified.
Bentley Structural YouTube Channel
Bentley Technical Support
Johannes Michalowsky
User Success Support - Bentley Systems
ServiceRequest Manager
Thanks Johannes!
Hi Johannes, just a follow up to see if there's been any updates? Cheers