Is it posible to implement PointMonitor to show some info about Feature Objects linked with FDO?
Thanks
Solved! Go to Solution.
Yes, it is definitely possible. Just as you can show regular Acad entity info with PointMonitor event hanlder (PointMonitorEventArgs.AppendToolTip()), you can use Autodesk.Gis.Map.Platform.Interop.AcMapFeatureEntityService class to obtain feature object information from an Acad entity's ObjectId.
Here is an runable example:
using System.Text; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.Gis.Map.Platform.Interop; using OSGeo.MapGuide; [assembly: CommandClass(typeof(MapFeatureTest.MyCommands))] namespace MapFeatureTest { public class MyCommands { private Document _dwg = null; private bool _msgOn = false; [CommandMethod("MapMsgOn")] public void MsgOn() { if (_dwg == null) { _dwg = Application.DocumentManager.MdiActiveDocument; _dwg.Editor.PointMonitor += new PointMonitorEventHandler(Editor_PointMonitor); } _msgOn = true; } [CommandMethod("MapMsgOff")] public void MsgOff() { if (_dwg == null) { return; } else { _dwg.Editor.PointMonitor -= Editor_PointMonitor; } _msgOn = false; } private void Editor_PointMonitor( object sender, PointMonitorEventArgs e) { if (_dwg == null) return; if (!_msgOn) return; Editor ed = _dwg.Editor; FullSubentityPath[] paths = e.Context.GetPickedEntities(); if (paths.Length > 0) { ObjectId[] ids=paths[0].GetObjectIds(); if (ids.Length > 0) { ObjectId selId = ids[ids.Length - 1]; string tipText = GetToolTip(selId); e.AppendToolTipText(tipText); } } } private string GetToolTip(ObjectId selId) { StringBuilder str = new StringBuilder(); str.Append("ObjectId: " + selId.ToString() + "\n"); str.Append("DxfName: " + selId.ObjectClass.DxfName + "\n"); if (selId.ObjectClass.DxfName.ToUpper() == "MAPBULKFEATURE") { str.Append("Feature: " + AcMapFeatureEntityService. GetLayer(selId).FeatureClassName + "\n"); } return str.ToString(); } } }
"Netload" this code into AutoCAD and enter "MapMsgOn" command. Then if you move cursor over an Acad entity or a map feature entity in Acad editor and wait a moment, a tooltip will show.
Norman Yuan
I load SDF file with few Feature objects
I dont know why but I am getting this error
I have no idea. In my test, I added feature objects from a shape file. It works well.
See this vidoe clip
Norman Yuan
i don't know if this helps, but i was also getting this error and it stopped when i turned off the rollover tooltips
Sorry, but i have the same question.
We can see feature object information, can we read object data?
I think that we have to use mgfeaturereder to read odject data, for this reason I link mgselectionbase:
Dim paths As FullSubentityPath() = e.Context.GetPickedEntities()
If paths.Length > 0 Then
Dim ids As ObjectId() = paths(0).GetObjectIds()
If ids.Length > 0 Then
Dim selId As ObjectId = ids(ids.Length - 1)
Dim selIdCollection as objectidcollection = nothing
sellidcollection.add(selid)
Dim MgSelBas as new mgselectionbase = Autodesk.Gis.Map.Platform.Interop.AcMapFeatureEntityService.getfeatures(sellidcollectionl) ' after this line my Autocad Map 3D crashes
End If
End If
Can we read data and show it on tooltips?
Can't find what you're looking for? Ask the community or share your knowledge.