Net Core教程

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));
                    });
                }
            }
        }

 

这篇关于C# Cad 拉伸 关键 GetStretchPoints MoveStretchPointsAt的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!