Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Layer/Tag do not immediately follow set behavior when added via Ruby API #457

Open
DanRathbun opened this issue Apr 7, 2020 · 3 comments

Comments

@DanRathbun
Copy link

DanRathbun commented Apr 7, 2020

SketchUp Ruby API Issue

New Layer/Tag do not immediately follow set behavior when added via Ruby API.

Reported bug in: 20.0.363, also in 18.0.16975

Reportedly works as expected in SU2017, but testing shows the bug is also present in version 17.2.2555 and 16.1.1449.

Creating a new layer/tag and setting it's scene page behavior does not immediately get applied by Sketchup::Layer#page_behavior= method.

layer = Sketchup.active_model.layers.add("Test")
layer.page_behavior=(LAYER_HIDDEN_BY_DEFAULT | LAYER_IS_HIDDEN_ON_NEW_PAGES)

Either a manual change of scene page and back again is required to have the layer be correctly applied across the scene pages collection, ... or a undocumented Ruby "trick" that causes SketchUp to refresh the scene layer/tag behaviors by setting the selected page to itself ...

pages = Sketchup.active_model.pages
pages.selected_page= pages.selected_page

REF Forum topic:
https://forums.sketchup.com/t/layer-tag-layer-hidden-by-default-not-working/121203/

@thomthom
Copy link
Member

So changing the layer's page_behaviour doesn't update the viewport (entity visibility) based on the current scene (page)?

@DanRathbun
Copy link
Author

So changing the layer's page_behaviour doesn't update the viewport (entity visibility) based on the current scene (page)?

Please be careful in dialogue here. We are taking about the layer visibility property not direct object visibility which is a separate feature saved by scene pages.

The layer's visibility state (as shown in the Layer inspector) is not updated to reflect the change in behavior, ... so yes ANY entity or object using this layer is still visible.

AND ... I am assuming that none of the other scene pages have been updated as well, until a change of scene page is made (manually, in code or triggered using the "trick" I show above.)


I am wondering if explicitly setting ...

pages.selected_page.use_hidden_layers= true

... must be called before the change in behavior statement ?

TESTED. Result = no help. Same problem.

@sketchupbot
Copy link

SU-45930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants