Visibility system in FreeCAD

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
usbhub
Posts: 280
Joined: Tue Apr 02, 2019 8:22 pm
Location: Earth

Visibility system in FreeCAD

Post by usbhub »

Hello,
is there a consistent system of the visibility in FreeCAD? To example, for a boolean operation, the children get invisible, because a boolean operation creates a complete new object. In contrast to this, the children of an App::Part remain visible because no new object is created, but the objects are merely grouped.
Is thery any possibility to get this information in Python (or a general rule I don't know for the visibility of the children)?

Thanks in advance!
usbhub
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Visibility system in FreeCAD

Post by openBrain »

Each object has a ".Visibility" property that tells if it is visible or hidden. ;)
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Visibility system in FreeCAD

Post by vocx »

usbhub wrote: Wed Oct 02, 2019 8:41 pm ...
Is thery any possibility to get this information in Python (or a general rule I don't know for the visibility of the children)?
...
I don't understand what you mean by "rule", but basically every scripted object in FreeCAD, that is, objects that are meant hold a shape in the 3D view, and which are derived from Part Feature, have a Visibility attribute (boolean). You can read it and set it as you wish.

Code: Select all

obj = App.ActiveDocument.addObject("Part::Feature", "Name")
obj.ViewObject.Visibility = False
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
usbhub
Posts: 280
Joined: Tue Apr 02, 2019 8:22 pm
Location: Earth

Re: Visibility system in FreeCAD

Post by usbhub »

Oh, I think there is a misapprehension. I don't mean the visibility of the object itself, I mean the rule for the "standard" visibility of the children.
To example the boolean operation with the not visible childs and the App::Part on the other side with the visible children.

What I mean, is the rule / information about the type of the object. Is it a completly new object, only built by the shape of the chlidren (boolean operation) or is the parent only a object for grouping object (App::Part).

I hope, now it is a bit more clear :)
usbhub
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Visibility system in FreeCAD

Post by DeepSOIC »

It is built into command code, and I'm afraid there's no standard way of figuring it out.
for example, hiding the children is done by this line of code:
https://github.com/FreeCAD/FreeCAD/blob ... d.cpp#L516
usbhub
Posts: 280
Joined: Tue Apr 02, 2019 8:22 pm
Location: Earth

Re: Visibility system in FreeCAD

Post by usbhub »

DeepSOIC wrote: Thu Oct 03, 2019 12:37 am It is built into command code, and I'm afraid there's no standard way of figuring it out.
for example, hiding the children is done by this line of code:
https://github.com/FreeCAD/FreeCAD/blob ... d.cpp#L516
Okay, too bad, then there's only the dirty way of a list that says what it's like with the corresponding object.

But thanks anyway!
Post Reply