internal static void RunGeometricReasoning(Dictionary <string, List <TessellatedSolid> > solids) { // Generate a good number of directions on the surface of a sphere //------------------------------------------------------------------------------------------ //SimplifySolids(solids); Directions = IcosahedronPro.DirectionGeneration(1); DisassemblyDirections.Directions = new List <double[]>(Directions); FindingOppositeDirections(); // Creating Bounding Geometries for every solid //------------------------------------------------------------------------------------------ //Bridge.StatusReporter.ReportStatusMessage("Creating Bounding Geometries ... ", 1); BoundingGeometry.OrientedBoundingBoxDic = new Dictionary <TessellatedSolid, BoundingBox>(); BoundingGeometry.BoundingCylinderDic = new Dictionary <TessellatedSolid, BoundingCylinder>(); BoundingGeometry.CreateOBB2(solids); BoundingGeometry.CreateBoundingCylinder(solids); //Bridge.StatusReporter.PrintMessage("BOUNDING GEOMETRIES ARE SUCCESSFULLY CREATED.", 0.5f); // Detecting Springs //SpringDetector.DetectSprings(solids); // Primitive Classification //------------------------------------------------------------------------------------------ // what parts to be classified? var partsForPC = BlockingDetermination.PartsTobeClassifiedIntoPrimitives(solids); SolidPrimitive = BlockingDetermination.PrimitiveMaker(partsForPC); }
public static void doAssemblyPlanning(string dir) { state = new ProgramState(); if (dir == "") { dir = "."; } if (serverMode) { ProgramState.Load(dir + slash + "intermediate" + slash + "ProgramState.xml", ref state); } else { ProgramState.Load(dir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml", ref state); } LoadState(); checkDirs(); AssemblyGraph.RepairGraphConnections(); //$ Adding this so that bounding box related functionalities still work BoundingGeometry.OrientedBoundingBoxDic = new Dictionary <TessellatedSolid, BoundingBox>(); BoundingGeometry.BoundingCylinderDic = new Dictionary <TessellatedSolid, BoundingCylinder>(); BoundingGeometry.CreateOBB2(Solids); BoundingGeometry.CreateBoundingCylinder(Solids); PartitioningSolid.Partitions = new Dictionary <TessellatedSolid, Partition[]>(); PartitioningSolid.PartitionsAABB = new Dictionary <TessellatedSolid, PartitionAABB[]>(); PartitioningSolid.CreatePartitions(Program.SimplifiedSolids); NonadjacentBlockingWithPartitioning.Run(AssemblyGraph, SolidsNoFastenerSimplified, globalDirPool); GraphSaving.SaveTheGraph(AssemblyGraph); Stabilityfunctions.GenerateReactionForceInfo(AssemblyGraph); var leapSearch = new LeapSearch(); var solutions = leapSearch.Run(AssemblyGraph, Solids, globalDirPool); OptimalOrientation.Run(solutions); var cand = new AssemblyCandidate() { Sequence = solutions }; cand.SaveToDisk(state.inputDir + slash + "XML" + slash + "solution.xml"); WorkerAllocation.Run(solutions); SaveState(); if (serverMode) { state.Save(state.inputDir + slash + "intermediate" + slash + "ProgramState.xml"); } else { state.Save(state.inputDir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml"); } Console.WriteLine("\n\nDone"); }
public static int doVerification(string dir) { state = new ProgramState(); if (dir == "") { dir = "."; } if (serverMode) { ProgramState.Load(dir + slash + "intermediate" + slash + "ProgramState.xml", ref state); } else { ProgramState.Load(dir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml", ref state); } LoadState(); AssemblyGraph.RepairGraphConnections(); //$ Adding this so that bounding box related functionalities still work BoundingGeometry.OrientedBoundingBoxDic = new Dictionary <TessellatedSolid, BoundingBox>(); BoundingGeometry.BoundingCylinderDic = new Dictionary <TessellatedSolid, BoundingCylinder>(); BoundingGeometry.CreateOBB2(Solids); BoundingGeometry.CreateBoundingCylinder(Solids); Console.WriteLine("\n\nChecking connectedness..."); LoadDirections(); if (!DisassemblyDirectionsWithFastener.GraphIsConnected(AssemblyGraph)) { Console.WriteLine("\n\nFailure: Graph is not connected"); SaveVerification("false"); return(1); } Console.WriteLine("\n\nConnectedness verified"); SaveState(); if (serverMode) { state.Save(state.inputDir + slash + "intermediate" + slash + "ProgramState.xml"); SaveVerification("true"); } else { state.Save(state.inputDir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml"); } Console.WriteLine("\nDone"); return(0); }
public static void doDisassemblyDirections(string dir) { state = new ProgramState(); if (dir == "") { dir = "."; } if (serverMode) { ProgramState.Load(dir + slash + "intermediate" + slash + "ProgramState.xml", ref state); } else { ProgramState.Load(dir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml", ref state); } LoadState(); AssemblyGraph.RepairGraphConnections(); //RefreshGraphArcs (); //$ Adding this so that bounding box related functionalities still work BoundingGeometry.OrientedBoundingBoxDic = new Dictionary <TessellatedSolid, BoundingBox>(); BoundingGeometry.BoundingCylinderDic = new Dictionary <TessellatedSolid, BoundingCylinder>(); BoundingGeometry.CreateOBB2(Solids); BoundingGeometry.CreateBoundingCylinder(Solids); DeserializeSolidProperties(); globalDirPool = DisassemblyDirectionsWithFastener.RunGraphGeneration(AssemblyGraph, SolidsNoFastener); //the second user interaction must happen here SaveDirections(); SaveState(); if (serverMode) { state.Save(state.inputDir + slash + "intermediate" + slash + "ProgramState.xml"); } else { state.Save(state.inputDir + slash + "bin" + slash + "intermediate" + slash + "ProgramState.xml"); } Console.WriteLine("\nDone"); }