Process CAD |
Copy Code
|
---|---|
SetUnits("Kips & Inches"); //define where the CAD files are located var source = @"C:\Users\your.login\Desktop\ShapeBuilder\ToProcess"; //define where to save the generated ShapeBuilder files, repord pdfs, and section property table var results = @"C:\Users\your.login\Desktop\ShapeBuilder\Processed\"; //create the result folder if it doesn't already exist Directory.CreateDirectory(results); //get a material (from the dialog) for all the imported shapes, //if you know the path to the material, you could skip the dialog and just "hard code" it below var material = PickMaterial(); int count = 0; foreach(var file in GetCADFiles(source)) { //file path, import scale, arc divisions, material, cad layer (null for all layers) ImportCAD(file, 1.0, 10, material, null); await SimpleAnalysis(); ZeroCentroid(); GenerateDimensions(); UnselectAll(); ZoomExtents(); //the following is only needed if you want advanced (torsion) shape properties //otherwise just await the SimpleAnalysis here SetMesh(4.0); //result convergence at this setting would need to be checked await AdvancedAnalysis(); //add tables to the report AddTable("Sketch View"); AddTable("Geometric Properties"); AddTable("Overall Properties"); AddTable("Principal Properties"); AddTable("Torsion Properties"); //save the shapebuilder file, a pdf of the report, and update the section properties table var fileName = Path.GetFileNameWithoutExtension(file); SaveAs($"{results}{fileName}{".sbf"}"); ExportReport($"{results}{fileName}{".pdf"}"); AppendResults($"{results}{"Table.txt"}"); //clear the project before importing the next shape SelectAllShapes(); DeleteSelected(); count++; } $"Processed {count} files." |