Merge branch 'master' into bugfix/boundary-dressup-cleanup

This commit is contained in:
mlampert
2019-11-11 18:25:00 -08:00
committed by GitHub
7 changed files with 151 additions and 66 deletions

View File

@@ -553,9 +553,13 @@ class _Wall(ArchComponent.Component):
obj.addProperty("App::PropertyInteger","Face","Wall",QT_TRANSLATE_NOOP("App::Property","The face number of the base object used to build this wall"))
if not "Offset" in lp:
obj.addProperty("App::PropertyDistance","Offset","Wall",QT_TRANSLATE_NOOP("App::Property","The offset between this wall and its baseline (only for left and right alignments)"))
if not "Refine" in lp:
obj.addProperty("App::PropertyEnumeration","Refine","Wall",QT_TRANSLATE_NOOP("App::Property","Select whether or not and the method to remove splitter of the Wall. Currently Draft removeSplitter and Part removeSplitter available but may not work on complex sketch."))
obj.Refine = ['No','DraftRemoveSplitter','PartRemoveSplitter']
# See getExtrusionData(), removeSplitters are no longer used
#if not "Refine" in lp:
# obj.addProperty("App::PropertyEnumeration","Refine","Wall",QT_TRANSLATE_NOOP("App::Property","Select whether or not and the method to remove splitter of the Wall. Currently Draft removeSplitter and Part removeSplitter available but may not work on complex sketch."))
# obj.Refine = ['No','DraftRemoveSplitter','PartRemoveSplitter']
# TODO - To implement in Arch Component ?
if not "MakeBlocks" in lp:
obj.addProperty("App::PropertyBool","MakeBlocks","Blocks",QT_TRANSLATE_NOOP("App::Property","Enable this to make the wall generate blocks"))
if not "BlockLength" in lp:
@@ -597,11 +601,28 @@ class _Wall(ArchComponent.Component):
extv = extdata[2].Rotation.multVec(extdata[1])
if isinstance(bplates,list):
shps = []
# Test : if base is Sketch, then fuse all solid; otherwise, makeCompound
sketchBaseToFuse = obj.Base.isDerivedFrom("Sketcher::SketchObject")
for b in bplates:
b.Placement = extdata[2].multiply(b.Placement)
b = b.extrude(extv)
shps.append(b)
base = Part.makeCompound(shps)
# See getExtrusionData() - not fusing baseplates there - fuse solids here
# Remarks - If solids are fused, but exportIFC.py use underlying baseplates w/o fuse, the result in ifc look slightly different from in FC.
if sketchBaseToFuse:
if shps:
shps = shps.fuse(b) #shps.fuse(b)
else:
shps=b
else:
shps.append(b)
# TODO - To let user to select whether to fuse (slower) or to do a compound (faster) only ?
if sketchBaseToFuse:
base = shps
else:
base = Part.makeCompound(shps)
else:
bplates.Placement = extdata[2].multiply(bplates.Placement)
base = bplates.extrude(extv)
@@ -960,23 +981,38 @@ class _Wall(ArchComponent.Component):
sh.fix(0.1,0,1) # fixes self-intersecting wires
f = Part.Face(sh)
if baseface:
if layers:
if layers[i] >= 0:
baseface.append(f)
else:
baseface = baseface.fuse(f)
if obj.Refine == 'DraftRemoveSplitter':
s = DraftGeomUtils.removeSplitter(baseface)
if s:
baseface = s
elif obj.Refine == 'PartRemoveSplitter':
baseface = baseface.removeSplitter()
# To allow exportIFC.py to work properly on sketch, which use only 1st face / wire, do not fuse baseface here
# So for a sketch with multiple wires, each returns individual face (rather than fusing together) for exportIFC.py to work properly
# "ArchWall - Based on Sketch Issues" - https://forum.freecadweb.org/viewtopic.php?f=39&t=31235
#
baseface.append(f)
# The above make Refine methods below (in else) useless, regardless removeSpitters yet to be improved for cases do not work well
''' Whether layers or not, all baseface.append(f) '''
#if layers:
# if layers[i] >= 0:
# baseface.append(f)
#else:
#baseface = baseface.fuse(f)
#if obj.Refine == 'DraftRemoveSplitter':
# s = DraftGeomUtils.removeSplitter(baseface)
# if s:
# baseface = s
#elif obj.Refine == 'PartRemoveSplitter':
# baseface = baseface.removeSplitter()
else:
if layers:
if layers[i] >= 0:
baseface = [f]
else:
baseface = f
baseface = [f]
''' Whether layers or not, all baseface = [f] '''
#if layers:
# if layers[i] >= 0:
# baseface = [f]
#else:
#baseface = f
if baseface:
base,placement = self.rebase(baseface)
else:

View File

@@ -79,8 +79,9 @@ class Edit():
self.originalNodes = None
# settings
self.maxObjects = 1
self.pick_radius = self.getPickRadius()
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
self.maxObjects = param.GetInt("DraftEditMaxObjects", 5)
self.pick_radius = param.GetInt("DraftEditPickRadius", 20)
# preview
self.ghost = None
@@ -94,15 +95,6 @@ class Edit():
self.supportedPartObjs = ["Sketch", "Sketcher::SketchObject", \
"Part", "Part::Line", "Part::Box"]
def getPickRadius(self):
"""return DraftEditPickRadius from user preferences"""
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
if param.GetInt("DraftEditPickRadius", 0) == 0:
param.SetInt("DraftEditPickRadius", 20)
return 20
else:
return param.GetInt("DraftEditPickRadius")
def GetResources(self):
return {'Pixmap' : 'Draft_Edit',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_Edit", "Edit"),
@@ -159,8 +151,9 @@ class Edit():
"terminates Edit Tool"
self.unregister_selection_callback()
self.unregister_editing_callbacks()
FreeCADGui.Snapper.setSelectMode(False)
self.editing = None
self.finalizeGhost()
FreeCADGui.Snapper.setSelectMode(False)
if self.obj and closed:
if "Closed" in self.obj.PropertiesList:
if not self.obj.Closed:
@@ -245,11 +238,7 @@ class Edit():
key = event.getKey()
#FreeCAD.Console.PrintMessage("pressed key : "+str(key)+"\n")
if key == 65307: # ESC
if self.editing is None: self.finish()
else:
self.finalizeGhost()
self.setEditPoints(self.obj)
self.resetTrackers()
self.finish()
if key == 97: # "a"
self.finish()
if key == 111: # "o"

View File

@@ -2367,7 +2367,7 @@ class Move(Modifier):
def Activated(self):
self.name = translate("draft","Move", utf8_decode=True)
Modifier.Activated(self, self.name,
is_subtool=isinstance(FreeCAD.activeDraftCommand, SubelementModify))
is_subtool=isinstance(FreeCAD.activeDraftCommand, SubelementHighlight))
if not self.ui:
return
self.ghosts = []
@@ -4270,8 +4270,8 @@ class ToggleDisplayMode():
if "Flat Lines" in obj.ViewObject.listDisplayModes():
obj.ViewObject.DisplayMode = "Flat Lines"
class SubelementModify(Modifier):
"""The Draft_SubelementModify FreeCAD command definition"""
class SubelementHighlight(Modifier):
"""The Draft_SubelementHighlight FreeCAD command definition"""
def __init__(self):
self.is_running = False
@@ -4279,18 +4279,20 @@ class SubelementModify(Modifier):
self.original_view_settings = {}
def GetResources(self):
return {'Pixmap' : 'Draft_SubelementModify',
return {'Pixmap' : 'Draft_SubelementHighlight',
'Accel' : "D, E",
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_SubelementModify", "Subelement modify"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_SubelementModify",
"Allows editing the subelements "
"of the selected objects with other modification tools")}
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_SubelementHighlight", "Subelement highlight"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_SubelementHighlight",
"Highlight the subelements "
"of the selected objects, "
"so that they can then be edited "
"with the move, rotate, and scale tools")}
def Activated(self):
if self.is_running:
return self.finish()
self.is_running = True
Modifier.Activated(self, "SubelementModify")
Modifier.Activated(self, "SubelementHighlight")
self.get_selection()
def proceed(self):
@@ -5683,7 +5685,7 @@ FreeCADGui.addCommand('Draft_Downgrade',Downgrade())
FreeCADGui.addCommand('Draft_Trimex',Trimex())
FreeCADGui.addCommand('Draft_Scale',Scale())
FreeCADGui.addCommand('Draft_Drawing',Drawing())
FreeCADGui.addCommand('Draft_SubelementModify', SubelementModify())
FreeCADGui.addCommand('Draft_SubelementHighlight', SubelementHighlight())
FreeCADGui.addCommand('Draft_AddPoint',AddPoint())
FreeCADGui.addCommand('Draft_DelPoint',DelPoint())
FreeCADGui.addCommand('Draft_WireToBSpline',WireToBSpline())

View File

@@ -82,7 +82,7 @@ class DraftWorkbench(Workbench):
self.modList = ["Draft_Move", "Draft_Rotate", "Draft_Offset",
"Draft_Trimex", "Draft_Join", "Draft_Split",
"Draft_Upgrade", "Draft_Downgrade", "Draft_Scale",
"Draft_Edit", "Draft_SubelementModify",
"Draft_Edit", "Draft_SubelementHighlight",
"Draft_WireToBSpline", "Draft_AddPoint",
"Draft_DelPoint", "Draft_Shape2DView",
"Draft_Draft2Sketch", "Draft_Array", "Draft_LinkArray",

View File

@@ -62,7 +62,7 @@
<file>icons/Draft_Snap.svg</file>
<file>icons/Draft_Split.svg</file>
<file>icons/Draft_Stretch.svg</file>
<file>icons/Draft_SubelementModify.svg</file>
<file>icons/Draft_SubelementHighlight.svg</file>
<file>icons/Draft_SwitchMode.svg</file>
<file>icons/Draft_Text.svg</file>
<file>icons/Draft_Trimex.svg</file>

View File

@@ -15,7 +15,7 @@
id="svg3612"
version="1.1"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="Draft_SubelementModify.svg">
sodipodi:docname="Draft_SubelementHighlight.svg">
<defs
id="defs3614">
<radialGradient

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>567</width>
<height>561</height>
<width>612</width>
<height>574</height>
</rect>
</property>
<property name="windowTitle">
@@ -532,19 +532,77 @@
<property name="title">
<string>Edit</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16" stretch="0,0,0">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_8">
<property name="toolTip">
<string>Sets the maximum number of objects Draft Edit can handle at the same time</string>
</property>
<property name="text">
<string>Maximum number of contemporary edited objects</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Gui::PrefSpinBox" name="gui::prefspinbox_10">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Mainlines will be drawn thicker. Specify here how many squares between mainlines.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>25</number>
</property>
<property name="value">
<number>5</number>
</property>
<property name="displayIntegerBase">
<number>10</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>DraftEditMaxObjects</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0">
<property name="leftMargin">