framework/freecad_workbench/is_object_solid.py

30 lines
924 B
Python
Raw Normal View History

# coding: utf-8
# Copyright (C) 2023 Ilia Kurochkin <brothermechanic@yandex.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2024-04-14 18:54:47 +00:00
'''
DESCRIPTION.
Simple FreeCAD's object test for manifold mawater-tight surface.
'''
__version__ = '0.2'
import FreeCAD
2024-04-14 18:54:47 +00:00
def is_object_solid(obj):
'''If obj is solid return True'''
if not isinstance(obj, FreeCAD.DocumentObject):
return False
2024-04-14 18:54:47 +00:00
if not hasattr(obj, 'Shape'):
return False
return obj.Shape.isClosed()