如何清除 Editor.DrawVector 绘制的矢量?
在使用Editor.DrawVector.编辑器之前,我想更新屏幕以清除矢量。除非当前视图已缩放或移动,否则UpdateScreen方法无法执行此操作
有没有快速清除矢量的方法?
**** Hidden Message ***** 我从您的一个帖子中看到您可能正在使用autocad 2008
,我在ac2009之前没有保留托管网络帮助文件...这两种方法在ac2009中都可用。
以下是我的代码:
子绘制屏幕线(ByVal起始点为Point3d,ByVal端点为Point3d)
Autodesk.AutoCAD.ApplicationServices.Application。UpdateScreen()
是Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor。UpdateScreen()<br>在绘制矢量之前清除矢量<br>Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor。DrawVector(起始点,端点,1,False)
结束子
我想清除编辑器绘制的向量。DrawVector(起点、终点、1、假)
但Autodesk.AutoCAD.ApplicationServices.Application。UpdateScreen()或Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor。UpdateScreen()不起作用。
你认为
UpdateScreen()
应该做它没有做的事情吗?
正如我之前问的:
你想清除哪些向量??
上次用DrawScreenLine画的向量。 看来我对ed的理解,UpdateScreen()也不正确,我以为它删除了临时图形...显然不是!也许我们需要做一个GraphicsFlush或pInvoke acedRedraw。我看看能不能让Kean感兴趣;这里可能有文章的内容,我将代码留给任何想跟进的人。我目前正在使用ed,regen();....但是对于大的绘图来说,它是昂贵的。 //概念验证代码2016-03-23。
//codehimbelonga kdub @ the swamp 。
。
使用系统;。
使用Autodesk,AutoCAD . Runtime。
使用Autodesk,应用服务;。
使用Autodesk,AutoCAD . DatabaseServices。
使用Autodesk,AutoCAD .几何图形;。
使用Autodesk,AutoCAD . EditorInput。
。
使用Autodesk,AutoCAD . Internal。
使用AcadApp = Autodesk,AutoCAD . application services . core . application;。
。
。
。
命名空间TestingUpdateScreen {。
公共类MyCommands {。
。
public void my command(){ 。
var doc = AcadApp,document manager . MdiActiveDocument;。
var ed = doc,编辑;。
tus 1();。
ed,WriteMessage("\n\n再做一次= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = \ n ");。
tus 1();。
ed,WriteMessage("\n\n清除上一个= = = = = = = = = = = = = = = = = = = = = = = \ n ");。
。
// ed,update screen();。
ed,regen();。
工具,post command prompt();。
}。
。
私有静态void TUS1() {。
var doc = AcadApp,document manager . MdiActiveDocument;。
var db = AcadApp,document manager . mdiactivedocument . database;。
var ed = doc,编辑;。
// - 。
PromptPointResult ppr1 = ed,get point(" \ n选取第一个点");。
if(ppr1,地位!=提示状态,好){。
返回;。
}。
Point3d sp = ppr1,价值;。
。
PromptPointOptions options = new PromptPointOptions(" \ n选取第二个点"){。
基点= sp,。
UseBasePoint = true,。
UseDashedLine = true。
};。
。
PromptPointResult ppr2 = ed,GetPoint(选项);。
。
if(ppr2,地位!=提示状态,好){。
返回;。
}。
Point3d ep = ppr2,价值;。
int colorIndex = 1;。
。
ed,DrawVector(@from: sp,。
收件人:ep,。
颜色:colorIndex,。
draw highlight:false);。
}。
}。
。
公共类InitMyCommands : Autodesk,AutoCAD . runtime . iextensionapplication { 。
public void Initialize(){ 。
AcadApp,document manager . mdiactivedocument . editor . write message(" \ n \ t \ t \ t * * *键入DOIT以运行测试\ t * * * ");。
}。
public void termin ate(){ 。
AcadApp,document manager . mdiactivedocument . editor . write message("正在清理...");。
}。
}。
}。
。
https://www.theswamp.org/index.php?topic = 12431 . msg 155901 # msg 155901
_
_
私有共享函数acedRedraw(ByVal name As Long(),ByVal mode As Integer)As Integer
End Function
_
Public Sub MyRedraw()
acedRedraw(Nothing,1)
End Sub kdub,谢谢你的帮助!! 如果您是循环的,难道不能在提交事务之前传递QueueForGraphicsFlush()吗?
页:
[1]