Community
Forma Developer Forum
Welcome to Autodesk Forma Developer Forum. Share your knowledge, ask questions, and explore popular Forma API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to delete element from hierarchy - Part2

2 REPLIES 2
Reply
Message 1 of 3
iklimis
218 Views, 2 Replies

How to delete element from hierarchy - Part2

Hi once again Forma team,

So after experimenting with the hideElement() method of the render Api I noticed that after use it to hide an Element the element re-appears once I exit the extension.

Most importantly the element stays in element hierarchy once I hide it.

Is there a way or possibly will be to delete an element entirely from the Hierarchy?? 

thanks again for all your help and support

Tags (2)
Labels (1)
2 REPLIES 2
Message 2 of 3
henrik_steenJL382
in reply to: iklimis

The hideElement method is transient for the purpose of rendering something else instead before anything is saved.

 

To delete an element it depends on where you delete it from. It seems we currently don't have an API to delete an element directly from the proposal (only replace). If your element is part of an element that belongs to "integrate-elements" you need to create a new hierarchy and then replace the proposal element with it. When you create a new hierarchy you can reference existing trees as children instead of recreating them.

 

Keep in mind that the elements structure in Forma is immutable, so strictly speaking there is no concept as "edit in-place". All operations lead to new elements being created (so basicly copy the data model, apply patch and save as new element), and the full chain of elements up to the proposal also needs to be changed in the similar way.

 

The ergonomics around this isn't very good at the moment but we are working on improving this.

Message 3 of 3
iklimis
in reply to: iklimis

Hey @henrik_steenJL382 ,

I think i get a grasp on the approach you suggest. 

Would it be too much trouble to ask for code sample of how would achieve "re-creating" the element Hierarchy? 

Just how would go about creating a new Hierarchy 'without' an Element?

 

 

this would be al lot of help
Thank a lot



Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Technology Administrators