如何获得分堆分组后包围盒的四个角点,然后用直线连接起来
本帖最后由 haoxuan 于 2024-2-8 15:37 编辑http://bbs.mjtd.com/forum.php?mo ... 448&fromuid=7332155 (出处: 明经CAD社区)]【K:RtnBox4SSGroup】矩形分堆/方框分堆 http://bbs.mjtd.com/forum.php?mo ... 448&fromuid=7332155 (出处: 明经CAD社区)
如何取出分堆分组后包围盒的四个角点,然后赋予变量P1、P2、P3、P4
(setq lst (K:RtnBox4SSGroup(ssget) 5))
(foreach pts lst
(setq
zx(car pts)
ys(cadr pts)
zs(list (car zx)(cadr ys))
yx(list (car ys)(cadr zx))
)
(entmake (list '(0 . "line") (cons 10 zx) (cons 11 zs)))
(entmake (list '(0 . "line") (cons 10 zs) (cons 11 ys)))
(entmake (list '(0 . "line") (cons 10 ys) (cons 11 yx)))
(entmake (list '(0 . "line") (cons 10 zx) (cons 11 yx)))
) 谁知道啊谁知道啊谁知道啊谁知道啊 本帖最后由 d1742647821 于 2024-3-11 11:11 编辑
powered by IFoxCAD
https://gitee.com/inspirefunction/ifoxcad
https://www.kdocs.cn/l/cc6ZXSa0vMgD
var r1 = Env.Editor.GetSelection();
if (r1.Status != PromptStatus.OK)
return;
using var tr = new DBTrans();
var entList = r1.Value.GetEntities<Entity>().Select(e =>
{
var bi = e.GetBoundingBoxEx();
if (bi.HasValue)
return bi.Value;
var e3d = new Extents3d();
foreach (var stretchPoint in e.GetStretchPoints())
{
e3d.AddPoint(stretchPoint);
}
return new BoundingInfo(e3d);
}).ToList();
var boxGroup = entList.Friends((e1, e2) =>
{
var vec = e1.MidCenter.GetVectorTo(e2.MidCenter);
return vec.X < (e1.Width * 0.5 + e2.Width * 0.5) &&
vec.Y < (e1.Height * 0.5 + e2.Height * 0.5);
});
foreach (var list in boxGroup)
{
var e3d = new Extents3d();
foreach (var info in list)
{
e3d.AddExtents(info.Extents3d);
}
tr.CurrentSpace.AddEntity(e3d.GetRecPoint2ds().ToPolyline(0, true));
}
能把要求再写清楚点吗? (setq lst (K:RtnBox4SSGroup(ssget) 6))
(foreach pp lst
;;赋值P1~4
(setq p1(carpp) p3(cadr pp))
(setq p2(list (car p3) (cadr p1)))
(setq p4(list (car p1) (cadr p3)))
(setq 4pt(list p1 p2 p3 p4))
;;测试
(foreach p 4pt (getpoint p))
)
飞雪神光 发表于 2024-1-26 11:09
感谢分享,如何把分后的每个对象进行移动到指定点呢,(command pts "" zx pt)好像不对,请大神解答 muai2010 发表于 2024-7-3 17:52
感谢分享,如何把分后的每个对象进行移动到指定点呢,(command pts "" zx pt)好像不对,请大神解答
点的集合,又不是对象 czb203 发表于 2024-7-3 23:13
点的集合,又不是对象
嗯,就是想知道怎么把对象提取出来移动,试了好久还在试
页:
[1]