& Construction

Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing

Professional CAD/CAM tools built on Inventor and AutoCAD
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
Professional CAD/CAM tools built on Inventor and AutoCAD
Hi all,
I'm using construction
// Request for objects to be selected in the drawing area acSSPrompt = acDocEd.GetSelection(new PromptSelectionOptions { SingleOnly = true, ForceSubSelections = true });
two times and each time I'm selecting different parts of polyline , but Object Id for both selections are the same.
Why?
Thanks.
Hi Gile,
thank you for explanation.
In that case how prompt user select one arc as part of polyline?
Let's say, that single polyline is combination of 9 arcs. And user should select any from the arcs.
Polyline is single entity, irrespective of where you click, you will ObjectId of the Polyline, of course user can use CTRL+Selection on Polyline, in that case only hovered entity get highlighted, but again you will get ObjectId of Polyline not the segments.
What is your objective, do you want operate on segments user has hovered?
There is no direct API method(s) that you can call for your purpose. But one should be able to write code to achieve that, such as using DrawableOverrule, and/or Transient Graphics, or combination of them, and maybe, plus the handling of PointMonitor event. The code would be quite complicated, depending what kind of visual hints you want to lead user to select portion of the polyline. I'd imagine to code would:
1. Start handing PointMonitor event to detect whether the cursor is close/hover the polyline;
2. If yes, draw transient graphic on that portion of polyline (segment between 2 vertices, be it a straight line, or an arc, you should figure it out based on the polyline and the vertices). So, this transient graphic would serve as visual hint to user that certain portion of the polyline is to be selected.
3. If user click the mouse button (thus "select" this portion of polyline), you would update the transient graphic to indicates that (say, change its color, or make it thicker...)
This is just a rough idea. It might also be possible to write code to achieve the same visual effect as you do with Ctrl + select to the polyline. Again, this would required advanced coding skill with AutoCAD .NET APIs.
Hi Norman,
thank you for detailed reply. For my task I did "explode" for Polyline and then user was able to work with list of arcs/lines.
If you set PrepareOptionalDetails and SinglePickInSpace to true, then the GraphicsSystemMarker property of the SelectedObject should be the index of the selected Polyline vertex (I haven't actually confirmed that this works, but it seems logical that it should).
If the GraphicsSystemMarker property is zero, then you could find the index of the selected vertex using the pick point and the Curve's GetClosestPointTo() and GetParameterAtPoint() methods.
Mind you, either of these only give you index of the selected Polyline vertex.
@Anonymous wrote:
Hi Gile,
thank you for explanation.
In that case how prompt user select one arc as part of polyline?
Let's say, that single polyline is combination of 9 arcs. And user should select any from the arcs.
OK, I found a bit time writing some code to materialize what I said in previous reply. I published the code with a video clips here:
https://drive-cad-with-code.blogspot.com/2019/02/visually-select-segment-of-polyline.html
Hope it helps.
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name