public static void RemoveUselessGeometries() { for (int i = 0; i < 142; ++i) { string name = null; try { var netlibPolyhedron = new NetlibPolyhedron("res/polyhedra/" + i.ToString()); name = netlibPolyhedron.Name; if ( (name.Contains("elongated") == false) && (name.Contains("augmented") == false) ) { continue; } string[] names = { "res/polyhedra/" + name + ".wrl", "res/polyhedra/" + i.ToString() + ".xml", "res/polyhedra/" + i.ToString() }; foreach (var path in names) { try { if (File.Exists(path)) { File.Delete(path); } }catch (Exception) {} } }catch (Exception) {} } }
private void CreateBrush(object obj) { BrushInfo bInfo = (BrushInfo)(obj); int i = bInfo.index; Log("Processing brush " + i.ToString()); try { Geometry geometry; string path = "res/polyhedra/" + i.ToString(); string name = null; if (File.Exists(path) == false) { Log("skipping " + path); return; } try { var netlibPolyhedron = new NetlibPolyhedron(path); name = netlibPolyhedron.Name; /*if(name == null || name.Length < 1) * { * netlibPolyhedron = new NetlibPolyhedron("res/polyhedra/" + i.ToString()); * name = netlibPolyhedron.Name; * }*/ /*if( * (name != null) && * (name.Length >= 1) * ) * { * Trace.WriteLine(name); * }*/ geometry = new XmlPolyhedron("res/polyhedra/" + i.ToString() + ".xml"); Log("loaded " + name + " with XmlPolyhedron"); } catch (System.Exception) { try { if (string.IsNullOrEmpty(name) == false) { name = name.Replace(' ', '_'); geometry = new VrmlPolyhedronGeometry("res/polyhedra/" + name + ".wrl"); Log("loaded " + name + " with VrmlPolyhedronGeometry"); } else { Log("skipped - no name"); } } catch (System.Exception) { return; } return; } if (string.IsNullOrEmpty(name)) { name = i.ToString(); } if (geometry == null) { Log("WARNING: Bad shape for file " + i.ToString() + " (" + name + ")"); return; } if ( (geometry.Points.Count > 0) && (geometry.Polygons.Count > 0) ) { //serializationDictionary[i] = geometry; MakeBrush(name, geometry, false); } else { Log("WARNING: Bad shape for file " + i.ToString() + " (" + name + ")"); } } catch (System.Exception) { Log("WARNING: Bad shape for file " + i.ToString()); } }