0

I am using markup extension to draw on my viewer, after drawing, on selection of markup event, can I get its center coordinates of current selection or any coordinates inside of it? if not, at least can I get dbId behind current selection?

Thanks in advance

A DEv
  • 255
  • 1
  • 19
  • I tried putting var pos = markup.markups[0].getClientPosition(). Is this a proper solution? – A DEv Feb 03 '20 at 11:13

1 Answers1

0

Yelp~ it's the case, and see also:

// Get the markup's position in browser pixel space. the (0,0) is top left
Markup#getClientPosition()
// Get the markup's bounding rect in browser pixel space.

Markup#getClientSize()
// get the markup's bounding rect in browser pixel space, including the stroke width

Markup#getBoundingRect()

BTW, to obtain dbId within the markup boundary, you can do this:

  1. Get markup's BoundingRect in browser's pixel space
  2. Convert coordinates of the rect's vertices into viewer's 3d space via Viewer3D#clientToWorld
  3. Do bounding box collision to find out intersected mesh for the dbId, see here for the example: https://forge.autodesk.com/blog/custom-window-selection-forge-viewer-simpler-extension
Eason Kang
  • 6,155
  • 1
  • 7
  • 24