Hi
I'd like to get a good understanding of the result of GetPickedEntities function when used with a point monitor. I'd also like to understand more about the FullSubentityPath. Neither of these can be found by searching the ARX docs.
Here's a sample of the code I have at the beginning of my point monitor:
static void ed_PointMonitor(object sender, PointMonitorEventArgs e) { ... FullSubentityPath[] paths = e.Context.GetPickedEntities();
...
When my mouse pointer is hovered over a hatch I want to be able to process the hatch but I get 55 entities in the FullSubentityPath result.
Thanks in advance.
Craig
Hi Craig,
Here is an explanation about the FullSubentityPath from the managed API documentation :
<<<
An object of this class consists of array of object IDs and an SubentityId object.
The subentity ID object contains the graphics system marker of the subentity and the type of the subentity (that is, edge, face, vertex). The object ID array contains a sequential list of the object IDs for all the objects that make up the "path" from the outermost entity (in Model or Paper space) down into the "main" entity that the subentity is a part of.
>>>
Here is a sample code that I am using in the PointMonitor, which iterates the array. Can you see what it displays in your case for the hatch ?
void OnPointMonitor(object sender, PointMonitorEventArgs e) { try { FullSubentityPath[] paths = e.Context.GetPickedEntities(); if (paths.Length == 0) return; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; foreach (FullSubentityPath fsp in paths) { //SubentityId sId = fsp.SubentId; //IntPtr subEntMarker = sId.IndexPtr; ObjectId[] oIds = fsp.GetObjectIds(); foreach (ObjectId oId in oIds) { ed.WriteMessage("\n{0} - {1}", oId.Handle, oId.ObjectClass.Name); } } } catch (System.Exception exn) { Application.ShowAlertDialog(exn.Message); } }
Hi Balaji,
From the description, the outermost entity seems to be what I need i.e. the element that would be selected if clicked by the user. Is that safe to say?
Also, I'd really like to know how you found the information in the managed API documentation. I've just gone back and looked again in the AutoCAD Managed Class Reference (arxmgd.CHM) and searched for FullSubentityPath, GetPickedEntities and PointMonitorEventArgs and none of them are found nor are they in the index. I can find PointMonitorEventArgs via the contents but there is not link back to the others.
Thanks
Craig
Hi Craig,
When looking for an explanation of a class or structure whose name is known, searching using "Index" usually provides better results. The explanation that I had pasted earlier is under "FullSubentityPath Structure" topic in the managed API documentation.
For the main entity you will need to access the first entity in the collection (index 0). This explanation from the help should clarify that point.
<<<<
For example, an edge of an Solid3d that's within a block definition that's referenced by an BlockReference would result in an object ID array with two object IDs. The first would be the object ID of the BlockReference. The second would be the object ID of the Solid3d.
>>>>
Regards,
Hi Balaji,
I have found out why I do not see it. The indexes are not merged when viewed via arxdoc.chm. I thought they would be.
Hi Craig,
"FullSubentityPath" is the .Net equivalent of "AcDbFullSubentPath".
Looking for "FullSubentityPath" in "arxmgd.chm" or "AcDbFullSubentPath" in "arxdoc.chm" will show the topics.
Regards,