乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 121|回复: 7

瞬态图形

[复制链接]

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2016-7-14 01:07:52 | 显示全部楼层 |阅读模式
直到今晚,我一直避免短暂的图形。我把一些东西永久地卡在了一幅画里,从那以后,它给了我一点临阵退缩的感觉。我想沿着光标画一个圆,下面的代码显示我正在监视我的光标位置,但是我的圆圈只有在我重新生成时才会更新。我想让圆圈简单地跟随我的光标,感谢任何帮助。谢谢!   使用Autodesk,应用服务;。
使用Autodesk,AutoCAD . DatabaseServices。
使用Autodesk,AutoCAD . EditorInput。
使用Autodesk,AutoCAD .几何图形;。
使用Autodesk,AutoCAD . Runtime。
使用graphicinterface = Autodesk,AutoCAD . GraphicsInterface。

公共类PointMonitorTooltips。

{。
private static DBObjectCollection markers = new DBObjectCollection();。
private static integer collection collections = new integer collection();。
私静圈圈;。

[command method(" start ")]。
公共静态void StartMonitor()。
{。

编辑器ed =应用程序,document manager . mdiactivedocument . editor;。
Point3d ctrPt = new Point3d(0,0,0);。
circle = new Circle(ctrPt,Vector3d。扎克斯,5);。
圆,ColorIndex = 1;。
图形界面,transient manager . currenttransientmanager . add transient(circle,graphicinterface。TransientDrawingMode . direct topmost,128,collectints);。
标记,加(圈);。
ed,point monitor+= new PointMonitor eventhandler(ed _ point monitor);。
}。

[command method(" stop ")]。
公共静态void StopMonitor()。
{。
编辑器ed =应用程序,document manager . mdiactivedocument . editor;。
ed,point monitor-= new PointMonitor eventhandler(ed _ point monitor);。
图形界面,transient manager . currenttransientmanager . erase transient(markers[0],collectints);。
标记[0],dispose();。
标记,clear();。
}。

静态void ed_PointMonitor(对象发送方,PointMonitorEventArgs e)。
{。
Editor ed =(Editor)sender;。
文档doc = ed,文档;。
圆,Center = e . Context.RawPoint。
}。
}。


本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

14

主题

275

帖子

6

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
331
发表于 2016-7-14 01:49:22 | 显示全部楼层
你最好用实体夹具
请看这里的示例:http://spiderinnet1.typepad.com/blog/2013/05/autocad-jig-vbnet-keyword-support-for-circle-jigging-using-entityjig.html
这是一个很好的例子
回复

使用道具 举报

85

主题

404

帖子

7

银币

中流砥柱

Rank: 25

铜币
751
发表于 2016-7-14 02:20:31 | 显示全部楼层
jig很可能是您想要的,如果您决定不使用它,您需要更新点监视器中的瞬态图形。我在我的点监视器中调用了此方法,并将绘图列表以及最后一点传递给它。将来我会将文本等添加到绘图列表中,但现在它是一个圆圈和一条橡胶带线。我想将其转换为jig,但jigs将我的注意力转向了有趣的方向。也许有一天,私有静态空UpdateTransGraphics(List绘图,Point3d原始Pt,Point3d lastPt,Point3dCollection rubberBandPoint)。
{。
//替换我们的每个抽屉。

矩阵3d垫=。
Matrix3d.Displacement(originPt.GetVectorTo(lastPt));。

//更新他们的图形。

循环cir=绘图[0]为循环;。
如果(cir!=null)。
{。
cir.Center=lastPt;。
TransientManager.CurrentTransientManager.UpdateTransient(cir,新的intgerCollection());。
}。

//绘制橡皮筋。
折线rBand=绘图[1]作为折线;。
如果(rBand!=null&&rubberBandPoints.Count>0)。
{。
rBand.Reset(false,0);。
对于(int i=0; i。
{。
Point2d pt=new Point2d(rubberBandPoint[i]. X, rubberBandPoint[i]. Y);。
rBand.AddVertexAt(i, pt,0,0,0);。
}。
rBand.AddVertexAt(rubberBandPoints.Count,lastPt.Convert2D(),0,0,0);。
TransientManager.CurrentTransientManager.UpdateTransient(rBand,新的IntgerCollection());。
}。
Debug.WriteLine(更新+drawables.Count+转换);。
}。
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2016-7-14 04:34:58 | 显示全部楼层
与OP中列出的要求不完全匹配,但我在此附上的代码(post#5):
http://www.cadtutor.net/forum/showthread.php?41649-VB。net-Create-a-circle<br>可作为光标定位圆的“抖动”示例。它实际上使用了两个跳汰元素,第一个用于创建/调整圆的大小,第二个用于通过圆心放置圆
这里是例行程序的屏幕放映:
http://autode.sk/29GlZIi
回复

使用道具 举报

71

主题

928

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1230
发表于 2016-7-14 12:06:24 | 显示全部楼层
Alien Dude,当在Sincpac的PipeEditor命令中要求用户选择一个位置时,我使用TransientGraphics来跟随光标。这就是我如何使用Autodesk修改您的代码,使其类似于下面这样:   。应用服务;。
使用Autodesk,AutoCAD . DatabaseServices。
使用Autodesk,AutoCAD . EditorInput。
使用Autodesk,AutoCAD .几何图形;。
使用Autodesk,AutoCAD . Runtime。
使用aGi = Autodesk,AutoCAD . GraphicsInterface。

公共类PointMonitorTooltips。
{。
私有静态dbobject collection m _ markers = new dbobject collection();。
private static integer collection collections = new integer collection();。

[command method(" start ")]。
公共静态void StartMonitor()。
{。
编辑器ed =应用程序,document manager . mdiactivedocument . editor;。
ed,point monitor+= new PointMonitor eventhandler(ed _ point monitor);。
}。

[command method(" stop ")]。
公共静态void stopmonitor()。
{。
编辑器ed =应用程序,document manager . mdiactivedocument . editor;。
ed,point monitor-= ed _ point monitor;。
clear markers();。
}。
静态void ed_PointMonitor(对象发送方,PointMonitorEventArgs e)。
{。
show circle(e . context . raw point);。
}。

静态void showcircle(Point3d pt)。
{。
clear markers();。
Circle circle = new Circle(pt,Vector3d。扎克斯,5);。
圆,ColorIndex = 1;。
m标记,加(圈);。
aGi,transient manager . currenttransientmanager . add transient(circle,aGi。TransientDrawingMode . directshorterm,128,collectints);。
}。

静态void ClearMarkers()。
{。
for(int I = 0;i 。
{。
aGi,transient manager . currenttransientmanager . erase transient(m _ markers[I],collectints);。
m_markers[i],dispose();。
}。
m标记,clear();。
}。
}。

回复

使用道具 举报

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2016-7-14 16:00:36 | 显示全部楼层
谢谢你这个
回复

使用道具 举报

0

主题

9

帖子

1

银币

初来乍到

Rank: 1

铜币
9
发表于 2016-7-15 00:14:02 | 显示全部楼层
你也可以试试光标徽章,http://through-the-interface.typepad.com/through_the_interface/2014/05/adding-a-cursor-badge-in-autocad-2015-using-net.html
回复

使用道具 举报

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2016-7-21 02:44:58 | 显示全部楼层

喜欢他发布的内容...可惜还是在2014年:/
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-4 16:47 , Processed in 0.304099 second(s), 68 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表