Merge remote-tracking branch 'origin/Draft_addgroup' into Draft_addgroup

This commit is contained in:
jerome Laverroux
2020-04-21 14:50:06 +02:00
18 changed files with 7065 additions and 7320 deletions

View File

@@ -166,5 +166,6 @@
<file>ui/TaskPanel_PolarArray.ui</file>
<file>ui/TaskSelectPlane.ui</file>
<file>ui/TaskShapeString.ui</file>
<file>ui/dialog_AnnotationStyleEditor.ui</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,447 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>418</width>
<height>694</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Style name</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="comboBoxStyles">
<property name="toolTip">
<string>The name of your style. Existing style names can be edited</string>
</property>
<property name="editable">
<bool>false</bool>
</property>
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>Add new...</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonRename">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Renames the selected style</string>
</property>
<property name="text">
<string>Rename</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonDelete">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Deletes the selected style</string>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Text</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Font size</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Font name</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Line spacing</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="FontSize">
<property name="toolTip">
<string>The size of the text in real-world units</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="LineSpacing">
<property name="toolTip">
<string>The spacing between lines of text in real-world units</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="FontName">
<property name="toolTip">
<string>The font to use for texts and dimensions</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Units</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Scale multiplier</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Decimals</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Únit override</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Show unit</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="ScaleMultiplier">
<property name="toolTip">
<string>A multiplier value that affects distances shown by dimensions</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="UnitOverride">
<property name="toolTip">
<string>Forces dimensions to be shown in a specific unit</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="Decimals">
<property name="toolTip">
<string>The number of decimals to show on dimensions</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="ShowUnit">
<property name="toolTip">
<string>Shows the units suffix on dimensions or not</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Line and arrows</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Extension overshoot</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Arrow size</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Show lines</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Dimension overshoot</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Extension lines</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Arrow type</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Line / text color</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="ShowLines">
<property name="toolTip">
<string>Shows the dimension line or not</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="LineWidth">
<property name="toolTip">
<string>The width of the dimension lines</string>
</property>
<property name="suffix">
<string>px</string>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::ColorButton" name="LineColor">
<property name="toolTip">
<string>The color of dimension lines, arrows and texts</string>
</property>
<property name="color">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="ArrowType">
<property name="toolTip">
<string>The typeof arrows to use for dimensions</string>
</property>
<item>
<property name="text">
<string>Dot</string>
</property>
</item>
<item>
<property name="text">
<string>Arrow</string>
</property>
</item>
<item>
<property name="text">
<string>Tick</string>
</property>
</item>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::QuantitySpinBox" name="ArrowSize">
<property name="toolTip">
<string>The size of dimension arrows</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="Gui::QuantitySpinBox" name="DimensionOvershoot">
<property name="toolTip">
<string>How far must the main dimension line extend pass the measured points</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="Gui::QuantitySpinBox" name="ExtensionLines">
<property name="toolTip">
<string>The length of extension lines</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="Gui::QuantitySpinBox" name="ExtensionOvershoot">
<property name="toolTip">
<string>How far must the extension lines extend above the main dimension line</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::ColorButton</class>
<extends>QPushButton</extends>
<header>Gui/Widgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,252 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2020 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * 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 Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
"""
Provides all gui and tools to create and edit annotation styles
Provides Draft_AnnotationStyleEditor command
"""
import FreeCAD,FreeCADGui
import json
EMPTYSTYLE = {
"FontName":"Sans",
"FontSize":0,
"LineSpacing":0,
"ScaleMultiplier":1,
"ShowUnit":False,
"UnitOverride":"",
"Decimals":0,
"ShowLines":True,
"LineWidth":1,
"LineColor":255,
"ArrowType":0,
"ArrowSize":0,
"DimensionOvershoot":0,
"ExtensionLines":0,
"ExtensionOvershoot":0,
}
class Draft_AnnotationStyleEditor:
def __init__(self):
self.styles = {}
def GetResources(self):
return {'Pixmap' : ":icons/Draft_AnnotationStyleEditor.svg",
'MenuText': QT_TRANSLATE_NOOP("Draft_AnnotationStyleEditor", "Annotation styles..."),
'ToolTip' : QT_TRANSLATE_NOOP("Draft_AnnotationStyleEditor", "Manage or create annotation styles")}
def IsActive(self):
return bool(FreeCAD.ActiveDocument)
def Activated(self):
from PySide import QtGui
# load dialog
self.form = FreeCADGui.PySideUic.loadUi(":/ui/dialog_AnnotationStyleEditor.ui")
# center the dialog over FreeCAD window
mw = FreeCADGui.getMainWindow()
self.form.move(mw.frameGeometry().topLeft() + mw.rect().center() - self.form.rect().center())
# set icons
self.form.pushButtonDelete.setIcon(QtGui.QIcon(":/icons/edit_Cancel.svg"))
self.form.pushButtonRename.setIcon(QtGui.QIcon(":/icons/edit_Cancel.svg"))
# fill the styles combo
self.styles = self.read_meta()
for style in self.styles.keys():
self.form.comboBoxStyles.addItem(style)
# connect signals/slots
self.form.comboBoxStyles.currentIndexChanged.connect(self.on_style_changed)
self.form.pushButtonDelete.clicked.connect(self.on_delete)
self.form.pushButtonRename.clicked.connect(self.on_rename)
for attr in EMPTYSTYLE.keys():
control = getattr(self.form,attr)
for signal in ["textChanged","valueChanged","stateChanged"]:
if hasattr(control,signal):
getattr(control,signal).connect(self.update_style)
break
# show editor dialog
result = self.form.exec_()
# process if OK was clicked
if result:
self.save_meta(self.styles)
return
def read_meta(self):
"""reads the document Meta property and returns a dict"""
styles = {}
meta = FreeCAD.ActiveDocument.Meta
for key,value in meta.items():
if key.startswith("Draft_Style_"):
styles[key[12:]] = json.loads(value)
return styles
def save_meta(self,styles):
"""saves a dict to the document Meta property and updates objects"""
# save meta
changedstyles = []
meta = FreeCAD.ActiveDocument.Meta
for key,value in styles.items():
strvalue = json.dumps(value)
if meta["Draft_Style_"+key] and (meta["Draft_Style_"+key] != strvalue):
changedstyles.append(style)
meta["Draft_Style_"+key] = strvalue
FreeCAD.ActiveDocument.Meta = meta
# propagate changes to all annotations
for obj in self.get_annotations():
if obj.ViewObject.AnnotationStyle in styles.keys():
if obj.ViewObject.AnnotationStyle in changedstyles:
for attr,attrvalue in styles[obj.ViewObject.AnnotationStyle].items():
if hasattr(obj.ViewObject,attr):
setattr(obj.ViewObject,attr,attrvalue)
else:
obj.ViewObject.AnnotationStyle = " "
obj.ViewObject.AnnotationStyle == [" "] + styles.keys()
def on_style_changed(self,index):
"""called when the styles combobox is changed"""
from PySide import QtGui
if index <= 1:
# nothing happens
self.form.pushButtonDelete.setEnabled(False)
self.form.pushButtonRename.setEnabled(False)
self.fill_editor(None)
if index == 1:
# Add new... entry
reply = QtGui.QInputDialog.getText(None, "Create new style","Style name:")
if reply[1]:
# OK or Enter pressed
name = reply[0]
if name in self.styles:
reply = QtGui.QMessageBox.information(None,"Style exists","This style name already exists")
else:
# create new default style
self.styles[name] = EMPTYSTYLE
self.form.comboBoxStyles.addItem(name)
self.form.comboBoxStyles.setCurrentIndex(self.form.comboBoxStyles.count()-1)
elif index > 1:
# Existing style
self.form.pushButtonDelete.setEnabled(True)
self.form.pushButtonRename.setEnabled(True)
self.fill_editor(self.form.comboBoxStyles.itemText(index))
def on_delete(self):
"""called when the Delete button is pressed"""
from PySide import QtGui
index = self.form.comboBox.currentIndex()
style = self.form.comboBoxStyles.itemText(index)
if self.get_style_users(style):
reply = QtGui.QMessageBox.question(None, "Style in use", "This style is used by some objects in this document. Are you sure?",
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.No:
return
self.form.comboBoxStyles.removeItem(index)
del self.styles[style]
def on_rename(self):
"""called when the Rename button is pressed"""
from PySide import QtGui
index = self.form.comboBox.currentIndex()
style = self.form.comboBoxStyles.itemText(index)
reply = QtGui.QInputDialog.getText(None, "Rename style","New name:",QtGui.QLineEdit.Normal,style)
if reply[1]:
# OK or Enter pressed
newname = reply[0]
self.form.comboBoxStyles.setItemText(index,newname)
value = self.styles[style]
del self.styles[style]
self.styles[newname] = value
def fill_editor(self,style):
"""fills the editor fields with the contents of a style"""
if style is None:
style = EMPTYSTYLE
for key,value in style.items():
setattr(self.form,key,value)
def update_style(self,arg=None):
"""updates the current style with the values from the editor"""
index = self.form.comboBox.currentIndex()
if index > 1:
values = {}
style = self.form.comboBoxStyles.itemText(index)
for key in EMPTYSTYLE.keys():
control = getattr(self.form,key)
for attr in ["text","value","state"]:
if hasattr(control,attr):
values[key] = getattr(control,attr)
self.styles[style] = values
def get_annotations(self):
"""gets all the objects that support annotation styles"""
users = []
for obj in FreeCAD.ActiveDocument.Objects:
vobj = obj.ViewObject
if hasattr(vobj,"AnnotationStyle"):
users.append(obj)
return users
def get_style_users(self,style):
"""get all objects using a certain style"""
users = []
for obj in self.get_annotations():
if obj.ViewObject.AnnotationStyle == style:
users.append(obj)
return users
FreeCADGui.addCommand('Draft_AnnotationStyleEditor', Draft_AnnotationStyleEditor())

View File

@@ -72,6 +72,7 @@ SET(FemInOut_SRCS
feminout/importCcxFrdResults.py
feminout/importFenicsMesh.py
feminout/importInpMesh.py
feminout/importPyMesh.py
feminout/importToolsFem.py
feminout/importVTKResults.py
feminout/importYamlJsonMesh.py

View File

@@ -27,6 +27,8 @@
import FreeCAD
FreeCAD.addExportType("FEM mesh Python (*.meshpy)", "feminout.importPyMesh")
FreeCAD.addExportType("FEM mesh TetGen (*.poly)", "feminout.convert2TetGen")
# see FemMesh::read() and FemMesh::write() methods in src/Mod/Fem/App/FemMesh.cpp

View File

@@ -0,0 +1,148 @@
# ***************************************************************************
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * 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 Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
__title__ = "FreeCAD Python Mesh reader and writer"
__author__ = "Bernd Hahnebach"
__url__ = "http://www.freecadweb.org"
## @package importPyMesh
# \ingroup FEM
# \brief FreeCAD Python Mesh reader and writer for FEM workbench
import FreeCAD
from femmesh import meshtools
# ************************************************************************************************
# ********* generic FreeCAD import and export methods ********************************************
# names are fix given from FreeCAD, these methods are called from FreeCAD
# they are set in FEM modules Init.py
if open.__module__ == "__builtin__":
# because we'll redefine open below (Python2)
pyopen = open
elif open.__module__ == "io":
# because we'll redefine open below (Python3)
pyopen = open
# export mesh to python
def export(
objectslist,
filename
):
"called when freecad exports a file"
if len(objectslist) != 1:
FreeCAD.Console.PrintError("This exporter can only export one object.\n")
return
obj = objectslist[0]
if not obj.isDerivedFrom("Fem::FemMeshObject"):
FreeCAD.Console.PrintError("No FEM mesh object selected.\n")
return
femnodes_mesh = obj.FemMesh.Nodes
femelement_table = meshtools.get_femelement_table(obj.FemMesh)
if meshtools.is_solid_femmesh(obj.FemMesh):
fem_mesh_type = "Solid"
elif meshtools.is_face_femmesh(obj.FemMesh):
fem_mesh_type = "Face"
elif meshtools.is_edge_femmesh(obj.FemMesh):
fem_mesh_type = "Edge"
else:
FreeCAD.Console.PrintError("Export of this FEM mesh to Python not supported.\n")
return
f = pyopen(filename, "w")
write_python_mesh_to_file(femnodes_mesh, femelement_table, fem_mesh_type, f)
f.close()
# ************************************************************************************************
# ********* module specific methods **************************************************************
# writer:
# - a method directly writes a FemMesh to the mesh file
# - a method takes a file handle, mesh data and writes to the file handle
# ********* writer *******************************************************************************
def write(
fem_mesh,
filename
):
"""directly write a FemMesh to a Python mesh file
fem_mesh: a FemMesh"""
if not fem_mesh.isDerivedFrom("Fem::FemMesh"):
FreeCAD.Console.PrintError("Not a FemMesh was given as parameter.\n")
return
femnodes_mesh = fem_mesh.Nodes
femelement_table = meshtools.get_femelement_table(fem_mesh)
if meshtools.is_solid_femmesh(fem_mesh):
fem_mesh_type = "Solid"
elif meshtools.is_face_femmesh(fem_mesh):
fem_mesh_type = "Face"
elif meshtools.is_edge_femmesh(fem_mesh):
fem_mesh_type = "Edge"
else:
FreeCAD.Console.PrintError("Export of this FEM mesh to Python not supported.\n")
return
f = pyopen(filename, "w")
write_python_mesh_to_file(femnodes_mesh, femelement_table, fem_mesh_type, f)
f.close()
def write_python_mesh_to_file(femnodes_mesh, femelement_table, fem_mesh_type, f):
mesh_name = "femmesh"
# nodes
f.write("def create_nodes(femmesh):\n")
f.write(" # nodes\n")
for node in femnodes_mesh:
# print(node, ' --> ', femnodes_mesh[node])
vec = femnodes_mesh[node]
f.write(
" {0}.addNode({1}, {2}, {3}, {4})\n"
.format(mesh_name, vec.x, vec.y, vec.z, node)
)
f.write(" return True\n")
f.write("\n\n")
# elements
f.write("def create_elements(femmesh):\n")
f.write(" # elements\n")
for element in femelement_table:
# print(element, ' --> ', femelement_table[element])
if fem_mesh_type == "Solid":
f.write(
" {0}.addVolume({1}, {2})\n"
.format(mesh_name, list(femelement_table[element]), element)
)
elif fem_mesh_type == "Face":
f.write(
" {0}.addFace({1}, {2})\n"
.format(mesh_name, list(femelement_table[element]), element)
)
elif fem_mesh_type == "Edge":
f.write(
" {0}.addEdge({1}, {2})\n"
.format(mesh_name, list(femelement_table[element]), element)
)
f.write(" return True\n")

View File

@@ -1699,17 +1699,17 @@ def get_contact_obj_faces(
"(example: multiple element faces per master or slave\n"
)
FreeCAD.Console.PrintLog("Slave: {}, {}\n".format(slave_ref[0].Name, slave_ref))
FreeCAD.Console.PrintLog("Master: {}, {}\n".format(master_ref[0].Name, master_ref))
FreeCAD.Console.PrintLog(" Slave: {}, {}\n".format(slave_ref[0].Name, slave_ref))
FreeCAD.Console.PrintLog(" Master: {}, {}\n".format(master_ref[0].Name, master_ref))
if is_solid_femmesh(femmesh):
# get the nodes, sorted and duplicates removed
FreeCAD.Console.PrintLog(" Get the nodes, sorted and duplicates removed.\n")
slaveface_nds = sorted(list(set(get_femnodes_by_refshape(femmesh, slave_ref))))
masterface_nds = sorted(list(set(get_femnodes_by_refshape(femmesh, master_ref))))
# FreeCAD.Console.PrintLog("slaveface_nds: {}\n".format(slaveface_nds))
# FreeCAD.Console.PrintLog("masterface_nds: {}\n".format(slaveface_nds))
FreeCAD.Console.PrintLog(" slaveface_nds: {}\n".format(slaveface_nds))
FreeCAD.Console.PrintLog(" masterface_nds: {}\n".format(slaveface_nds))
# fill the bit_pattern_dict and search for the faces
FreeCAD.Console.PrintLog(" Fill the bit_pattern_dict and search for the faces.\n")
slave_bit_pattern_dict = get_bit_pattern_dict(
femelement_table,
femnodes_ele_table,
@@ -1721,16 +1721,18 @@ def get_contact_obj_faces(
masterface_nds
)
# get the faces ids
FreeCAD.Console.PrintLog(" Get the FaceIDs.\n")
slave_faces = get_ccxelement_faces_from_binary_search(slave_bit_pattern_dict)
master_faces = get_ccxelement_faces_from_binary_search(master_bit_pattern_dict)
elif is_face_femmesh(femmesh):
slave_ref_shape = slave_ref[0].Shape.getElement(slave_ref[1][0])
master_ref_shape = master_ref[0].Shape.getElement(master_ref[1][0])
# get the faces ids
FreeCAD.Console.PrintLog(" Get the FaceIDs.\n")
slave_face_ids = femmesh.getFacesByFace(slave_ref_shape)
master_face_ids = femmesh.getFacesByFace(master_ref_shape)
# build slave_faces and master_faces
# face 2 for tria6 element
# is it face 2 for all shell elements
@@ -1739,8 +1741,13 @@ def get_contact_obj_faces(
for fid in master_face_ids:
master_faces.append([fid, 2])
FreeCAD.Console.PrintLog("slave_faces: {}\n".format(slave_faces))
FreeCAD.Console.PrintLog("master_faces: {}\n".format(master_faces))
FreeCAD.Console.PrintLog(" Master and slave face ready to use for writer:\n")
FreeCAD.Console.PrintLog(" slave_faces: {}\n".format(slave_faces))
FreeCAD.Console.PrintLog(" master_faces: {}\n".format(master_faces))
if len(slave_faces) == 0:
FreeCAD.Console.PrintError("No faces found for contact slave face.\n")
if len(master_faces) == 0:
FreeCAD.Console.PrintError("No faces found for contact master face.\n")
return [slave_faces, master_faces]

View File

@@ -107,6 +107,7 @@ SET(PathScripts_SRCS
PathScripts/PathStop.py
PathScripts/PathSurface.py
PathScripts/PathSurfaceGui.py
PathScripts/PathSurfaceSupport.py
PathScripts/PathToolBit.py
PathScripts/PathToolBitCmd.py
PathScripts/PathToolBitEdit.py

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<width>368</width>
<height>400</height>
</rect>
</property>
@@ -59,6 +59,9 @@
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="scanType">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Planar: Flat, 3D surface scan. Rotational: 4th-axis rotational scan.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Planar</string>
@@ -73,6 +76,9 @@
</item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="layerMode">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Complete the operation in a single pass at depth, or mulitiple passes to final depth.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Single-pass</string>
@@ -127,6 +133,9 @@
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="optimizeEnabled">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable optimization of linear paths (co-linear points). Removes unnecessary co-linear points from G-Code output.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Optimize Linear Paths</string>
</property>
@@ -148,6 +157,9 @@
</item>
<item row="12" column="0">
<widget class="QCheckBox" name="useStartPoint">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Make True, if specifying a Start Point&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use Start Point</string>
</property>
@@ -169,6 +181,9 @@
</item>
<item row="7" column="1" colspan="2">
<widget class="Gui::InputField" name="depthOffset" native="true">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the Z-axis depth offset from the target surface.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
@@ -184,6 +199,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Additional offset to the selected bounding box along the X axis.&quot;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
@@ -191,6 +209,9 @@
</item>
<item>
<widget class="Gui::InputField" name="boundBoxExtraOffsetY" native="true">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Additional offset to the selected bounding box along the Y axis.&quot;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
@@ -200,6 +221,9 @@
</item>
<item row="10" column="1" colspan="2">
<widget class="Gui::InputField" name="sampleInterval" native="true">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the sampling resolution. Smaller values quickly increase processing time.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
@@ -214,6 +238,9 @@
</item>
<item row="6" column="1" colspan="2">
<widget class="QComboBox" name="dropCutterDirSelect">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Dropcutter lines are created parallel to this axis.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>X</string>
@@ -228,6 +255,9 @@
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="boundBoxSelect">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select the overall boundary for the operation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Stock</string>
@@ -242,6 +272,9 @@
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="optimizeStepOverTransitions">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable separate optimization of transitions between, and breaks within, each step over path.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Optimize StepOver Transitions</string>
</property>
@@ -256,16 +289,9 @@
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="cutPattern">
<item>
<property name="text">
<string>Line</string>
</property>
</item>
<item>
<property name="text">
<string>ZigZag</string>
</property>
</item>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the geometric clearing pattern to use for the operation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Circular</string>
@@ -276,6 +302,26 @@
<string>CircularZigZag</string>
</property>
</item>
<item>
<property name="text">
<string>Line</string>
</property>
</item>
<item>
<property name="text">
<string>Offset</string>
</property>
</item>
<item>
<property name="text">
<string>Spiral</string>
</property>
</item>
<item>
<property name="text">
<string>ZigZag</string>
</property>
</item>
</widget>
</item>
</layout>
@@ -299,8 +345,8 @@
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QWidget</extends>
<header>gui::inputfield.h</header>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
</customwidget>
</customwidgets>
<resources/>

View File

@@ -50,6 +50,9 @@
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select the overall boundary for the operation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Stock</string>
@@ -70,6 +73,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Positive values push the cutter toward, or beyond, the boundary. Negative values retract the cutter away from the boundary.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="3">
@@ -79,6 +85,9 @@
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Complete the operation in a single pass at depth, or mulitiple passes to final depth.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Single-pass</string>
@@ -93,6 +102,9 @@
</item>
<item row="0" column="3">
<widget class="QComboBox" name="algorithmSelect">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select the algorithm to use: OCL Dropcutter*, or Experimental (Not OCL based).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>OCL Dropcutter</string>
@@ -107,6 +119,9 @@
</item>
<item row="11" column="3">
<widget class="QCheckBox" name="optimizeEnabled">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable optimization of linear paths (co-linear points). Removes unnecessary co-linear points from G-Code output.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Optimize Linear Paths</string>
</property>
@@ -132,6 +147,9 @@
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the geometric clearing pattern to use for the operation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>None</string>
@@ -213,6 +231,9 @@
</item>
<item row="9" column="3">
<widget class="Gui::InputField" name="sampleInterval" native="true">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the sampling resolution. Smaller values quickly increase processing time.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
@@ -260,8 +281,8 @@
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QWidget</extends>
<header>gui::inputfield.h</header>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
</customwidget>
</customwidgets>
<resources/>

File diff suppressed because it is too large Load Diff

View File

@@ -41,7 +41,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
def initPage(self, obj):
self.setTitle("3D Surface")
self.updateVisibility()
# self.updateVisibility()
def getForm(self):
'''getForm() ... returns UI'''
@@ -118,6 +118,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
else:
self.form.optimizeStepOverTransitions.setCheckState(QtCore.Qt.Unchecked)
self.updateVisibility()
def getSignalsForUpdate(self, obj):
'''getSignalsForUpdate(obj) ... return list of signals for updating obj'''
signals = []
@@ -140,16 +142,26 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
return signals
def updateVisibility(self):
if self.form.scanType.currentText() == "Planar":
self.form.cutPattern.setEnabled(True)
self.form.boundBoxExtraOffsetX.setEnabled(False)
self.form.boundBoxExtraOffsetY.setEnabled(False)
self.form.dropCutterDirSelect.setEnabled(False)
else:
self.form.cutPattern.setEnabled(False)
self.form.boundBoxExtraOffsetX.setEnabled(True)
self.form.boundBoxExtraOffsetY.setEnabled(True)
self.form.dropCutterDirSelect.setEnabled(True)
if self.form.scanType.currentText() == 'Planar':
self.form.cutPattern.show()
self.form.cutPattern_label.show()
self.form.optimizeStepOverTransitions.show()
self.form.boundBoxExtraOffsetX.hide()
self.form.boundBoxExtraOffsetY.hide()
self.form.boundBoxExtraOffset_label.hide()
self.form.dropCutterDirSelect.hide()
self.form.dropCutterDirSelect_label.hide()
elif self.form.scanType.currentText() == 'Rotational':
self.form.cutPattern.hide()
self.form.cutPattern_label.hide()
self.form.optimizeStepOverTransitions.hide()
self.form.boundBoxExtraOffsetX.show()
self.form.boundBoxExtraOffsetY.show()
self.form.boundBoxExtraOffset_label.show()
self.form.dropCutterDirSelect.show()
self.form.dropCutterDirSelect_label.show()
def registerSignalHandlers(self, obj):
self.form.scanType.currentIndexChanged.connect(self.updateVisibility)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -90,6 +90,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
else:
self.form.optimizeEnabled.setCheckState(QtCore.Qt.Unchecked)
self.updateVisibility()
def getSignalsForUpdate(self, obj):
'''getSignalsForUpdate(obj) ... return list of signals for updating obj'''
signals = []
@@ -106,21 +108,32 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
return signals
def updateVisibility(self):
if self.form.algorithmSelect.currentText() == 'OCL Dropcutter':
self.form.cutPattern.setEnabled(False)
self.form.boundaryAdjustment.setEnabled(False)
self.form.stepOver.setEnabled(False)
self.form.sampleInterval.setEnabled(True)
self.form.optimizeEnabled.setEnabled(True)
else:
self.form.cutPattern.setEnabled(True)
self.form.boundaryAdjustment.setEnabled(True)
'''updateVisibility()... Updates visibility of Tasks panel objects.'''
Algorithm = self.form.algorithmSelect.currentText()
self.form.optimizeEnabled.hide() # Has no independent QLabel object
if Algorithm == 'OCL Dropcutter':
self.form.cutPattern.hide()
self.form.cutPattern_label.hide()
self.form.boundaryAdjustment.hide()
self.form.boundaryAdjustment_label.hide()
self.form.stepOver.hide()
self.form.stepOver_label.hide()
self.form.sampleInterval.show()
self.form.sampleInterval_label.show()
elif Algorithm == 'Experimental':
self.form.cutPattern.show()
self.form.boundaryAdjustment.show()
self.form.cutPattern_label.show()
self.form.boundaryAdjustment_label.show()
if self.form.cutPattern.currentText() == 'None':
self.form.stepOver.setEnabled(False)
self.form.stepOver.hide()
self.form.stepOver_label.hide()
else:
self.form.stepOver.setEnabled(True)
self.form.sampleInterval.setEnabled(False)
self.form.optimizeEnabled.setEnabled(False)
self.form.stepOver.show()
self.form.stepOver_label.show()
self.form.sampleInterval.hide()
self.form.sampleInterval_label.hide()
def registerSignalHandlers(self, obj):
self.form.algorithmSelect.currentIndexChanged.connect(self.updateVisibility)

View File

@@ -581,13 +581,13 @@ void CmdTechDrawCenterLineGroup::activated(int iMsg)
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
pcAction->setIcon(pcAction->actions().at(iMsg)->icon());
switch(iMsg) {
case 0:
case 0: //faces
execCenterLine(this);
break;
case 1:
case 1: //2 lines
exec2LineCenterLine(this);
break;
case 2:
case 2: //2 points
exec2PointCenterLine(this);
break;
default:
@@ -743,29 +743,23 @@ void execCenterLine(Gui::Command* cmd)
if (!faceNames.empty()) {
Gui::Control().showDialog(new TaskDlgCenterLine(baseFeat,
page,
faceNames));
faceNames,
false));
} else if (edgeNames.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
QObject::tr("No CenterLine in selection."));
return;
} else {
std::string edgeName = edgeNames.front();
int geomIdx = DrawUtil::getIndexFromName(edgeName);
const std::vector<TechDraw::BaseGeom *> &geoms = baseFeat->getEdgeGeometry();
BaseGeom* bg = geoms.at(geomIdx);
// int clIdx = bg->sourceIndex();
// TechDraw::CenterLine* cl = baseFeat->getCenterLineByIndex(clIdx);
std::string tag = bg->getCosmeticTag();
TechDraw::CenterLine* cl = baseFeat->getCenterLine(tag);
TechDraw::CenterLine* cl = baseFeat->getCenterLineBySelection(edgeNames.front());
if (cl == nullptr) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
QObject::tr("No CenterLine in selection."));
QObject::tr("Selection is not a CenterLine."));
return;
}
Gui::Control().showDialog(new TaskDlgCenterLine(baseFeat,
page,
edgeNames.front()));
edgeNames.front(),
true));
}
}
@@ -825,25 +819,19 @@ void exec2LineCenterLine(Gui::Command* cmd)
if (selectedEdges.size() == 2) {
Gui::Control().showDialog(new TaskDlgCenterLine(dvp,
page,
selectedEdges));
selectedEdges,
false));
} else if (selectedEdges.size() == 1) {
std::string edgeName = selectedEdges.front();
int geomIdx = DrawUtil::getIndexFromName(edgeName);
const std::vector<TechDraw::BaseGeom *> &geoms = dvp->getEdgeGeometry();
BaseGeom* bg = geoms.at(geomIdx);
// int clIdx = bg->sourceIndex();
// TechDraw::CenterLine* cl = dvp->getCenterLineByIndex(clIdx);
std::string tag = bg->getCosmeticTag();
TechDraw::CenterLine* cl = dvp->getCenterLine(tag);
TechDraw::CenterLine* cl = dvp->getCenterLineBySelection(selectedEdges.front());
if (cl == nullptr) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
QObject::tr("No CenterLine in selection."));
QObject::tr("Selection is not a CenterLine."));
return;
} else {
// Base::Console().Message("CMD::2LineCenter - show edit dialog here\n");
Gui::Control().showDialog(new TaskDlgCenterLine(dvp,
page,
selectedEdges.front()));
selectedEdges.front(),
true));
}
} else { //not create, not edit, what is this???
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
@@ -942,14 +930,23 @@ void exec2PointCenterLine(Gui::Command* cmd)
if (!vertexNames.empty() && (vertexNames.size() == 2)) {
Gui::Control().showDialog(new TaskDlgCenterLine(baseFeat,
page,
vertexNames));
vertexNames,
false));
} else if (!edgeNames.empty() && (edgeNames.size() == 1)) {
TechDraw::CenterLine* cl = baseFeat->getCenterLineBySelection(edgeNames.front());
if (cl == nullptr) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
QObject::tr("Selection is not a CenterLine."));
return;
}
Gui::Control().showDialog(new TaskDlgCenterLine(baseFeat,
page,
edgeNames.front()));
edgeNames.front(),
false));
} else if (vertexNames.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
QObject::tr("No CenterLine in selection."));
QObject::tr("Need 2 Vertices or 1 CenterLine."));
return;
}
}

View File

@@ -74,15 +74,16 @@ using namespace TechDrawGui;
//ctor for edit
TaskCenterLine::TaskCenterLine(TechDraw::DrawViewPart* partFeat,
TechDraw::DrawPage* page,
std::string edgeName) :
std::string edgeName,
bool editMode) :
ui(new Ui_TaskCenterLine),
m_partFeat(partFeat),
m_basePage(page),
m_createMode(false),
m_edgeName(edgeName),
m_type(0), //0 - Face, 1 - 2 Lines, 2 - 2 points
m_mode(0) //0 - vertical, 1 - horizontal, 2 - aligned
m_mode(0), //0 - vertical, 1 - horizontal, 2 - aligned
m_editMode(editMode)
{
// Base::Console().Message("TCL::TCL() - edit mode\n");
ui->setupUi(this);
@@ -104,14 +105,16 @@ TaskCenterLine::TaskCenterLine(TechDraw::DrawViewPart* partFeat,
//ctor for creation
TaskCenterLine::TaskCenterLine(TechDraw::DrawViewPart* partFeat,
TechDraw::DrawPage* page,
std::vector<std::string> subNames) :
std::vector<std::string> subNames,
bool editMode) :
ui(new Ui_TaskCenterLine),
m_partFeat(partFeat),
m_basePage(page),
m_createMode(true),
m_subNames(subNames),
m_type(0), //0 - Face, 1 - 2 Lines, 2 - 2 points
m_mode(0) //0 - vertical, 1 - horizontal, 2 - aligned
m_mode(0), //0 - vertical, 1 - horizontal, 2 - aligned
m_editMode(editMode)
{
// Base::Console().Message("TCL::TCL() - create mode\n");
if ( (m_basePage == nullptr) ||
@@ -501,10 +504,11 @@ bool TaskCenterLine::reject()
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TaskDlgCenterLine::TaskDlgCenterLine(TechDraw::DrawViewPart* partFeat,
TechDraw::DrawPage* page,
std::vector<std::string> subNames)
std::vector<std::string> subNames,
bool editMode)
: TaskDialog()
{
widget = new TaskCenterLine(partFeat,page,subNames);
widget = new TaskCenterLine(partFeat,page,subNames, editMode);
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-facecenterline"),
widget->windowTitle(), true, 0);
taskbox->groupLayout()->addWidget(widget);
@@ -513,10 +517,11 @@ TaskDlgCenterLine::TaskDlgCenterLine(TechDraw::DrawViewPart* partFeat,
TaskDlgCenterLine::TaskDlgCenterLine(TechDraw::DrawViewPart* partFeat,
TechDraw::DrawPage* page,
std::string edgeName)
std::string edgeName,
bool editMode)
: TaskDialog()
{
widget = new TaskCenterLine(partFeat,page, edgeName);
widget = new TaskCenterLine(partFeat,page, edgeName, editMode);
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-facecenterline"),
widget->windowTitle(), true, 0);
taskbox->groupLayout()->addWidget(widget);

View File

@@ -75,10 +75,12 @@ class TaskCenterLine : public QWidget
public:
TaskCenterLine(TechDraw::DrawViewPart* baseFeat,
TechDraw::DrawPage* page,
std::vector<std::string> subNames);
std::vector<std::string> subNames,
bool editMode);
TaskCenterLine(TechDraw::DrawViewPart* baseFeat,
TechDraw::DrawPage* page,
std::string edgeName);
std::string edgeName,
bool editMode);
~TaskCenterLine();
public Q_SLOTS:
@@ -145,6 +147,7 @@ private:
int m_clIdx;
int m_type;
int m_mode;
bool m_editMode;
};
class TaskDlgCenterLine : public Gui::TaskView::TaskDialog
@@ -154,10 +157,12 @@ class TaskDlgCenterLine : public Gui::TaskView::TaskDialog
public:
TaskDlgCenterLine(TechDraw::DrawViewPart* baseFeat,
TechDraw::DrawPage* page,
std::vector<std::string> subNames);
std::vector<std::string> subNames,
bool editMode);
TaskDlgCenterLine(TechDraw::DrawViewPart* baseFeat,
TechDraw::DrawPage* page,
std::string edgeName);
std::string edgeName,
bool editMode);
~TaskDlgCenterLine();
public: