Warm tip: This article is reproduced from stackoverflow.com, please click
autodesk-forge autodesk-model-derivative autodesk-viewer

Forge Viewer

发布于 2020-04-20 09:43:17

While loading markups, I am not able to get markups array from markup extension as referneced in below code, actually I need client position coordinates of the loaded markup. In below code am getting markups array empty. But while drawing a new markup, we always have markup array filled. Please advise

        markup.viewer.restoreState(viewState);
        markup.loadMarkups(svgTxt, "layerName") 

        var pos = markup.markups[0].getClientPosition()
Questioner
A DEv
Viewed
39
Eason Kang 2020-02-05 14:11

Since you're not editing the layer you specified, the markupExt.markups will not contain anything. Please use this instead:

const activeLayerMarkup = markupExt.svgLayersMap[markupExt.activeLayer]
activeLayerMarkup.markups[0].getClientPosition()

Or try to edit the layer

markupExt.loadMarkups(svgTxt, 'layerName')
markupExt.enterEditMode('layerName')
markup.markups[0].getClientPosition()