Ejemplo n.º 1
0
    protected override void OnMouseDown(Vector3 pos, ICADObject sko)
    {
        if (sko == null)
        {
            return;
        }
        var entity = sko as IEntity;

        if (p == null)
        {
            if (entity.type == IEntityType.Point)
            {
                p = entity;
            }
        }
        else if (u == null)
        {
            if (entity.type == IEntityType.Line)
            {
                u = entity;
            }
        }
        else if (v == null)
        {
            if (entity.type == IEntityType.Line && entity != u)
            {
                v = entity;
                StopTool();
                editor.PushUndo();
                var feature = new SketchFeature();
                DetailEditor.instance.AddFeature(feature);
                feature.u      = u;
                feature.v      = v;
                feature.p      = p;
                feature.source = DetailEditor.instance.activeFeature;

                IPlane plane = feature as IPlane;

                if (Vector3.Dot(plane.n, Camera.main.transform.forward) < 0f)
                {
                    feature.u = v;
                    feature.v = u;
                }

                DetailEditor.instance.ActivateFeature(feature);
                CameraController.instance.AnimateToPlane(feature);
            }
        }
    }
Ejemplo n.º 2
0
    public void New()
    {
        if (detail != null)
        {
            detail.Clear();
        }
        activeFeature = null;
        detail        = new Detail();
        var sk = new SketchFeature();

        sk.shouldHoverWhenInactive = true;
        new PointEntity(sk.GetSketch());
        detail.AddFeature(sk);
        sk = new SketchFeature();
        detail.AddFeature(sk);
        UpdateFeatures();
        ActivateFeature(sk);
    }