sachindkini
发表于 2023-3-2 19:13:31
dear sir
see demo.................
sachindkini
发表于 2023-3-2 19:21:04
(vl-load-com)
(defun C:DBB (/ n); = Draw Bounding Boxes
(prompt "\nTo draw bounding boxes around each,")
(if (setq ss (ssget))
(repeat (setq n (sslength ss)); then
(vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq n (1- n)))) 'minpt 'maxpt)
(command "_.rectangle" "_none" (vlax-safearray->list minpt) "_none" (vlax-safearray->list maxpt))
); repeat
); if
(princ)
); defun
(prompt "\nType DBB to Draw the Bounding Boxes of selected object(s).")
dakui
发表于 2023-3-2 19:42:49
sachindkini 发表于 2023-3-2 19:13
dear sir
see demo.................
能否求出的最小实体包围盒呢
希望大神能够完善一下.
梦想家-DING
发表于 2023-3-2 20:02:21
sachindkini 发表于 2023-3-2 19:21
Between Graphics and Graphics,Whether the replace operation can be changed in a central location?
d1742647821
发表于 2023-3-7 10:39:05
写这功能不超过5分钟
d1742647821
发表于 2023-3-7 10:45:24
本帖最后由 d1742647821 于 2023-3-7 10:46 编辑
看标题没写语言要求,.net区来凑热闹,短短30行,需要使用ifox
public static void CS5()
{
var r1 = Env.Editor.GetEntity("\n选择对象");
if (r1.Status != PromptStatus.OK)
return;
var r2 = Env.Editor.GetEntity("\n选择要替换的对象");
if (r2.Status != PromptStatus.OK || r2.ObjectId == r1.ObjectId)
return;
using var tr = new DBTrans();
var ent1 = (Entity)tr.GetObject(r1.ObjectId);
var ent2= (Entity)tr.GetObject(r2.ObjectId);
var pt1 = ent1.GeometricExtents.MidPoint();
var pt2 = ent2.GeometricExtents.MidPoint();
var ent3=(Entity)ent1.Clone();
ent3.Move(pt1, pt2);
tr.CurrentSpace.AddEntity(ent3);
Env.Editor.Redraw(ent3);
var pko = new PromptKeywordOptions("\n是否替换?<Y>");
pko.Keywords.Add("Y", "Y", "是(Y)");
pko.Keywords.Add("N", "N", "否(N)");
var r3 = Env.Editor.GetKeywords(pko);
if(r3.Status==PromptStatus.OK && r3.StringResult.ToUpper() == "Y")
{
ent2.ForWrite(e => e.Erase());
}
else
{
tr.Abort();
}
}
wzg356
发表于 2023-3-8 08:12:43
写过,自己常用,有空发
月下闲人
发表于 2023-3-8 10:47:28
sachindkini 发表于 2023-3-2 19:21
这个代码哪里不对
wzg356
发表于 2023-3-8 16:39:25
本帖最后由 wzg356 于 2023-3-8 16:43 编辑
看看是不是这种
早就高频使用了,觉得用的人不多,难度也不大,就没发
刚发这儿http://bbs.mjtd.com/thread-187313-1-1.html
梦想家-DING
发表于 2023-3-8 17:05:24
wzg356 发表于 2023-3-8 16:39
看看是不是这种
早就高频使用了,觉得用的人不多,难度也不大,就没发
是图形与图形,譬如:选中三角形替换圆形