public void Add(ICurve2D c2d)
        {
            IGeoObject go = c2d.MakeGeoObject(Plane.XYPlane);

            AssertColor(go);
            toShow.Add(go);
        }
Exemple #2
0
        /// <summary>
        /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.FixedU (double, double, double)"/>
        /// </summary>
        /// <param name="u"></param>
        /// <param name="vmin"></param>
        /// <param name="vmax"></param>
        /// <returns></returns>
        public override ICurve FixedU(double u, double vmin, double vmax)
        {
            ICurve2D btr       = basisCurve2D.Trim(GetPos(vmin), GetPos(vmax));
            ICurve   b3d       = btr.MakeGeoObject(Plane.XYPlane) as ICurve;
            ModOp    rot       = ModOp.Rotate(1, (SweepAngle)u);
            ModOp    movePitch = ModOp.Translate(0, pitch * u / (Math.PI * 2.0), 0);

            return(b3d.CloneModified(toSurface * movePitch * rot));
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            IDebugForm form = CF.DebugForm;
            Model      m    = form.Model;

            ICurve2D gc2d = (ICurve2D)objectProvider.GetObject();

            m.Add(VisualizerHelper.AssertColor(gc2d.MakeGeoObject(Plane.XYPlane)));

            form.ShowDialog(windowService);
        }
        public void Add(ICurve2D c2d, System.Drawing.Color color, string debugHint)
        {
            if (c2d == null)
            {
                return;
            }
            IGeoObject go = c2d.MakeGeoObject(Plane.XYPlane);
            ColorDef   cd = new ColorDef(color.Name, color);

            (go as IColorDef).ColorDef = cd;
            StringProperty sp = new StringProperty(debugHint, "Debug.Hint");

            go.UserData.Add("Debug", sp);
            toShow.Add(go);
        }
Exemple #5
0
 /// <summary>
 /// Tries to combine two curves. crv1 and crv2 must be correct oriented and the endpoint of crv1 mut be the start-point of crv2
 /// </summary>
 /// <param name="crv1"></param>
 /// <param name="crv2"></param>
 /// <returns>the combined curve or null, if not possible</returns>
 public static ICurve Combine(ICurve crv1, ICurve crv2, double precision)
 {
     if (crv1 == null || crv2 == null)
     {
         return(null);
     }
     if ((crv1.EndPoint | crv2.StartPoint) > precision)
     {
         return(null);
     }
     if (crv1 is InterpolatedDualSurfaceCurve ip1 && crv2 is InterpolatedDualSurfaceCurve ip2)
     {
         if ((ip1.Surface1.SameGeometry(ip1.Domain1, ip2.Surface1, ip2.Domain1, precision, out _) && ip1.Surface2.SameGeometry(ip1.Domain2, ip2.Surface2, ip2.Domain2, precision, out _)) ||
             (ip1.Surface1.SameGeometry(ip1.Domain1, ip2.Surface2, ip2.Domain2, precision, out _) && ip1.Surface2.SameGeometry(ip1.Domain2, ip2.Surface1, ip2.Domain1, precision, out _)))
         {
             List <GeoPoint> basepoints = new List <GeoPoint>();
             basepoints.AddRange(ip1.BasePoints);
             basepoints.RemoveAt(basepoints.Count - 1);
             basepoints.AddRange(ip2.BasePoints);
             return(new InterpolatedDualSurfaceCurve(ip1.Surface1, ip1.Domain1, ip1.Surface2, ip1.Domain2, basepoints)); // the domains are too small, but this is not a problem
         }
     }
     if (GetCommonPlane(crv1, crv2, out Plane pln))
     {
         ICurve2D e2d1  = crv1.GetProjectedCurve(pln);
         ICurve2D e2d2  = crv2.GetProjectedCurve(pln);
         ICurve2D fused = e2d1.GetFused(e2d2, precision);
         if (fused != null)
         {
             return(fused.MakeGeoObject(pln) as ICurve);
         }
     }
     else if (crv1 is Line && crv2 is Line)
     {
         Line res = Line.Construct();
         res.SetTwoPoints(crv1.StartPoint, crv2.EndPoint);
         return(res);
     }
     // non planar BSplines should be implemented
     return(null);
 }
        public void Add(ICurve2D c2d, System.Drawing.Color color, int debugHint)
        {
            if (c2d == null)
            {
                return;
            }
            IGeoObject go = c2d.MakeGeoObject(Plane.XYPlane);
            ColorDef   cd = new ColorDef(color.Name, color);

            (go as IColorDef).ColorDef = cd;
            IntegerProperty ip = new IntegerProperty(debugHint, "Debug.Hint");

            go.UserData.Add("Debug", ip);
            //if (c2d.UserData!=null) // userdata kopieren
            //{
            //    foreach (KeyValuePair<string,object> item in c2d.UserData)
            //    {
            //        go.UserData.Add(item.Key, item.Value);
            //    }
            //}
            toShow.Add(go);
        }
 public override ISurface GetOffsetSurface(double offset)
 {
     if (basisCurve.GetPlanarState() != PlanarState.NonPlanar)
     {
         Plane pln = Plane.XYPlane;
         if (basisCurve.GetPlanarState() == PlanarState.Planar)
         {
             pln = basisCurve.GetPlane();
         }
         else if (basisCurve.GetPlanarState() == PlanarState.UnderDetermined)
         {
             pln = new Plane(basisCurve.StartPoint, basisCurve.StartDirection, basisCurve.StartDirection ^ direction);
         }
         ICurve2D c2d  = basisCurve.GetProjectedCurve(pln);
         ICurve2D c2dp = c2d.Parallel(offset, false, Precision.eps, Math.PI);
         if (c2dp != null)
         {
             return(new SurfaceOfLinearExtrusion(c2dp.MakeGeoObject(pln) as ICurve, direction, curveStartParameter, curveEndParameter));
         }
     }
     return(new OffsetSurface(this, offset));
 }