How can I hide a Library Item Reference Image?

How can I hide a Library Item Reference Image?

iklimis
Advocate Advocate
904 Views
2 Replies
Message 1 of 3

How can I hide a Library Item Reference Image?

iklimis
Advocate
Advocate

Hello Forma Team, 

After successfully creating a geoJson containing a  Reference Image as Library Item I encounter the following issue:

I have already have created the said image as a texture in my Forma canvas as the user uses the extension - after creating the Image as a Library Element and adding the said Element I would like the Element to not be showing because it would be overlapping with the already existing texture - instead I would like the Library Element to be firstly hidden and if the user chooses to see it they should be able to do it in the Library Section by pressing the eye icon of the 'Reference Image'

I tried adding the Element and using the Render Api to hide it but when I go to the Library to show it by clicking the eye icon it does not work 

Possibly for  @samarvir_singh_bhayana 


Thanks for your help













0 Likes
905 Views
2 Replies
Replies (2)
Message 2 of 3

samarvir_singh_bhayana
Autodesk
Autodesk

Hey,

 

 

Iklimis, Thanks for the feedback. We are working on a solution to help you open a list of refrenceImages on the proposal layers.


 

Files can be hidden using Forma.render.hideElement({path: "root/some-key/some-other-key"). If you're not sure how you can figure out the path of an element, you can generate a map of paths to urn like this:


async function getPathsToUrn() {
  const rootUrn = await Forma.proposal.getRootUrn();
  const elementTree = await Forma.elements.get({
    urn: rootUrn,
    recursive: true,
  });
  const pathsToUrn = new Map<string, Urn>();
  function traverse(child: Child, currentPath: string) {
    const newPath = `${currentPath}/${child.key}`;
    pathsToUrn.set(newPath, child.urn);
    const element = elementTree.elements[child.urn];
    if (!element) return;
    element.children?.forEach((child) => {
      traverse(child, newPath);
    });
  }

  pathsToUrn.set("root", rootUrn);
  elementTree.element.children?.forEach((child) => {
    traverse(child, "root");
  });
  console.log(pathsToUrn);
}​



0 Likes
Message 3 of 3

iklimis
Advocate
Advocate

@samarvir_singh_bhayana 
I had no issue getting the Reference Image Element's path using the Render Api and hiding the element 

My issue is that when I hide the Element programmatically through the extension I need the user to restore its visibility through the Library Layer section by clicking the eye icon


iklimis_0-1725468256494.png

 








0 Likes