private bool SetFacesAndOffset(bool testOnly, object distanceFromHere, object distanceToHere)
        {
            if (distanceFromHere == null || distanceToHere == null)
            {
                return(true);                                                    // because this means, you can use the object
            }
            List <Face> fromHere = new List <Face>();
            List <Face> toHere   = new List <Face>();
            Vertex      vtx1     = distanceFromHere as Vertex;
            Vertex      vtx2     = distanceToHere as Vertex;
            Edge        edg1     = distanceFromHere as Edge;
            Edge        edg2     = distanceToHere as Edge;
            Face        fc1      = distanceFromHere as Face;
            Face        fc2      = distanceToHere as Face;
            ICurve      crv1     = distanceFromHere as ICurve;
            ICurve      crv2     = distanceToHere as ICurve;

            originalOffset = GeoVector.NullVector;
            if (distanceToHere is GeoObject.Point pnt && vtx2 == null)
            {
                vtx2 = new Vertex(pnt.Location);
            }
            if (vtx1 != null && vtx2 != null)
            {
                originalOffset = vtx1.Position - vtx2.Position;
            }
            else if ((vtx1 != null && edg2 != null) || (vtx2 != null && edg1 != null))
            {
                Vertex      vtx;
                Edge        edg;
                List <Face> lv, le;
                if (vtx1 != null)
                {
                    vtx = vtx1; edg = edg2; lv = fromHere; le = toHere;
                }
                else
                {
                    vtx = vtx2; edg = edg1; lv = toHere; le = fromHere;
                }
                double cpos = edg.Curve3D.PositionOf(vtx.Position);
                originalOffset = vtx.Position - edg.Curve3D.PointAt(cpos);
                if (vtx1 == null)
                {
                    originalOffset.Reverse();
                }
            }
            else if ((vtx1 != null && fc2 != null) || (vtx2 != null && fc1 != null))
            {
                Vertex      vtx;
                Face        fc;
                List <Face> lv, le;
                if (vtx1 != null)
                {
                    vtx = vtx1; fc = fc2; lv = fromHere; le = toHere;
                }
                else
                {
                    vtx = vtx2; fc = fc1; lv = toHere; le = fromHere;
                }
                GeoPoint2D[] pfs = fc.Surface.PerpendicularFoot(vtx.Position);
                for (int i = 0; i < pfs.Length; i++)
                {
                    if (fc.Contains(ref pfs[i], true))
                    {
                        originalOffset = vtx.Position - fc.Surface.PointAt(pfs[i]);
                        if (vtx1 == null)
                        {
                            originalOffset.Reverse();
                        }
                        break;
                    }
                }
            }
            else if ((edg1 != null || crv1 != null) && (edg2 != null || crv2 != null))
            {
                double pos1 = 0.5, pos2 = 0.5;
                if (crv1 == null)
                {
                    crv1 = edg1.Curve3D;
                }
                if (crv2 == null)
                {
                    crv2 = edg2.Curve3D;
                }
                if (crv1 is Line l1 && crv2 is Line l2)
                {
                    if (Precision.SameDirection(l1.StartDirection, l2.StartDirection, false))
                    {
                        double u = crv1.PositionOf(crv2.StartPoint);
                        originalOffset   = crv2.StartPoint - crv1.PointAt(u);
                        offsetStartPoint = crv1.PointAt(u);
                    }
                    else
                    {
                        Geometry.DistLL(l1.StartPoint, l1.StartDirection, l2.StartPoint, l2.StartDirection, out double par1, out double par2);
                        originalOffset   = l2.PointAt(par2) - l1.PointAt(par1);
                        offsetStartPoint = l1.PointAt(par1);
                    }
                }
                else if (crv1.GetPlanarState() == PlanarState.Planar && crv2.GetPlanarState() == PlanarState.Planar)
                {   // probably parallel planes, so newton could find anything
                    GeoPoint foot = crv1.GetPlane().ToLocal(crv2.StartPoint);
                    originalOffset   = crv2.StartPoint - foot;
                    offsetStartPoint = foot;
                }
                else if (Curves.NewtonMinDist(crv1, ref pos1, crv2, ref pos2))
                {
                    originalOffset   = crv2.PointAt(pos2) - crv1.PointAt(pos1);
                    offsetStartPoint = crv1.PointAt(pos1);
                }
                // else no distance between two curves, maybe check some more cases, which make a usable offset
            }