mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-15 09:40:32 +05:00
84 lines
2.5 KiB
Python
84 lines
2.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright (C) 2014-2024 EDF
|
|
#
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation; either
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
#
|
|
# This library 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
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
# See https://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
#
|
|
# Author : Konstantin Leontev (OpenCascade S.A.S)
|
|
|
|
import salome_pluginsmanager
|
|
|
|
import os
|
|
from qtsalome import QIcon
|
|
|
|
# Plugins entry points
|
|
# For new plugins create a function that shows related dialog,
|
|
# then add it into plugin manager below.
|
|
|
|
def locate_subshapes(context):
|
|
"""
|
|
Opens Locate Subshapes plugin's dialog.
|
|
"""
|
|
from salome.geom.geomrepairadv.locate_subshapes import LocateSubShapesDlg
|
|
dialog = LocateSubShapesDlg()
|
|
dialog.show()
|
|
|
|
def merge_faces(context):
|
|
"""
|
|
Opens Merge Faces plugin's dialog.
|
|
"""
|
|
from salome.geom.geomrepairadv.merge_faces import MergeFacesDlg
|
|
dialog = MergeFacesDlg()
|
|
dialog.show()
|
|
|
|
def union_edges(context):
|
|
"""
|
|
Opens Union Edges plugin's dialog.
|
|
"""
|
|
from salome.geom.geomrepairadv.union_edges import UnionEdgesDlg
|
|
dialog = UnionEdgesDlg()
|
|
dialog.show()
|
|
|
|
|
|
# Add plugins to a manager with a given menu titles and tooltips
|
|
|
|
def get_icon(icon_file):
|
|
"""
|
|
Creates an icon from a given file in default GEOM resource location.
|
|
"""
|
|
|
|
icon_path = os.path.join(os.getenv('CSF_ShHealingDefaults'), icon_file)
|
|
return QIcon(icon_path)
|
|
|
|
salome_pluginsmanager.AddFunction(
|
|
'Locate Subshapes',
|
|
'Locates the sub-shapes of a compound by length, area or volume depending on whether it is an '
|
|
'EDGE, a FACE or a SOLID',
|
|
locate_subshapes,
|
|
get_icon('subshape.png'))
|
|
|
|
salome_pluginsmanager.AddFunction(
|
|
'Merge Faces',
|
|
'Merges selected faces with a given precision',
|
|
merge_faces,
|
|
get_icon('union_faces.png'))
|
|
|
|
salome_pluginsmanager.AddFunction(
|
|
'Union Edges',
|
|
'Merges edges of selected face',
|
|
union_edges,
|
|
get_icon('fuse.png'))
|