Hàm xử lý sự kiện PromptedForPoint
1 Thêm class myCommands.cs
Lưu mã sau dưới dạng tệp tin myCommands.cs
Code:
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using System.Collections.Generic;
namespace Chen_vach_kien_truc
{
public partial class MyCommands
{
private static List<Point3d> promptpts = new List<Point3d>();
[CommandMethod("Get_Selection_PTS", CommandFlags.Modal | CommandFlags.Redraw)]
public void Get_Selection_PTS()
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
promptpts = new List<Point3d>();
ed.PromptedForPoint += Ed_PromptedForPoint;
var psr = ed.GetSelection();
ed.PromptedForPoint -= Ed_PromptedForPoint;
if (psr.Status != PromptStatus.OK) return;
var so = psr.Value[0];
var t = so.GetType();
var mt = so.SelectionMethod;
var dt = so.OptionalDetails;
//So sánh và sử dụng promptpts vs so.SelectionMethod [mt]
}
private void Ed_PromptedForPoint(object sender, PromptPointResultEventArgs e)
{
promptpts.Add(pt4);
}
}
}---------------------------------------------------------------------------------------------
Mọi thông tin xin liên hệ Fanpage AutoLISP Thật là đơn giản!
Cảm ơn bạn đã theo dõi!

Không có nhận xét nào:
Đăng nhận xét