[TD] Connect PositionSectionView to TechDraw

This commit is contained in:
edi271
2023-12-21 15:59:56 +01:00
parent a9764d5fa5
commit 6d77f75cd2
3 changed files with 17 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ set(TechDraw_ToolsScripts
TechDrawTools/CommandMoveView.py
TechDrawTools/CommandShareView.py
TechDrawTools/CommandAxoLengthDimension.py
TechDrawTools/CommandPositionSectionView.py
TechDrawTools/CommandFillTemplateFields.py
TechDrawTools/CommandVertexCreations.py
TechDrawTools/CommandHoleShaftFit.py

View File

@@ -51,32 +51,34 @@ def displayMessage(title,message):
msgBox.exec_()
def getSelView():
def getSelView(nSel=0):
'''
view = getSelView()
nSel=0 ... number of selected view, 0 = first selected
Return selected view, otherwise return False
'''
if not Gui.Selection.getSelection():
displayMessage('TechDraw_Utils','No view selected')
else:
view = Gui.Selection.getSelection()[0]
view = Gui.Selection.getSelection()[nSel]
return view
def getSelVertexes(nVertex=1):
def getSelVertexes(nVertex=1, nSel=0):
'''
vertexes = getSelVertexes(nVertex)
nVertex ... min. number of selected vertexes
nVertex=1 ... min. number of selected vertexes
nSel=0 ... number of selected view, 0 = first selected
Return a list of selected vertexes if at least nVertex vertexes are selected, otherwise return False
'''
if getSelView():
view = getSelView()
if getSelView(nSel):
view = getSelView(nSel)
else:
return False
if not Gui.Selection.getSelectionEx():
displayMessage('TechDraw_Utils',
QT_TRANSLATE_NOOP('TechDraw_Utils','No vertex selected'))
return False
objectList = Gui.Selection.getSelectionEx()[0].SubElementNames
objectList = Gui.Selection.getSelectionEx()[nSel].SubElementNames
vertexes = []
for objectString in objectList:
@@ -92,21 +94,22 @@ def getSelVertexes(nVertex=1):
else:
return vertexes
def getSelEdges(nEdge=1):
def getSelEdges(nEdge=1, nSel=0):
'''
edges = getSelEdges(nEdge)
nEdge ... min. number of selected edges
nEdge=1 ... min. number of selected edges
nSel=0 ... number of selected view, 0 = first selected
Return a list of selected edges if at least nedge edges are selected, otherwise return False
'''
if getSelView():
view = getSelView()
if getSelView(nSel):
view = getSelView(nSel)
else:
return False
if not Gui.Selection.getSelectionEx():
displayMessage('TechDraw_Utils',
QT_TRANSLATE_NOOP('TechDraw_Utils','No edge selected'))
return False
objectList = Gui.Selection.getSelectionEx()[0].SubElementNames
objectList = Gui.Selection.getSelectionEx()[nSel].SubElementNames
edges = []
for objectString in objectList:

View File

@@ -34,6 +34,7 @@ from .TDToolsUtil import *
from .CommandShareView import CommandShareView
from .CommandMoveView import CommandMoveView
from .CommandAxoLengthDimension import CommandAxoLengthDimension
from .CommandPositionSectionView import CommandPositionSectionView
from .CommandVertexCreations import CommandVertexCreationGroup
from .CommandHoleShaftFit import CommandHoleShaftFit
from .CommandFillTemplateFields import CommandFillTemplateFields