コード例 #1
0
 public NodePointMultiConnectionLine(MultiConnectionLines owner, ePoint id)
 {
     m_owner         = owner;
     m_clone         = owner.Clone() as MultiConnectionLines;
     m_pointId       = id;
     m_originalPoint = GetPoint(m_pointId);
 }
コード例 #2
0
 public NodePointLine(Line owner, ePoint id)
 {
     m_owner         = owner;
     m_clone         = m_owner.Clone() as Line;
     m_pointId       = id;
     m_originalPoint = GetPoint(m_pointId);
 }
コード例 #3
0
 public NodePointCubicBezier(CubicBezier owner, ePoint id)
 {
     m_owner         = owner;
     m_clone         = owner.Clone() as CubicBezier;
     m_pointId       = id;
     m_originalPoint = GetPoint(m_pointId);
 }
コード例 #4
0
ファイル: LineTool.cs プロジェクト: sduxiaowu/NineLineScore
 public NodePointLine(Line owner, ePoint id)
 {
     m_owner = owner;
     m_clone = m_owner.Clone() as Line;
     m_pointId = id;
     m_originalPoint = GetPoint(m_pointId);
 }
コード例 #5
0
 /// <summary>
 /// 赋值,初始化图形开始点
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="id"></param>
 public RectangleTool(Rectangle owner, ePoint id)
 {
     m_owner         = owner;
     m_clone         = m_owner.Clone() as Rectangle;
     m_pointId       = id;
     m_originalPoint = GetPoint(m_pointId);
 }
コード例 #6
0
ファイル: LineTool.cs プロジェクト: sduxiaowu/NineLineScore
 protected UnitPoint GetPoint(ePoint pointid)
 {
     if (pointid == ePoint.P1)
         return m_clone.P1;
     if (pointid == ePoint.P2)
         return m_clone.P2;
     return m_owner.P1;
 }
コード例 #7
0
        //private BezierCurve bezierCurve;
        //private ePoint p1;

        //克隆当前图形,并在克隆的基础上进行修改
        public BezierCurveTool(BezierCurve owner, ePoint id)
        {
            m_owner         = owner;
            m_clone         = m_owner.Clone() as BezierCurve;
            m_pointId       = id;
            m_originalPoint = GetPoint(m_pointId);
            //Console.WriteLine("finish  " + m_pointId + "  " + m_clone.P1.X + "," + m_clone.P1.Y + "  " + m_clone.P2.X + "," + m_clone.P2.Y + "  " + m_clone.P3.X + "," + m_clone.P3.Y + "  " + m_clone.P4.X + "," + m_clone.P4.Y + "  ");
        }
コード例 #8
0
 public NodePointRectBase(RectBase owner, ePoint id)
 {
     m_owner = owner;
     m_clone = m_owner.Clone() as RectBase;
     m_clone.CurrentPoint = m_owner.CurrentPoint;
     m_originalPoint      = GetPoint(id);
     m_pointId            = id;
 }
コード例 #9
0
 /// <summary>
 /// 获取线上的另一个端点
 /// </summary>
 /// <param name="currentpointid"></param>
 /// <returns></returns>
 protected UnitPoint OtherPoint(ePoint currentpointid)
 {
     if (currentpointid == ePoint.P1)
     {
         return(GetPoint(ePoint.P2));
     }
     return(GetPoint(ePoint.P1));
 }
コード例 #10
0
 protected void SetPoint(ePoint pointid, UnitPoint point, CubicBezier crv)
 {
     if (pointid == ePoint.P1)
     {
         crv.P1 = point;
     }
     if (pointid == ePoint.P2)
     {
         crv.P2 = point;
     }
 }
コード例 #11
0
 protected void SetPoint(ePoint pointid, UnitPoint point, MultiConnectionLines crv)
 {
     if (pointid == ePoint.P1)
     {
         crv.P1 = point;
     }
     if (pointid == ePoint.P2)
     {
         crv.P2 = point;
     }
 }
コード例 #12
0
 protected void SetPoint(ePoint pointid, UnitPoint point, Line line)
 {
     if (pointid == ePoint.P1)
     {
         line.P1 = point;
     }
     if (pointid == ePoint.P2)
     {
         line.P2 = point;
     }
 }
コード例 #13
0
 /// <summary>
 /// 设置线段端点
 /// </summary>
 /// <param name="pointid"></param>
 /// <param name="point"></param>
 /// <param name="rectangle"></param>
 protected void SetPoint(ePoint pointid, UnitPoint point, Rectangle rectangle)
 {
     if (pointid == ePoint.P1)
     {
         rectangle.P1 = point;
     }
     if (pointid == ePoint.P2)
     {
         rectangle.P2 = point;
     }
 }
コード例 #14
0
 /// <summary>
 /// 获取线上的端点
 /// </summary>
 /// <param name="pointid"></param>
 /// <returns></returns>
 protected UnitPoint GetPoint(ePoint pointid)
 {
     if (pointid == ePoint.P1)
     {
         return(m_clone.P1);
     }
     if (pointid == ePoint.P2)
     {
         return(m_clone.P2);
     }
     return(m_owner.P1);
 }
コード例 #15
0
 public NodePointLine(LineTool owner, ePoint id)
 {
     try
     {
         m_owner         = owner;
         m_clone         = m_owner.Clone() as LineTool;
         m_pointId       = id;
         m_originalPoint = GetPoint(m_pointId);
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #16
0
 protected UnitPoint OtherPoint(ePoint currentpointid)
 {
     try
     {
         if (currentpointid == ePoint.P1)
         {
             return(GetPoint(ePoint.P2));
         }
         return(GetPoint(ePoint.P1));
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #17
0
 protected void SetPoint(ePoint pointid, UnitPoint point, RectBase oval)
 {
     if (pointid == ePoint.P1)
     {
         oval.P1 = point;
     }
     else if (pointid == ePoint.P3)
     {
         oval.P3 = point;
     }
     else if (pointid == ePoint.Center)
     {
         oval.Center = point;
     }
 }
コード例 #18
0
 protected void SetPoint(ePoint pointid, UnitPoint point, LineTool line)
 {
     try
     {
         if (pointid == ePoint.P1)
         {
             line.P1 = point;
         }
         if (pointid == ePoint.P2)
         {
             line.P2 = point;
         }
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #19
0
 protected UnitPoint GetPoint(ePoint pointid)
 {
     try
     {
         if (pointid == ePoint.P1)
         {
             return(m_clone.P1);
         }
         if (pointid == ePoint.P2)
         {
             return(m_clone.P2);
         }
         return(m_owner.P1);
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #20
0
 protected UnitPoint GetPoint(ePoint pointid)
 {
     if (pointid == ePoint.P1)
     {
         return(m_clone.P1);
     }
     else if (pointid == ePoint.P3)
     {
         return(m_clone.P3);
     }
     else if (pointid == ePoint.Center)
     {
         return(m_clone.Center);
     }
     else
     {
         Debug.Assert(false);
     }
     return(m_owner.P1);
 }
コード例 #21
0
 /// <summary>
 /// 设置变动后的端点端点
 /// </summary>
 /// <param name="pointid"></param>
 /// <param name="point"></param>
 /// <param name="line"></param>
 protected void SetPoint(ePoint pointid, UnitPoint point, BezierCurve bezierCurve)
 {
     if (pointid == ePoint.P1)
     {
         bezierCurve.P1 = point;
         return;
     }
     if (pointid == ePoint.P2)
     {
         bezierCurve.P2 = point;
         return;
     }
     if (pointid == ePoint.P3)
     {
         bezierCurve.P3 = point;
         return;
     }
     if (pointid == ePoint.P4)
     {
         bezierCurve.P4 = point;
         return;
     }
 }
コード例 #22
0
        protected override void Command()
        {
            try
            {
                if (MdlBase.eSelect_RecupererTypeObjet() != e_swSelectType.swSelFACES)
                {
                    return;
                }

                var face = MdlBase.eSelect_RecupererObjet <Face2>();

                var sm = MdlBase.SketchManager;

                sm.InsertSketch(false);

                MdlBase.SketchOffsetEntities2(Decal * -0.001, false, false);

                MdlBase.eEffacerSelection();

                var sk = sm.ActiveSketch;

                SketchPoint PremierPoint = null;
                var         arrCt        = (object[])sk.GetSketchContours();
                foreach (SketchContour ct in arrCt)
                {
                    var arrSeg = (object[])ct.GetSketchSegments();
                    foreach (SketchSegment sg in arrSeg)
                    {
                        if (sg.eType() != swSketchSegments_e.swSketchLINE)
                        {
                            continue;
                        }

                        sg.ConstructionGeometry = true;
                        var sl  = (SketchLine)sg;
                        var lg  = sg.GetLength() * 1000.0;
                        var nb  = Math.Floor(lg / 300.0);
                        var pas = lg / (nb + 1);
                        nb = Math.Max(0, pas > 200 ? nb : nb - 1);
                        var ptDepart = new ePoint((SketchPoint)sl.GetStartPoint2());

                        if (nb > 0)
                        {
                            sg.eSelect(MdlBase, 1, false);
                            sg.EqualSegment((int)swSketchSegmentType_e.swSketchSegmentType_sketchpoints, (int)nb);
                        }

                        if (PremierPoint.IsNull())
                        {
                            PremierPoint = (SketchPoint)sl.GetStartPoint2();

                            sm.AddToDB = true;

                            var sgCercle = sm.CreateCircleByRadius(PremierPoint.X, PremierPoint.Y, PremierPoint.Z, 0.005);
                            PremierPoint.eSelect(MdlBase, 0, false);
                            sgCercle.eSelect(MdlBase, 0, true);
                            MdlBase.SketchAddConstraints("sgCONCENTRIC");

                            sgCercle.eSelect(MdlBase, 0, false);

                            var reg = App.Sw.GetUserPreferenceToggle((int)swUserPreferenceToggle_e.swInputDimValOnCreate);
                            App.Sw.SetUserPreferenceToggle((int)swUserPreferenceToggle_e.swInputDimValOnCreate, false);

                            var dispdim = (DisplayDimension)MdlBase.AddDiameterDimension2(PremierPoint.X, PremierPoint.Y, PremierPoint.Z);

                            App.Sw.SetUserPreferenceToggle((int)swUserPreferenceToggle_e.swInputDimValOnCreate, reg);
                            //var dim = dispdim.GetDimension2(0);

                            sm.AddToDB = false;
                        }
                        else
                        {
                            sm.CreatePoint(ptDepart.X, ptDepart.Y, ptDepart.Z);
                        }
                    }
                }

                sm.InsertSketch(true);

                var fm = MdlBase.FeatureManager;

                MdlBase.eEffacerSelection();

                var bd      = (Body2)face.GetBody();
                var fSketch = (Feature)sk;

                fSketch.eSelectionnerById2(MdlBase, 0, true);
                bd.eSelect(MdlBase, 8, true);
                var fPercage = fm.FeatureCut4(true, false, false, (int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind, 0.02, 0.02, false, false, false, false, 0, 0, false, false, false, false, false, true, false, true, true, false, 0, 0, false, false);

                MdlBase.eEffacerSelection();

                fPercage.eSelectionnerById2(MdlBase, 4, true);
                PremierPoint.eSelect(MdlBase, 32, true);
                fSketch.eSelectionnerById2(MdlBase, 64, true);
                bd.eSelect(MdlBase, 512, true);

                var featRepetDef = (SketchPatternFeatureData)fm.CreateDefinition((int)swFeatureNameID_e.swFmSketchPattern);
                featRepetDef.GeometryPattern = true;
                featRepetDef.UseCentroid     = false;
                var featRepet = fm.CreateFeature(featRepetDef);

                WindowLog.Ecrire("Repetition : " + featRepet.IsRef());
            }
            catch (Exception e)
            {
                this.LogMethode(new Object[] { e });
            }
        }
コード例 #23
0
ファイル: Module.cs プロジェクト: jjacksons/GLUE
 public NP(Module owner, ePoint id)
 {
     m_owner = owner;
     m_clone = m_owner.Clone() as Module;
     m_pointId = id;
     m_originalPoint = GetPoint(m_pointId);
 }
コード例 #24
0
ファイル: Module.cs プロジェクト: jjacksons/GLUE
        public virtual eDrawObjectMouseDown OnMouseDown(ICanvas canvas, UnitPoint point, ISnapPoint snappoint)
        {
            if (!tofrom && !child)
            {
                foreach (IDrawObject i in canvas.DataModel.GetHitObjects(canvas, point)) if (i.GetType().ToString().IndexOf("Module") >= 0 && i != this)
                    {
                        from_connections = (ModuleItems.Module)i;
                        if (from_connections.ToPoint == point) foreach (Property p in from_connections.properties) if (p.name == "to") foreach (Property q in properties) if (q.name == "name") p.value = q.value;
                        if (from_connections.FromPoint == point) foreach (Property p in from_connections.properties) if (p.name == "from") foreach (Property q in properties) if (q.name == "name") p.value = q.value;
                    }

                return eDrawObjectMouseDown.Done;
            }
            if (currentPoint == ePoint.FromPoint)
            {
                m_p1 = point;
                currentPoint = ePoint.StartPoint;
                foreach (IDrawObject i in canvas.DataModel.GetHitObjects(canvas, point)) if (i.GetType().ToString().IndexOf("Module") >= 0 && i != this) from_connections = (ModuleItems.Module)i;
                if (from_connections != null) foreach (Property p in properties) if (p.name == "from") foreach (Property q in from_connections.properties) if (q.name == "name") p.value = q.value;
                if (from_connections != null && child) foreach (Property p in properties) if (p.name == "parent") foreach (Property q in from_connections.properties) if (q.name == "name") p.value = q.value;
                return eDrawObjectMouseDown.Continue;
            }
            if (currentPoint == ePoint.StartPoint)
            {
                currentPoint = ePoint.EndPoint;
                if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Module)
                {
                    Module src = snappoint.Owner as Module;
                    m_p2 = HitUtil.NearestPointOnLine(src.FromPoint, src.EndPoint, m_p1, true);
                    if (horizontal) m_p3 = new UnitPoint(m_p2.X + 1, m_p2.Y);
                    else m_p3 = new UnitPoint(m_p2.X, m_p2.Y - 1);
                    if (child) return eDrawObjectMouseDown.Done;
                    return eDrawObjectMouseDown.Continue;
                }
                if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Canvas.DrawTools.Line)
                {
                    Canvas.DrawTools.Line src = snappoint.Owner as Canvas.DrawTools.Line;
                    m_p2 = HitUtil.NearestPointOnLine(src.P1, src.P2, m_p1, true);
                    if (horizontal) m_p3 = new UnitPoint(m_p2.X + 1, m_p2.Y);
                    else m_p3 = new UnitPoint(m_p2.X, m_p2.Y - 1);
                    if (child) return eDrawObjectMouseDown.Done;
                    return eDrawObjectMouseDown.Continue;
                }
                if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Canvas.DrawTools.Arc)
                {
                    Canvas.DrawTools.Arc src = snappoint.Owner as Canvas.DrawTools.Arc;
                    m_p2 = HitUtil.NearestPointOnCircle(src.Center, src.Radius, m_p1, 0);
                    if (horizontal) m_p3 = new UnitPoint(m_p2.X + 1, m_p2.Y);
                    else m_p3 = new UnitPoint(m_p2.X, m_p2.Y - 1);
                    if (child) return eDrawObjectMouseDown.Done;
                    return eDrawObjectMouseDown.Continue;
                }
                if (Control.ModifierKeys == Keys.Control)
                    point = HitUtil.OrthoPointD(m_p1, point, 45);
                m_p2 = point;
                if (horizontal) m_p3 = new UnitPoint(m_p2.X + 1, m_p2.Y);
                else m_p3 = new UnitPoint(m_p2.X, m_p2.Y - 1);
                if (child) return eDrawObjectMouseDown.Done;
                return eDrawObjectMouseDown.Continue;
            }
            Selected = false;
            currentPoint = ePoint.ToPoint;
            if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Module)
            {
                Module src = snappoint.Owner as Module;
                m_p4 = HitUtil.NearestPointOnLine(src.FromPoint, src.EndPoint, m_p3, true);
                return eDrawObjectMouseDown.Done;
            }
            if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Canvas.DrawTools.Line)
            {
                Canvas.DrawTools.Line src = snappoint.Owner as Canvas.DrawTools.Line;
                m_p4 = HitUtil.NearestPointOnLine(src.P1, src.P2, m_p3, true);
                return eDrawObjectMouseDown.Done;
            }
            if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Canvas.DrawTools.Arc)
            {
                Canvas.DrawTools.Arc src = snappoint.Owner as Canvas.DrawTools.Arc;
                m_p4 = HitUtil.NearestPointOnCircle(src.Center, src.Radius, m_p3, 0);
                return eDrawObjectMouseDown.Done;
            }
            if (Control.ModifierKeys == Keys.Control)
                point = HitUtil.OrthoPointD(m_p1, point, 45);
            m_p4 = point;
            foreach (IDrawObject i in canvas.DataModel.GetHitObjects(canvas, point)) if (i.GetType().ToString().IndexOf("Module") >= 0 && i != this) to_connections = (ModuleItems.Module)i;
            if (to_connections != null) foreach (Property p in properties) if (p.name == "to") foreach (Property q in to_connections.properties) if (q.name == "name") p.value = q.value;
            return eDrawObjectMouseDown.Done;
        }
コード例 #25
0
ファイル: Module.cs プロジェクト: jjacksons/GLUE
 protected UnitPoint OtherPoint(ePoint currentpointid)
 {
     if (currentpointid == ePoint.StartPoint)
         return GetPoint(ePoint.EndPoint);
     return GetPoint(ePoint.StartPoint);
 }
コード例 #26
0
ファイル: Module.cs プロジェクト: jjacksons/GLUE
 protected UnitPoint GetPoint(ePoint pointid)
 {
     if (pointid == ePoint.FromPoint)
         return m_clone.FromPoint;
     if (pointid == ePoint.StartPoint)
         return m_clone.StartPoint;
     if (pointid == ePoint.EndPoint)
         return m_clone.EndPoint;
     if (pointid == ePoint.ToPoint)
         return m_clone.ToPoint;
     return m_owner.StartPoint;
 }
コード例 #27
0
ファイル: Module.cs プロジェクト: jjacksons/GLUE
        protected void SetPoint(ePoint pointid, UnitPoint point, Module mod)
        {
            if (pointid == ePoint.FromPoint)
            {
                mod.FromPoint = point;

            }
            if (pointid == ePoint.ToPoint) mod.ToPoint = point;
            if (pointid == ePoint.StartPoint)
            {
                mod.StartPoint = point;
                if ((mod.horizontal && mod.EndPoint.X == mod.StartPoint.X + 1 && mod.EndPoint.Y == mod.StartPoint.Y) || (!mod.horizontal && mod.EndPoint.Y == mod.StartPoint.Y+1 && mod.EndPoint.X == mod.StartPoint.X)) return;
                if (mod.horizontal) point.X += 1;
                else point.Y +=1;
                SetPoint(ePoint.EndPoint, point, mod);

            }
            if (pointid == ePoint.EndPoint)
            {
                mod.EndPoint = point;
                if ((mod.horizontal && mod.EndPoint.X == mod.StartPoint.X + 1 && mod.EndPoint.Y == mod.StartPoint.Y) || (!mod.horizontal && mod.EndPoint.Y == mod.StartPoint.Y + 1 && mod.EndPoint.X == mod.StartPoint.X)) return;
                if (mod.horizontal) point.X -= 1;
                else point.Y -= 1;
                SetPoint(ePoint.StartPoint, point, mod);

            }
        }
コード例 #28
0
ファイル: UIPoint.cs プロジェクト: chenzhimeng/Jump
 public void Init(int p, ePoint t)
 {
     point = p;
     type  = t;
     UpdateText();
 }
コード例 #29
0
ファイル: Test3.cs プロジェクト: Titifonky/SwExtension
        protected override void Command()
        {
            try
            {
                Face2         face    = null;
                SketchSegment segment = null;

                if (MdlBase.eSelect_RecupererTypeObjet(1) == e_swSelectType.swSelFACES)
                {
                    face    = MdlBase.eSelect_RecupererObjet <Face2>(1);
                    segment = MdlBase.eSelect_RecupererObjet <SketchSegment>(2);
                }
                else
                {
                    face    = MdlBase.eSelect_RecupererObjet <Face2>(2);
                    segment = MdlBase.eSelect_RecupererObjet <SketchSegment>(1);
                }

                if (face == null || segment == null)
                {
                    return;
                }

                MdlBase.eEffacerSelection();

                Boolean r       = false;
                Boolean reverse = false;

                var sk    = segment.GetSketch();
                var xform = (MathTransform)sk.ModelToSketchTransform.Inverse();

                if (segment.GetType() != (int)swSketchSegments_e.swSketchLINE)
                {
                    return;
                }

                var sl = (SketchLine)segment;

                var start = new ePoint(sl.GetStartPoint2());
                var end   = new ePoint(sl.GetEndPoint2());

                start.ApplyMathTransform(xform);
                end.ApplyMathTransform(xform);

                WindowLog.Ecrire(start.IsRef() + " " + start.ToString());
                WindowLog.Ecrire(end.IsRef() + " " + end.ToString());

                var box = (Double[])face.GetBox();

                var pt = new ePoint((box[3] + box[0]) * 0.5, (box[4] + box[1]) * 0.5, (box[5] + box[2]) * 0.5);
                WindowLog.Ecrire(pt.IsRef() + " " + pt.ToString());

                if (start.Distance2(pt) > end.Distance2(pt))
                {
                    reverse = true;
                }

                r = face.eSelectEntite(MdlBase, 4, false);

                r = segment.eSelect(MdlBase, 1, true);

                var cp = (Body2)face.GetBody();
                r = cp.eSelect(MdlBase, 512, true);

                var fm           = MdlBase.FeatureManager;
                var featRepetDef = (CurveDrivenPatternFeatureData)fm.CreateDefinition((int)swFeatureNameID_e.swFmCurvePattern);

                featRepetDef.D1AlignmentMethod  = 0;
                featRepetDef.D1CurveMethod      = 0;
                featRepetDef.D1InstanceCount    = 3;
                featRepetDef.D1IsEqualSpaced    = true;
                featRepetDef.D1ReverseDirection = reverse;
                featRepetDef.D1Spacing          = 0.001;
                featRepetDef.D2InstanceCount    = 1;
                featRepetDef.D2IsEqualSpaced    = false;
                featRepetDef.D2PatternSeedOnly  = false;
                featRepetDef.D2ReverseDirection = false;
                featRepetDef.D2Spacing          = 0.001;
                featRepetDef.GeometryPattern    = true;

                var featRepet = fm.CreateFeature(featRepetDef);

                WindowLog.Ecrire(featRepet != null);
            }
            catch (Exception e)
            {
                this.LogMethode(new Object[] { e });
                WindowLog.Ecrire(new Object[] { e });
            }
        }
コード例 #30
0
ファイル: LineTool.cs プロジェクト: sduxiaowu/NineLineScore
 protected UnitPoint OtherPoint(ePoint currentpointid)
 {
     if (currentpointid == ePoint.P1)
         return GetPoint(ePoint.P2);
     return GetPoint(ePoint.P1);
 }
コード例 #31
0
ファイル: LineTool.cs プロジェクト: sduxiaowu/NineLineScore
 protected void SetPoint(ePoint pointid, UnitPoint point, Line line)
 {
     if (pointid == ePoint.P1)
         line.P1 = point;
     if (pointid == ePoint.P2)
         line.P2 = point;
 }