How to enable snapping feature on location or distance measurement tool with blankiModelConnection or to have it working with 3D model and prohibit point identification in background.
We observe the red circle aligning the face of the iTwin geometry and the yellow cross at the center. This is very helpful in snapping to a location on the 3D model (iTwin geometries).
https://github.com/user-attachments/assets/b25de073-ea7f-49e9-bd84-d22edd760283
By default this is not working for the reality or 3D model as shown. I want this snapping to be enabled for the reality model or 3D model for the location or any custom Hit location tool in my application. What should I do?
@MarcBedard8 any recommendations here for snapping to reality models?
Reality model are composed of meshes and doesn't give geometry to snap to. You can change snap mode to snap to nearest or keypoint.
Let me tell the user if that works for them.
Until then, I'll mark it close.
I have to reopen this issue as the user still finds it uneasy to measure distances.
Like in this video, I turned off the map but I'm able to click a point in the space. Is there a way to make the points to only identify the 3D geometry but not the empty space ?
https://github.com/user-attachments/assets/39057a27-cca2-4471-9ae9-a1d83d66481b
Look like we had a similar thread some time ago (c.f.: https://github.com/iTwin/itwinjs-core/discussions/7457#discussioncomment-11524528) @saaaaaally Do you remember if/how we solve this?
Yes, solved a similar issue in the measure volume tool by using this code for selecting points:
public static getDepthPoint(ev: BeButtonEvent): Point3d {
if (!ev.viewport)
return ev.point;
const pickRadiusPixels = ev.viewport.pixelsFromInches(0.2);
const result = ev.viewport.pickDepthPoint(ev.rawPoint, pickRadiusPixels);
const planePoint = result.plane.getOriginRef();
return planePoint;
}
Yes, solved a similar issue in the measure volume tool by using this code for selecting points:
public static getDepthPoint(ev: BeButtonEvent): Point3d { if (!ev.viewport) return ev.point; const pickRadiusPixels = ev.viewport.pixelsFromInches(0.2); const result = ev.viewport.pickDepthPoint(ev.rawPoint, pickRadiusPixels); const planePoint = result.plane.getOriginRef(); return planePoint; }
So, do I need to create all the measurements tools again locally where I need this feature in my application and use this method in it?
You could create a tool that derived from the original one and override that part.
I'll try that.
Can we have this feature built into the tool out of the box to be able to identify the 3D geometries and the background map or space?
Can I request this feature, if yes, how should i?
I have created a sandbox with a custom distance measurement tool from a reference.
The objective is to prohibit any point selection in the black background. User should be able to only click or identify points on 3d Reality Model or iTwin Geometry.
Can we update the tool to avoid identifying the point in the background?
@ben-polinsky , @aruniverse. This appears to be a major issue on the user’s side. Can we prioritize addressing it?
@Praful-Bentley can this be closed in favor of https://github.com/iTwin/itwinjs-core/issues/8843?
Also, looking at the sandbox, you're overriding the MeasureDistanceTool, but you aren't registering the tool, so it must be reverting to the base MeasureDistanceTool?
That should get you started. I'll try to take a look at this a bit more closely tomorrow, as well.
Sure closing this.