欺心恶夫,官经,文心阁 可爱
[commandmethod("cbline")] //对称画线
public void cbline()
{
document doc = application.documentmanager.mdiactivedocument;
editor edit = doc.editor;
database db = doc.database;
using(transaction trans=doc.transactionmanager.starttransaction())
{
promptentityoptions peo = new promptentityoptions("请指定基准线\n");
promptentityresult per = edit.getentity(peo);
entity ent = trans.getobject(per.objectid, openmode.forwrite) as entity;
//if (ent.gettype()!=typeof(line))
if(!(ent is line))
{
edit.writemessage("指定的实体不是基准线!");
return;
}
line line = (line)ent;
line.colorindex = 1;
promptpointoptions ppo = new promptpointoptions("请指定第一点\n");
promptpointresult ppr = edit.getpoint(ppo);
point3d pt1=ppr.value;
promptpointoptions ppo1 = new promptpointoptions("请指定第二点\n");
promptpointresult ppr1 = edit.getpoint(ppo);
point3d pt2=ppr1.value;
point3d pt3 = line.getclosestpointto(pt1,true);
vector3d vt1 = pt3 - pt1;
point3d pt4 = new point3d(vt1.x+pt3.x,vt1.y+pt3.y,0);
point3d pt5 = line.getclosestpointto(pt2, true);
vector3d vt2 = pt5 - pt2;
point3d pt6 = new point3d(vt2.x + pt5.x, vt2.y + pt5.y, 0);
line line1 = new line(pt1, pt2);
line line2 = new line(pt4, pt6);
objectid idmodelspace = symbolutilityservices.getblockmodelspaceid(db);
blocktablerecord btr = trans.getobject(idmodelspace, openmode.forwrite) as blocktablerecord;
btr.appendentity(line1);
btr.appendentity(line2);
trans.addnewlycreateddbobject(line1, true);
trans.addnewlycreateddbobject(line2, true);
trans.commit();
}
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Net Core Web Api项目与在NginX下发布的方法
asp.net core3.1 引用的元包dll版本兼容性问题解决方案
IdentityServer4实现.Net Core API接口权限认证(快速入门)
ASP.NET Core MVC通过IViewLocationExpander扩展视图搜索路径的实现
网友评论