坐标点的精度如何控制
在拾取坐标时,想把坐标保留到一位小数该怎么表达,望高人指点。 貌似斑竹不在啊 修改设置就可以了(command "text" ......... (rtos x 2 1))
(command "text" ........ (rtos y 2 1)) Math.Round 帮我看一下坐标保留到一位小数 如何设置? 求高手帮帮忙!
public void testfunction2()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = HostApplicationServices.WorkingDatabase;
SelectionFilter sf = new SelectionFilter(new TypedValue[]{ new TypedValue(0, "Line") });
PromptSelectionResult psr = ed.GetSelection(sf);
if (psr.Status != PromptStatus.OK)
return;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord curSpace = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
foreach (ObjectId id in psr.Value.GetObjectIds())
{
Entity ent = tr.GetObject(id, OpenMode.ForRead) as Entity;
if (ent.GetType() == typeof(Line))
{
Line l = ent as Line;
Point3d pt1 = l.StartPoint;
Point3d pt2 = l.EndPoint;
ed.WriteMessage("\n" + pt1 + pt2);
}
else
{
}
}
tr.Commit();
}
} Point3d pt = new Point3d(12.345,56.567,0);
ed.WriteMessage("\nPoint:{0:f2}", pt); 问题解决,感谢飞狐大哥的帮忙
页:
[1]