Hi, everyone.
I would like to detect view change (especially when orbiting the view around) to automatically reposition table-like(block) entity such that the user can always see the face of the entity.
I figured out that there is viewChanged event in AcEditorReactor, but it doesn't seem like it is visible in .NET.
How could I use this callback function? Does anyone have tried it before?
Or would there be anyother way to solve the issue I mentioned above?
Any tip would be appreciated.
Thank you.
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
You can handle Autodesk.AutoCAD.ApplicationServices.Document.ViewChanged event.
Somethign like:
private bool _viewChangeHandled=false [CommandMethod("VewChanged")] public void HoodViewChanged() { Document dwg = Application.DocumentManager.MdiActiveDocument; if (!_viewChangeHandled) { dwg.ViewChanged += dwg_ViewChanged; _viewChangeHandled = true; } else { dwg.ViewChanged -= dwg_ViewChanged; _viewChangeHandled = false; } } private void dwg_ViewChanged(object sender, EventArgs e) { Document dwg = Application.DocumentManager.MdiActiveDocument; dwg.Editor.WriteMessage("\nView changed..."); }
Norman Yuan
I think you will find that making dynamic changes to the entity in real time is not practical. I would try to overrule ViewportDraw instead; then you can transform the graphics as desired without modifying the entity (which requires write access and undo filing).
Hmmm... my Documnet class does not have ViewChanged event handler.
I am currently using ObjectARX 2007.
From what version, does it get supported?
Well, if you still work with AutoCAD 2007, there is no ViewChanged event, at least up to AutoCAD 2009. The oldest version I have access to is Acad2012, so cannot say exactly which version introduced ViewChanged event in .NET API.
Also, you can forget anything about Overrule unless you work with AutoCAD 2010 or later.
With 7 version behind (Acad2007 to 2014), you may want to assess whether your .NET API development is worth the effort, IMO.
Norman Yuan
I said it might not be worth the effort, not because of doing .NET API programming, but because of using very old version of AutoCAD.
For your interest of knowing when AutoCAD's view is changed, you need to start with a version of AutoCAd that has ViewChanged event available in .NET API, which I only know it was not available at least up to acad2009, and for sure it is available in Acad2012, but not very sure about Acad2010/2011.
As for using Overrule as Owen suggested, I can say without knowing well what you want to do exactly. Do searching for AutoCAD Overrule would lead you to some examples.
Norman Yuan
Can't find what you're looking for? Ask the community or share your knowledge.