1

I need to show data(label with background frame) on objects in the autodesk viewer. I tried implementing this blog https://forge.autodesk.com/blog/placing-custom-markup-dbid and this is what I am trying to reproduce also I took reference from https://raw.githubusercontent.com/Autodesk-Forge/forge-digital-twin/master/public/scripts/extensions/issues.js

Things which I tried. 1.Placed .js file in my folder which the code inside 2.gave reference to the file in my html 3.loaded the extension as shown in the above sample 4.have all the bootstrap cdn imported 5.jquery cdn imported

I am able to get the half temperature icon button also extension accepts icon with db ids which I have provided and when clicked on button the icon and text both are not visible, extension executes which out any error but I am not able to see any reflection my viewer.

can any one help me what I need to check more in order to achieve this as I feel lot of things in the autodesk are been updated and I might be missing something

1 Answer 1

1

The "issues" extension in the "forge-digital-twin" demo requires a specific server endpoint to get the data from, as you can see here: https://github.com/petrbroz/forge-digital-twin/blob/master/public/scripts/extensions/issues.js#L55-L57. You can replace these 3 lines of code and populate the this._issues array in any way you want. For example, you could hard-code the values directly like so:

this._issues = [
    {
        partId: 100,
        author: 'John',
        text: 'Message',
        img: '<some image url>',
        x: 0.0,
        y: 0.0,
        z: 0.0
    },
    {
        partId: 101,
        author: 'Joe',
        text: 'Hello',
        img: '<some image url>',
        x: 10.0,
        y: 20.0,
        z: 30.0
    }
];

Note that the partId is the ID of the object the issue is attached to so that when the object is moved in the viewer (for example, using the Explode tool), the issue can follow it.

Sign up to request clarification or add additional context in comments.

7 Comments

could you please explain me what is x,y and z and how can I get values for them ? I am have dbids/partids so can I get this values using part ids ?
Sure, x/y/z are the actual world coordinates of the issue. I'm retrieving the coordinates using the viewer's hit-test functionality: github.com/petrbroz/forge-digital-twin/blob/master/public/….
thanks let me give a try and see if I am able to get this working for me :)
I am up with this error - Uncaught TypeError: Cannot read property 'x' of undefined at IssuesExtension._getIssuePosition (IssuesExtension.js:127) at IssuesExtension._updateMarkups (IssuesExtension.js:113) at T.updateMarkupsCallback (IssuesExtension.js:8) at T.dispatchEvent (EventDispatcher.js:154) at Array.it (Viewer3DImpl.js:1077) at Ze.executeCommandList (Viewer3DImpl.js:827) at W.tick (Viewer3DImpl.js:1692) at e (Viewer3DImpl.js:1718) and still not able to show up anything on viewer
The _getIssuePosition method is being called for every item from the this._issues array. Make sure that the objects you are adding to the array have a valid structure, i.e., each object should contain properties partId, author, text, img, x, y, and z, as shows in the code snippet in my answer.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.