Reputation: 1
I am using this mark up extension sample in APS viewer,
https://codepen.io/petrbroz/pen/gOMPYRV
My objective is to create a polyline boundary in dwg file using Design Automation based on the markup drawn by user in APS viewer.
Is there a way we can convert these markup co-ordinates to drawing co-ordinates?
I have tried this approach mentioned in https://aps.autodesk.com/blog/parsing-line-points-viewer but could not get the results and not able to get the value for vpId mentioned in the above blog.
What's the procedure to convert viewer co-ordinates to drawing co-ordinates? Any documentation or sample would be greatly helpful.
Thanks in advance!
Upvotes: 0
Views: 58
Reputation: 823
Markups are SVG overlay on the viewer, there's no direct correlation with markups and CAD coordinates.
What you can do is, get the viewer coordinates with the hit test and then you can apply the PageToModelTransform
to your viewer points to transform them back to CAD as mentioned in this answer
ViewerContainer.addEventListener('click', function (ev) {
const rect = ViewerContainer.getBoundingClientRect();
const hit = viewer.hitTest(ev.clientX - rect.left, ev.clientY - rect.top);
console.log(hit.point)
});
Upvotes: 0