Retrieve coordinates from snapped points in Forge viewer

77 views Asked by At

I want to snapp points in the model and retrieve their coordinates. I found the below code in Forge blog

this.points = [];
const result = this.snapper.getSnapResult();

            const { SnapType } = Autodesk.Viewing.MeasureCommon;

            switch (result.geomType) {
                case SnapType.SNAP_VERTEX:
                case SnapType.SNAP_MIDPOINT:
                case SnapType.SNAP_INTERSECTION:

     this.points.push(result.getGeometry());

Now Im able to get the coordinates of vertex and midpoints, but I want to actully get the coordinates of any snapped point of a Brep-line for instance. How is this possible ?

1

There are 1 answers

2
Petr Broz On

You're probably referring to this blog post, right? The SnapType enumeration used in the blog lists all the types of snapping types the tool can detect. Other types you would probably have to detect yourself, for example, by shooting a ray to the scene based on the camera position and mouse cursor position, and finding whatever object of interest are nearby.