- UID
- 658062
- 积分
- 2147
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-10-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 csharp 于 2014-7-31 07:54 编辑
http://through-the-interface.typepad.com/through_the_interface/2014/04/jigging-an-autocad-hatch-using-net-redux.html
Many thanks to Holger Rasch who worked out how to fix the code in this previous post. It really doesn’t matter that 3 years have passed, Holger – I have no doubt people will greatly appreciate the fact the code can now run without causing the annoying display issues it produced previously.
Holger made a few adjustments to the implementation to make sure the persistent hatch loop gets added and removed in the right places. Here’s the updated C# code:
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Colors;
using System;
namespace HatchJig
{
Here’s the code in action, with none of the former visual artifacts:
Jigging a hatch
Thanks again, Holger! :-)
Update:
After a comment from Robbo, I went ahead and made the generated hatch associative to its boundary by adding a single line of code (“hat.Associative = true;”) once the hatch has been made db-resident. You can, of course, comment out this line to revert to the previous behaviour.
Update 2:
Well that’s strange. It turns out Holger’s code was already setting boundary associativity… not sure how I missed that. Anyway, I have addressed an issue pointed out in the comments (thanks, aks!) where if you hit the spacebar immediately after starting the jig, an exception gets thrown. This has now been fixed in the above code.
|
-
-
|