2 Replies Latest reply: Feb 18, 2013 9:29 AM by 989999 RSS

    Access entity attributes in JavaScript


      I am loading files into the viewer that is embedded in a web page. I need to be able to use links around the page to select an entity in the model and find out some attributes of it with JavaScript. However I can easily find and select the entity using it's ID but cannot select any of the attributes. I know I have got hold of the entity as I am able to give it to the selector to highlight in the model. But when I call attr = ent.getEntityAttributes(); and attempt to pull out an attribute which I know is there (using the build in entity properties viewer in the UI to see) I always get a null returned e.g. attr.getEffectiveAttribute('My_Attribute');

      Am I missing something in being able to pull these values out?

        • 1. Re: Access entity attributes in JavaScript
          It seems that all attribute names defined in VueEntityAttributes interface are not working properly. Others attributes working fine (see entity properties dialogs).
          var japplet = parent.AppletFrame.window.document.applets["JVue"];
          var selector = japplet.getActiveVueBean().getController().get3DController().getSelector();
          +if (sel.count() > 0) {+
          var entity = sel.get()[0];
          var vea = entity.getEntityAttributes();
          alert(vea.getEffectiveAttribute("IDENTIFIER"));           // Returns correct value
          alert(vea.getEffectiveAttribute(vea.ATTRIB_COLOR);  // Retuens null!

          May be you need to log a bug for this issue.

          Edited by: AutoVue AU on Feb 18, 2013 7:08 AM
          • 2. Re: Access entity attributes in JavaScript
            I had been doing:


            to get the values but this also returns null.

            Another interesting quirk I have found with this is that I have been using:


            to test to see if my attribute was actually there using the value I know it is set to. The first time I run this function it always returns false but if I click my button again then this function then and continuously from then returns true as it should.

            Edit: Just checked actually and some values come through and not all, there are some on a .ifc model I am viewing that I cannot get access to (but do appear on the entity properties dialog) and some built in ones such as NAME and DISPLAY_MODE are also not working where as I can pull out the TRANSLUCENCY one fine (again these all show in the entity properties dialog).

            Edited by: 986996 on Feb 18, 2013 7:28 AM