public static bool GetMaximumRotation_Assembly_ComposedPatterns(List <MyPatternOfComponents> listOfPatternOnThePath, MyCircumForPath pathObject, ref int i, ref int numOfPatterns, ref bool noStop, ref MyComposedPatternOfComponents outputComposedPattern, SldWorks SwApplication, ref StringBuilder fileOutput) { var listOfPatternsOfNew = new List <MyPatternOfComponents> { listOfPatternOnThePath[i] }; var lengthOfNew = 1; var exit = false; //Computation of the rotation angle: double[] planeNormal = { pathObject.circumplane.a, pathObject.circumplane.b, pathObject.circumplane.c }; var teta = FunctionsLC.FindAngle(listOfPatternOnThePath[0].patternCentroid, listOfPatternOnThePath[1].patternCentroid, pathObject.circumcenter); var axisDirection = Part.PartUtilities.GeometryAnalysis.establishAxisDirection(listOfPatternOnThePath[0].patternCentroid, listOfPatternOnThePath[1].patternCentroid, pathObject.circumcenter, planeNormal); while (i < (numOfPatterns - 1) && exit == false) { if (IsRotationTwoPatterns_Assembly(listOfPatternOnThePath[i], listOfPatternOnThePath[i + 1], teta, axisDirection, SwApplication, ref fileOutput)) { listOfPatternsOfNew.Add(listOfPatternOnThePath[i + 1]); lengthOfNew += 1; i++; } else { exit = true; noStop = false; i++; } } if (lengthOfNew > 1) { outputComposedPattern.ListOfMyPatternOfComponents = listOfPatternsOfNew; outputComposedPattern.pathOfMyComposedPatternOfComponents = pathObject; outputComposedPattern.typeOfMyComposedPatternOfComponents = "ROTATION"; outputComposedPattern.constStepOfMyComposedPatternOfComponents = listOfPatternsOfNew[0].patternCentroid.Distance( listOfPatternsOfNew[1].patternCentroid); return(true); } return(false); }
public static bool GetMaximumTranslation_Assembly_ComposedPatterns(List <MyPatternOfComponents> listOfPatternOnThePath, MyPathGeometricObject pathObject, ref int i, ref int numOfPatterns, ref bool noStop, ref MyComposedPatternOfComponents outputComposedPattern) { var listOfPatternsOfNew = new List <MyPatternOfComponents> { listOfPatternOnThePath[i] }; var lengthOfNew = 1; var exit = false; while (i < (numOfPatterns - 1) && exit == false) { if (IsTranslationTwoPatternsOfComponents(listOfPatternOnThePath[i], listOfPatternOnThePath[i + 1])) { listOfPatternsOfNew.Add(listOfPatternOnThePath[i + 1]); lengthOfNew += 1; i++; } else { exit = true; noStop = false; i++; } } if (lengthOfNew > 1) { outputComposedPattern.ListOfMyPatternOfComponents = listOfPatternsOfNew; outputComposedPattern.pathOfMyComposedPatternOfComponents = pathObject; outputComposedPattern.typeOfMyComposedPatternOfComponents = "(linear) TRANSLATION"; outputComposedPattern.constStepOfMyComposedPatternOfComponents = listOfPatternsOfNew[0].patternCentroid.Distance( listOfPatternsOfNew[1].patternCentroid); return(true); } return(false); }
public static void BuildNewComposedPatternOfComponentsOfLength2(StringBuilder fileOutput, string typeOfNewComposedPattern, ref List <MyComposedPatternOfComponents> listOfComposedPattern, ref List <MyComposedPatternOfComponents> listOfComposedPatternTwo, List <MyPatternOfComponents> listOfPatternsToConsider) { var listOfPathOfCentroids = new List <MyPathOfPoints>(); var listOfMyMatrAdj = new List <MyMatrAdj>(); var newListOfPatterns = new List <MyPatternOfComponents>(); newListOfPatterns.Add(listOfPatternsToConsider[0]); newListOfPatterns.Add(listOfPatternsToConsider[1]); var newComposedPatternGeomObject = FunctionsLC.LinePassingThrough( listOfPatternsToConsider[0].patternCentroid, listOfPatternsToConsider[1].patternCentroid); var newComposedPatternType = typeOfNewComposedPattern; var newComposedPattern = new MyComposedPatternOfComponents(newListOfPatterns, newComposedPatternGeomObject, newComposedPatternType); GeometryAnalysis.CheckAndUpdate_Assembly_ComposedPatterns(newComposedPattern, ref listOfPathOfCentroids, listOfPatternsToConsider, ref listOfMyMatrAdj, ref listOfComposedPattern, ref listOfComposedPatternTwo); }
public static bool GetComposedPatternsFromPathCircum_Assembly(MyPathOfPoints currentPathOfCentroids, List <MyPatternOfComponents> listOfCoherentPatterns, ref List <MyPathOfPoints> listOfPathsOfCentroids, ref List <MyMatrAdj> listOfMyMatrAdj, ref List <MyComposedPatternOfComponents> listOfOutputComposedPattern, ref List <MyComposedPatternOfComponents> listOfOutputComposedPatternTwo, SldWorks SwApplication, ref StringBuilder fileOutput) { var numOfPatterns = currentPathOfCentroids.path.Count; var noStop = true; var listOfPatternOnThePath = currentPathOfCentroids.path.Select(ind => listOfCoherentPatterns[ind]).ToList(); var pathCircumference = (MyCircumForPath)currentPathOfCentroids.pathGeometricObject; var i = 0; while (i < (numOfPatterns - 1)) { var newComposedPattern = new MyComposedPatternOfComponents(); var foundNewComposedPattern = GetMaximumRotation_Assembly_ComposedPatterns(listOfPatternOnThePath, pathCircumference, ref i, ref numOfPatterns, ref noStop, ref newComposedPattern, SwApplication, ref fileOutput); if (foundNewComposedPattern) { if (newComposedPattern.ListOfMyPatternOfComponents.Count == numOfPatterns || newComposedPattern.ListOfMyPatternOfComponents.Count == numOfPatterns - 1) { noStop = true; } GeometryAnalysis.CheckAndUpdate_Assembly_ComposedPatterns(newComposedPattern, ref listOfPathsOfCentroids, listOfCoherentPatterns, ref listOfMyMatrAdj, ref listOfOutputComposedPattern, ref listOfOutputComposedPatternTwo); } } if (noStop) { return(true); } return(false); }
public static bool GetComposedPatternsFromPathLine_Assembly(MyPathOfPoints currentPathOfCentroids, List <MyPatternOfComponents> listOfParallelPatterns, ref List <MyPathOfPoints> listOfPathsOfCentroids, ref List <MyMatrAdj> listOfMyMatrAdj, ref List <MyComposedPatternOfComponents> listOfOutputComposedPattern, ref List <MyComposedPatternOfComponents> listOfOutputComposedPatternTwo) { var numOfPatterns = currentPathOfCentroids.path.Count; var noStop = true; var listOfPatternOnThePath = currentPathOfCentroids.path.Select(ind => listOfParallelPatterns[ind]).ToList(); var i = 0; while (i < (numOfPatterns - 1)) { var newComposedPattern = new MyComposedPatternOfComponents(); var foundNewComposedPattern = GetMaximumTranslation_Assembly_ComposedPatterns(listOfPatternOnThePath, currentPathOfCentroids.pathGeometricObject, ref i, ref numOfPatterns, ref noStop, ref newComposedPattern); if (foundNewComposedPattern) { if (newComposedPattern.ListOfMyPatternOfComponents.Count == numOfPatterns || newComposedPattern.ListOfMyPatternOfComponents.Count == numOfPatterns - 1) { noStop = true; } GeometryAnalysis.CheckAndUpdate_Assembly_ComposedPatterns(newComposedPattern, ref listOfPathsOfCentroids, listOfParallelPatterns, ref listOfMyMatrAdj, ref listOfOutputComposedPattern, ref listOfOutputComposedPatternTwo); } } if (noStop) { return(true); } return(false); }