diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 04513aefac..544630dc7a 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -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: diff --git a/src/Mod/Draft/DraftEdit.py b/src/Mod/Draft/DraftEdit.py index c267b11303..d97a7f2111 100644 --- a/src/Mod/Draft/DraftEdit.py +++ b/src/Mod/Draft/DraftEdit.py @@ -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" diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 2eb8c61585..877addc6c8 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -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()) diff --git a/src/Mod/Draft/InitGui.py b/src/Mod/Draft/InitGui.py index cd6931dc20..16cd32a230 100644 --- a/src/Mod/Draft/InitGui.py +++ b/src/Mod/Draft/InitGui.py @@ -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", diff --git a/src/Mod/Draft/Resources/Draft.qrc b/src/Mod/Draft/Resources/Draft.qrc index a14e6b1ab8..0e9c089cb4 100644 --- a/src/Mod/Draft/Resources/Draft.qrc +++ b/src/Mod/Draft/Resources/Draft.qrc @@ -62,7 +62,7 @@ icons/Draft_Snap.svg icons/Draft_Split.svg icons/Draft_Stretch.svg - icons/Draft_SubelementModify.svg + icons/Draft_SubelementHighlight.svg icons/Draft_SwitchMode.svg icons/Draft_Text.svg icons/Draft_Trimex.svg diff --git a/src/Mod/Draft/Resources/icons/Draft_SubelementModify.svg b/src/Mod/Draft/Resources/icons/Draft_SubelementHighlight.svg similarity index 99% rename from src/Mod/Draft/Resources/icons/Draft_SubelementModify.svg rename to src/Mod/Draft/Resources/icons/Draft_SubelementHighlight.svg index edf5524e1b..047bb396e3 100644 --- a/src/Mod/Draft/Resources/icons/Draft_SubelementModify.svg +++ b/src/Mod/Draft/Resources/icons/Draft_SubelementHighlight.svg @@ -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"> 0 0 - 567 - 561 + 612 + 574 @@ -532,19 +532,77 @@ Edit - - - 9 - - - 9 - - - 9 - - - 9 - + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Sets the maximum number of objects Draft Edit can handle at the same time + + + Maximum number of contemporary edited objects + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + Mainlines will be drawn thicker. Specify here how many squares between mainlines. + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + 25 + + + 5 + + + 10 + + + DraftEditMaxObjects + + + Mod/Draft + + + + +