0

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 Answers1

0

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.

Petr Broz
  • 8,891
  • 2
  • 15
  • 24
  • Yes I was referring to the blog you mentioned. If I used "SNAP_EDGE" (for rendering and snapping), Im able to retrive the vertex coordinates from the JSON-obejct, which arent actully the coordinates from the snapped point. Im kind of a new to this and the approach you mentioned sounds not doable for me. Are you aware if there is some similiar approach somewhere out there ? – salimBekandi Apr 14 '21 at 12:00
  • Unfortunately no. If there's some other solution for this kind of snapping, I'm not aware of it. – Petr Broz Apr 14 '21 at 13:13