32 lines
993 B
Python
32 lines
993 B
Python
![]() |
# -*- coding: utf-8 -*-
|
||
|
# Original code by (C) 2019 yorikvanhavre <yorik@uncreated.net>
|
||
|
# Copyright (C) 2023 Ilia Kurochkin <brothermechanic@gmail.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.
|
||
|
import FreeCAD
|
||
|
|
||
|
|
||
|
def is_object_solid(obj):
|
||
|
"""If obj is solid return True"""
|
||
|
if not isinstance(obj, FreeCAD.DocumentObject):
|
||
|
return False
|
||
|
|
||
|
if not hasattr(obj, 'Shape'):
|
||
|
return False
|
||
|
|
||
|
if not hasattr(obj.Shape, 'Solids'):
|
||
|
return False
|
||
|
|
||
|
if len(obj.Shape.Solids) == 0:
|
||
|
return False
|
||
|
|
||
|
return True
|