AnsweredAssumed Answered

api Frequency Simulation - Get Min/Max (Coarse/Fine) ElementSize and Tolerance for CreateMesh()

Question asked by Max Maxi on Jan 25, 2020
Latest reply on Feb 4, 2020 by Max Maxi

Hello everyone,

I'm trying to prepare several Frequency simulation studies via api to later run a bunch of them via c# ... and some how I want to use custom mesh density for these analysis ... I want to implement Something like Mesh Density TrackBar Setting that exist in Solidworks. (e.g. TrackBar  ==> Coarse(Min) --> +25% better than Min --> Default Element Size And Tolerance --> +75% better than Min --> Fine(Max) )

The question is how can I get Min/Max (Coarse/Fine) Element Size and Tolerance values for CreateMesh() function like in beneath image:

 

with this code :

mesh.GetDefaultElementSizeAndTolerance((int)swsLinearUnit_e.swsLinearUnitMillimeters, out averageGlobalElementSize, out tolerance);

we can get Default Element Size And Tolerance  that shown in below picture :

 

 

 

 

but how I can get the Suggested value for Element Size And Tolerance values (shown in first image) in two Coarse and Fine scenarios ?

So I think If I don't know the correct range for these parameter (Are these values fix in solidworks setting or change Through the model shape or design ?... ) and pass manually some double value without any insight and hint I will face with serious troubles later ...

 

Here is my c# code for meshing the part that works correct for normal Density Mesh (Reset Button offer these config):

double averageGlobalElementSize = 0;
double tolerance = 0;
ICWMesh mesh = (ICWMesh)study.Mesh;
mesh.Quality = (int)swsMeshQuality_e.swsMeshQualityHigh;
mesh.GetDefaultElementSizeAndTolerance((int)swsLinearUnit_e.swsLinearUnitMillimeters,out averageGlobalElementSize,out tolerance);
int errorCode = study.CreateMesh(0, averageGlobalElementSize, tolerance);

Outcomes