mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-31 21:44:29 +05:00
61 lines
2.7 KiB
Python
61 lines
2.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
|
|
#
|
|
# 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 http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
#
|
|
|
|
import logging
|
|
|
|
from .geomsmesh import geompy
|
|
from .findWireIntermediateVertices import findWireIntermediateVertices
|
|
from .projettePointSurCourbe import projettePointSurCourbe
|
|
|
|
def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim):
|
|
"""
|
|
ajustement precis des points sur edgesPipeFissureExterneC
|
|
"""
|
|
logging.info('start')
|
|
|
|
edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
|
|
verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe)
|
|
idiskmin = idisklim[0] + 1 # on ne prend pas le disque sur la peau, déjà ajusté
|
|
idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté
|
|
idiskint = []
|
|
for vtx in verticesPFE:
|
|
distPtVt = []
|
|
for idisk in range(idiskmin, idiskmax):
|
|
gptdsk = gptsdisks[idisk]
|
|
pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
|
|
distPtVt.append((geompy.MinDistance(pt, vtx), idisk))
|
|
distPtVt.sort()
|
|
idiskint.append(distPtVt[0][1])
|
|
gptsdisks[idiskint[-1]][0][-1] = vtx
|
|
logging.debug("ajustement point sur edgePipeFissureExterne, vertex: %s %s", idiskint[-1], distPtVt[0][0])
|
|
for idisk in range(idiskmin, idiskmax):
|
|
if idisk in idiskint:
|
|
break
|
|
logging.debug("ajustement point sur edgePipeFissureExterne: %s", idisk)
|
|
gptdsk = gptsdisks[idisk]
|
|
pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
|
|
distPtEd = [(geompy.MinDistance(pt, edgePFE), k, edgePFE) for k, edgePFE in enumerate(edgesPFE)]
|
|
distPtEd.sort()
|
|
edgePFE = distPtEd[0][2]
|
|
u = projettePointSurCourbe(pt, edgePFE)
|
|
ptproj = geompy.MakeVertexOnCurve(edgePFE, u)
|
|
gptsdisks[idisk][0][-1] = ptproj
|
|
|
|
return gptsdisks |