A way to get overall part size? (C#)


I'm currently in the process of learning C# in order to make a Solid Edge tool for work.  Is there a way to get overall sizes (thickness, length, width) of simple parts (mostly wood panels).  I've ran through many of the code examples and thought 


 might work, but the pertinant values are not always named the same thing in the SE Varibles Table.  Sometimes they are L, W, H, sometimes they aren't listed, sometimes they are just var999 etc.


Perhaps find the longest distance in any given axis that's part of the part file?


Re: A way to get overall part size? (C#)

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi bcherb2,

there cannot be variables like L, W, H unless you define them in the part.


Should L be in x, y or z direction? This depends how the part is created.


With the API you can get the maximal dimensions (bounding box) for the part Body object:


oPartDocument.Bodies(1).GetRange( MinRangePoint, MaxRangePoint)

where MinRangePoint and MaxRangePoint are double arrays for x, y and z coordinated.

See code examle in SDK Help.


There is also a method GetExactRange() that will give better results if the bounding box is not parrallel to the global coordinate system and will calculate longer.





VS2015, SE ST10