编程语言
首页 > 编程语言> > C# Cad 拉伸 关键 GetStretchPoints MoveStretchPointsAt

C# Cad 拉伸 关键 GetStretchPoints MoveStretchPointsAt

作者:互联网

  /// <summary>
        /// 拉伸
        /// </summary>
        [CommandMethod("ALS")]
        public void Tensile()
        {
            var ids = Editor.Selection($"\n选择图形");
            ids = ids.Deletes();
            if (ids == null || !ids.Any()) return;

            var beginPoint = Editor.Point("\n指定绘图起点");
            if (beginPoint.IsNull()) return;

            var entitys = ids.QOpenForRead<Entity>();
            // Surface surface = new Autodesk.AutoCAD.DatabaseServices.Surface();  

            var ent1 = entitys[0];
            var ent2 = entitys[1];
            var newEntitys = new List<Entity>();
            newEntitys.Add(ent2);

            //var ddd = ent1.JoinEntities(newEntitys.ToArray()); 
            foreach (var item in entitys)
            {
                IntegerCollection dddd = new IntegerCollection();
                var stretchPoints = new Point3dCollection();
                item.GetStretchPoints(stretchPoints);

                for (int i = 0; i < stretchPoints.Count; i++)
                {
                    var p = stretchPoints[i];
                    if (p.Coincide(beginPoint, 0.01))
                    {
                        dddd.Add(i);
                    }
                }
                if (dddd.Count > 0)
                {
                    item.ObjectId.QOpenForWrite<Entity>(c =>
                    {
                        c.MoveStretchPointsAt(dddd, new Vector3d(100, 0, 0));
                    });
                }
            }
        }

 

标签:stretchPoints,C#,ids,entitys,dddd,GetStretchPoints,var,new,MoveStretchPointsAt
来源: https://www.cnblogs.com/shangdishijiao/p/15686414.html