public void WriteCommonPointersTest() { // all other write tests validate the case where there are no common pointers var line = new IgesLine(); line.AssociatedEntities.Add(new IgesLabelDisplayAssociativity()); line.AssociatedEntities.Add(new IgesGeneralNote()); line.AssociatedEntities.Add(new IgesTextDisplayTemplate()); line.Properties.Add(new IgesLocation()); var file = new IgesFile(); file.Entities.Add(line); VerifyFileContains(file, @" 402 1 0 0 0 00000000D 1 402 0 0 1 5 D 2 212 2 0 0 0 00000100D 3 212 0 0 1 0 D 4 312 3 0 0 0 00000200D 5 312 0 0 1 0 D 6 116 4 0 0 0 00000000D 7 116 0 0 1 0 D 8 110 5 0 0 0 00000000D 9 110 0 0 1 0 D 10 402,0; 1P 1 212,0; 3P 2 312,0.,0.,1,0.,0.,0,0,0.,0.,0.; 5P 3 116,0.,0.,0.; 7P 4 110,0.,0.,0.,0.,0.,0.,3,1,3,5,1,7; 9P 5 "); // no properties line.Properties.Clear(); VerifyFileContains(file, @" 402 1 0 0 0 00000000D 1 402 0 0 1 5 D 2 212 2 0 0 0 00000100D 3 212 0 0 1 0 D 4 312 3 0 0 0 00000200D 5 312 0 0 1 0 D 6 110 4 0 0 0 00000000D 7 110 0 0 1 0 D 8 402,0; 1P 1 212,0; 3P 2 312,0.,0.,1,0.,0.,0,0,0.,0.,0.; 5P 3 110,0.,0.,0.,0.,0.,0.,3,1,3,5; 7P 4 "); // no associated entities line.AssociatedEntities.Clear(); line.Properties.Add(new IgesLocation()); VerifyFileContains(file, @" 116 1 0 0 0 00000000D 1 116 0 0 1 0 D 2 110 2 0 0 0 00000000D 3 110 0 0 1 0 D 4 116,0.,0.,0.; 1P 1 110,0.,0.,0.,0.,0.,0.,0,1,1; 3P 2 "); }
public static IgesLine ToIgesLine(this Line line) { var result = new IgesLine() { Bounding = IgesLineBounding.BoundOnBothSides, P1 = ToIgesPoint(line.P1), P2 = ToIgesPoint(line.P2) }; AssignColor(result, line.Color); return(result); }
public void WriteLineWithLineWeightTest() { var file = new IgesFile(); var line = new IgesLine() { LineWeight = 42 }; file.Entities.Add(line); VerifyFileContains(file, @" 110 1 0 0 0 00000000D 1 110 42 0 1 0 D 2 110,0.,0.,0.,0.,0.,0.; 1P 1 "); }
public void WriteLineWithEntityLabelAndSubscriptTest() { var file = new IgesFile(); var line = new IgesLine() { EntityLabel = "abcdefghijklmnopqrstuvwxyz", // will be truncated to 8 characters EntitySubscript = 15 }; file.Entities.Add(line); VerifyFileContains(file, @" 110 1 0 0 0 00000000D 1 110 0 0 1 0 abcdefgh 15D 2 110,0.,0.,0.,0.,0.,0.; 1P 1 "); }
public void WriteLineWithViewTest() { var file = new IgesFile(); var line = new IgesLine() { View = new IgesView() }; file.Entities.Add(line); VerifyFileContains(file, @" 410 1 0 0 0 00000100D 1 410 0 0 1 0 D 2 110 2 0 0 0 1 00000000D 3 110 0 0 1 0 D 4 410,0,0.,0,0,0,0,0,0; 1P 1 110,0.,0.,0.,0.,0.,0.; 3P 2 "); }
public void WriteLineWithLineFontPatternTest() { var file = new IgesFile(); var line = new IgesLine() { LineFont = IgesLineFontPattern.Phantom }; file.Entities.Add(line); VerifyFileContains(file, @" 110 1 0 3 0 00000000D 1 110 0 0 1 0 D 2 110,0.,0.,0.,0.,0.,0.; 1P 1 "); line.CustomLineFont = new IgesPatternLineFontDefinition(); VerifyFileContains(file, @" 304 1 0 0 0 00000200D 1 304 0 0 1 2 D 2 110 2 0 -1 0 00000000D 3 110 0 0 1 0 D 4 304,0,1H0; 1P 1 110,0.,0.,0.,0.,0.,0.; 3P 2 "); }
public static Line ToLine(this IgesLine line) { // TODO: handle different forms (segment, ray, continuous) return(new Line(TransformPoint(line, line.P1), TransformPoint(line, line.P2), GetColor(line), line)); }
public void WriteLineWithLevelsTest() { var file = new IgesFile(); var line = new IgesLine(); file.Entities.Add(line); // no levels defined line.Levels.Clear(); VerifyFileContains(file, @" 110 1 0 0 0 00000000D 1 110 0 0 1 0 D 2 110,0.,0.,0.,0.,0.,0.; 1P 1 "); // one level defined line.Levels.Add(13); VerifyFileContains(file, @" 110 1 0 0 13 00000000D 1 110 0 0 1 0 D 2 110,0.,0.,0.,0.,0.,0.; 1P 1 "); // multiple levels defined line.Levels.Add(23); VerifyFileContains(file, @" 406 1 0 0 0 00000000D 1 406 0 0 1 1 D 2 110 2 0 0 -1 00000000D 3 110 0 0 1 0 D 4 406,2,13,23; 1P 1 110,0.,0.,0.,0.,0.,0.; 3P 2 "); // multiple entities referencing different multiple levels var otherLine = new IgesLine(); otherLine.Levels.Add(40); otherLine.Levels.Add(41); file.Entities.Add(otherLine); VerifyFileContains(file, @" 406 1 0 0 0 00000000D 1 406 0 0 1 1 D 2 110 2 0 0 -1 00000000D 3 110 0 0 1 0 D 4 406 3 0 0 0 00000000D 5 406 0 0 1 1 D 6 110 4 0 0 -5 00000000D 7 110 0 0 1 0 D 8 406,2,13,23; 1P 1 110,0.,0.,0.,0.,0.,0.; 3P 2 406,2,40,41; 5P 3 110,0.,0.,0.,0.,0.,0.; 7P 4 "); // multiple entities referencing the same multiple levels otherLine.Levels.Clear(); foreach (var level in line.Levels) { otherLine.Levels.Add(level); } VerifyFileContains(file, @" 406 1 0 0 0 00000000D 1 406 0 0 1 1 D 2 110 2 0 0 -1 00000000D 3 110 0 0 1 0 D 4 110 3 0 0 -1 00000000D 5 110 0 0 1 0 D 6 406,2,13,23; 1P 1 110,0.,0.,0.,0.,0.,0.; 3P 2 110,0.,0.,0.,0.,0.,0.; 5P 3 "); }