马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 csharp 于 2014-4-20 16:05 编辑
- [CommandMethod("CurveReverse")]
- public static void CurveRevers()
- {
- Document document = Application.DocumentManager.MdiActiveDocument;
- Editor editor = document.Editor;
- Transaction transaction = document.TransactionManager.StartTransaction();
- TypedValue[] values = new TypedValue[]
- {
- new TypedValue((int) DxfCode.Start , "LINE,LWPOLYLINE,POLYLINE,SPLINE")
- };
- using (transaction )
- try
- {
- SelectionFilter filter = new SelectionFilter(values);
- PromptSelectionResult ssSelectionResult = editor.GetSelection(filter);
- if (ssSelectionResult.Status != PromptStatus.OK)
- {
- return;
- }
- foreach (ObjectId id in ssSelectionResult.Value.GetObjectIds())
- {
- Curve cv = (Curve) transaction.GetObject(id, OpenMode.ForWrite);
- cv.ReverseCurve();
- }
- transaction.Commit();
- }
- catch (Exception)
- {
-
- throw;
- }
- }
前面写一大段,主要就一句话 cv.ReverseCurve(); 还得慢慢适应 C#,从最简单的功能语句起步
相比 Autolisp 开始觉得有很多啰嗦地方,先要声明,然后再赋值,总觉得绕,习惯就好
反向不适合 ARC Circle Ellipse |