Esempio n. 1
0
    public void SolidDeflate()
    {
        var body   = TestGeomGenerator.CreateImprint().Body;
        var offset = Offset.Create(body, -0.5);

        Assert.IsTrue(offset.Make(Shape.MakeFlags.None));
        AssertHelper.IsSameModel(offset, Path.Combine(_BasePath, "SolidDeflate"));
    }
Esempio n. 2
0
    public void SketchDiscardOriginal()
    {
        var sketch = TestSketchGenerator.CreateSketch(TestSketchGenerator.SketchType.Circle, true);
        var offset = Offset.Create(sketch.Body, -4.0);

        offset.KeepOriginal = false;

        Assert.IsTrue(offset.Make(Shape.MakeFlags.None));
        AssertHelper.IsSameModel(offset, Path.Combine(_BasePath, $"SketchDiscardOriginal"));
    }
Esempio n. 3
0
    public void SketchDeflate(TestSketchGenerator.SketchType sketchType)
    {
        var sketch = TestSketchGenerator.CreateSketch(sketchType, true);
        var offset = Offset.Create(sketch.Body, -1.0);

        offset.KeepOriginal = true;

        Assert.IsTrue(offset.Make(Shape.MakeFlags.None));
        AssertHelper.IsSameModel(offset, Path.Combine(_BasePath, $"SketchDeflate_{sketchType}"));
    }
Esempio n. 4
0
    public void SolidCorner(Offset.CornerType corner)
    {
        var body   = TestGeomGenerator.CreateBox().Body;
        var offset = Offset.Create(body, 1.0);

        offset.Corner = corner;

        Assert.IsTrue(offset.Make(Shape.MakeFlags.None));
        AssertHelper.IsSameModel(offset, Path.Combine(_BasePath, $"SolidCorner_{corner}"));
    }
Esempio n. 5
0
    public void SketchCorner(Offset.CornerType corner)
    {
        var sketch = TestSketchGenerator.CreateSketch(TestSketchGenerator.SketchType.SimpleAsymmetric, true);
        var offset = Offset.Create(sketch.Body, 2.0);

        offset.KeepOriginal = true;
        offset.Corner       = corner;

        Assert.IsTrue(offset.Make(Shape.MakeFlags.None));
        AssertHelper.IsSameModel(offset, Path.Combine(_BasePath, $"SketchCorner_{corner}"));
    }
Esempio n. 6
0
    public void SketchOpenWire()
    {
        Sketch        sketch = Sketch.Create();
        SketchBuilder sb     = new(sketch);

        sb.StartPath(-5, -5);
        sb.LineTo(-2, 0);
        sb.ArcTo(2, 0, 0, 2);
        sb.LineTo(5, -5);
        Body body   = Body.Create(sketch);
        var  offset = Offset.Create(sketch.Body, 0.5);

        Assert.IsFalse(offset.Make(Shape.MakeFlags.None));
        Assert.That(Context.Current.MessageHandler.GetEntityMessages(offset).Any(msg => msg.Text.Contains("closed wires")));
    }
Esempio n. 7
0
    public void SolidCompound()
    {
        var body        = TestGeomGenerator.CreateBox().Body;
        var linearArray = LinearArray.Create(body);

        linearArray.Quantity1     = 2;
        linearArray.Quantity2     = 2;
        linearArray.Distance1     = 2;
        linearArray.Distance2     = 2;
        linearArray.DistanceMode1 = LinearArray.DistanceMode.Spacing;
        linearArray.DistanceMode2 = LinearArray.DistanceMode.Spacing;

        var offset = Offset.Create(body, 0.5);

        Assert.IsTrue(offset.Make(Shape.MakeFlags.None));

        AssertHelper.IsSameModel(offset, Path.Combine(_BasePath, "SolidCompound"));
    }
Esempio n. 8
0
 public static Offset ConvertToOffsetFactor(string translation)
 {
     return(Offset.Create(translation.Trim()));
 }
Esempio n. 9
0
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            var offsetValue = ((value as string) ?? string.Empty).Trim();

            return(Offset.Create(offsetValue));
        }