In SDK, how do I see if geometry is currently hidden?



When exporting in my C++ plug-in, I want to give the user the option of exporting all the geometry or only the currently visible geometry, but I’m not seeing how I can get that information via the API.

Any suggestions?


As you traverse the model you need to check two things, the visibility property of the drawingelement and the visibility of the layer it is on.



Note that both of these properties are local to that entity/layer - they don’t keep track of the visibility of the parent containers.


Ah, interesting. I have not had occasion to use the SUDrawingElementRef in my code yet. I think that’s probably exactly what I want. Will report back when/if I get it working.


Yea, the docs aren’t great at conveying the class hierarchy at a glance.

The gist is that most things inherit from Entity. The C API functions is currently for attributes.

DrawingElement (inherit from Entity) is further specialisation which most things visible in the viewport inherit from, edges, faces, groups etc. This one got a few more general functions.

Then you have stuff like Layers, Materials, Pages and Vertices, they inherit directly Entity - because you don’t draw or manipulate them in the viewport.


I used SUDrawingElementGetHidden, and this works fine for some models.

For few models, this doesn’t work.
I opened the model in sketchup and toggeled Edit->HiddenGeometry. I could see the hidden geometry on/off.
But when i use SUDrawingElementGetHidden API and hide the geometry, it still shows the hidden geometry.

So, I want to know if I am missing anything. Is there any other check i need to do other than SUDrawingElementGetHidden?


SUDrawingElementGetHidden only returns the boolean state of the Visible property of the entity.
If you need to determine if the user sees the entity in the model you need to combine that, with the visibility state of it’s layer - as well as its parents. Then finally the “View > Hidden Geometry” which is a model wide state you obtain from the rendering options (via the "DrawHidden" key I think).


the api

@thomthom give you the right api
but it may not act like what you are expecting.
The attribute of an object is different from what it looks like. for example, a component is not hidden,but all faces in this component is hidden. then, you may export an empty component(if you pass hidden items).