AutoCAD .Net EntityJig – Jig Line by Start and End Points
来源:互联网 发布:淘宝店铺怎么看退货率 编辑:程序博客网 时间:2024/06/05 09:20
本实例展示使用 EntityJig 技术,动态交互模式创建直线。
翻译自: AutoCAD .NET: EntityJig – Jig Line by Start and End Points
using Autodesk.AutoCAD.Runtime;using Autodesk.AutoCAD.ApplicationServices;using Autodesk.AutoCAD.DatabaseServices;using Autodesk.AutoCAD.Geometry;using Autodesk.AutoCAD.EditorInput;public class JigLineSample{ [CommandMethod("JigLine")] public static void JigLine() { Document doc = Application.DocumentManager.MdiActiveDocument; if (LineJigger.Jig()) { doc.Editor.WriteMessage("\nsuccess\n"); } else { doc.Editor.WriteMessage("\nfailure\n"); } }}public class LineJigger : EntityJig{ public Point3d endPnt = new Point3d(); public LineJigger(Line line) : base(line) { } protected override bool Update() { Document doc = Application.DocumentManager.MdiActiveDocument; (Entity as Line).EndPoint = endPnt; return true; } protected override SamplerStatus Sampler(JigPrompts prompts) { Document doc = Application.DocumentManager.MdiActiveDocument; JigPromptPointOptions prOptions1 = new JigPromptPointOptions("\nNext point:"); prOptions1.BasePoint = (Entity as Line).StartPoint; prOptions1.UseBasePoint = true; prOptions1.UserInputControls = UserInputControls.Accept3dCoordinates | UserInputControls.AnyBlankTerminatesInput | UserInputControls.GovernedByOrthoMode | UserInputControls.GovernedByUCSDetect | UserInputControls.UseBasePointElevation | UserInputControls.InitialBlankTerminatesInput | UserInputControls.NullResponseAccepted; PromptPointResult prResult1 = prompts.AcquirePoint(prOptions1); if (prResult1.Status == PromptStatus.Cancel) return SamplerStatus.Cancel; if (prResult1.Value.Equals(endPnt)) { return SamplerStatus.NoChange; } else { endPnt = prResult1.Value; return SamplerStatus.OK; } } #region public static bool Jig() { try { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; PromptPointResult ppr = doc.Editor.GetPoint("\nStart point:"); if (ppr.Status != PromptStatus.OK) return false; Point3d pt = ppr.Value; Line line = new Line(pt, pt); line.TransformBy(doc.Editor.CurrentUserCoordinateSystem); LineJigger jigger = new LineJigger(line); PromptResult pr = doc.Editor.Drag(jigger); if (pr.Status == PromptStatus.OK) { using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord modelSpace = tr.GetObject( bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; modelSpace.AppendEntity(jigger.Entity); tr.AddNewlyCreatedDBObject(jigger.Entity, true); tr.Commit(); } } else { line.Dispose(); return false; } return true; } catch { return false; } } #endregion}
阅读全文
0 0
- AutoCAD .Net EntityJig – Jig Line by Start and End Points
- AutoCAD .NET: EntityJig – Dynamic Dimension and Line Jig
- AutoCAD .Net EntityJig – Dynamic Dimension and Line Jig
- AutoCAD .Net EntityJig – Jig Circle by Center and Radius
- Creating a multileader in AutoCAD using a jig from .NET
- 15.1 End points and reachability
- AutoCAD .Net 创建直线Line
- Application event: start, end and session event (VB.net)
- Deploy Ceph and start using it: end to end tutorial – Installation (part 1/3)
- JIG(即时绘图)-直线即时绘图-EntityJig(单实体即时绘图)
- MANUAL and AUTOMATIC start/end modes
- Leetcode_max-points-on-a-line(c++ and python version)
- End the line…and the Endless development
- trance line 's end openshort and link reactance
- vim separate with . and replace all to end of line
- Accessing the AutoCAD objects referred to by fields using .NET
- While it is not the end of a file, output file line by line
- Api development and mobile end development start concurrently
- 波动序列
- 在阿里云ECS里安装Windows 7 32位中文版
- android自定义View之仿通讯录侧边栏滑动,实现A-Z字母检索
- 分布式资源调度系统 YARN
- css基础———box-sizing—标准盒模型&怪异盒模型
- AutoCAD .Net EntityJig – Jig Line by Start and End Points
- rabbitmq--延时队列
- JavaScript 开发者:最喜欢 React,Vue.js 比 Angular 更值得尝试 | 2017 JS 调查报告
- 【kafka】kafka安装配置以及遇到的问题
- Core2.0_EF_DbFirst的安装
- 【智能零售】60页实地调研报告诉你,零售老板从哪里打响逆袭第一枪?
- 【共享经济】披着共享经济外衣的租赁经济
- CentOS之DNS服务器安装-yellowcong
- UVA