VBA api layer tree update
- September 6, 2023
- 1 reply
- 4054 views
Hello, I am working on a few automation projects on Creo 4.0 using the VBA API toolkit.
I have set a macro that searches for empty layers in my model and deletes them : this works as intended but after running the macro, the deleted layers still show in the layer tree.
They can't be interacted with so they are indeed taken as deleted, but hitting regenerate, or repaint does not erase them from the tree, for the regenerate it is because for creo there is nothing to regenerate (I get the message 'part' not changed since last regen)
However, if I do any change in the model (add a sketch or an extrude), the layer tree refreshes and removes the deleted layers.
I am looking for any idea to get the layer tree to refresh because even though the intended function works just fine and I can just keep going and it'll update after a change, I don't find it "tidy" to have these ghost layers lying around ^^
I thought about creating a dummy sketch to force the regen and then delete it, but I wonder if it won't just cause the same issue with the model tree not updating the display afterwards, I just hope to see if anyone has a better idea before trying that (not even sure it's possible from the vba api).
The attached images show that on right click on an existing empty layer, I get all the options available on a layer, and after running my program, the right click on the "ghost" thinks I didn't click on a layer (which is technically true)
I'll appreciate any input on this issue
Laetitia.M

