From e45a3674f05a7da86718bb9e2a0189bf415a8b67 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 26 Jul 2018 19:23:48 -0300 Subject: [PATCH] Arch: bugfixes in IFC exporter --- src/Mod/Arch/ArchComponent.py | 2 +- src/Mod/Arch/importIFC.py | 4 ++++ src/Mod/Draft/DraftGeomUtils.py | 6 ++++-- src/Mod/Draft/DraftTools.py | 9 +++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 31c9e521b0..8cf765f99a 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -583,7 +583,7 @@ class Component: if hasattr(obj.Axis.Proxy,"getPoints"): points = obj.Axis.Proxy.getPoints(obj.Axis) if not points: - if obj.Axis.isDerivedFrom("Part.Feature"): + if obj.Axis.isDerivedFrom("Part::Feature"): points = [v.Point for v in obj.Axis.Shape.Vertexes] if points: shps = [] diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 8bbf82d367..34ee4d8b95 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -2309,6 +2309,10 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess # base shape not yet created tostore = k + # unhandled case: object is duplicated because of Axis + if obj.isDerivedFrom("Part::Feature") and (len(obj.Shape.Solids) > 1) and hasattr(obj,"Axis") and obj.Axis: + forcebrep = True + if (not shapes) and (not forcebrep): profile = None ev = FreeCAD.Vector() diff --git a/src/Mod/Draft/DraftGeomUtils.py b/src/Mod/Draft/DraftGeomUtils.py index 88ad4e8bf4..f24c374ac4 100755 --- a/src/Mod/Draft/DraftGeomUtils.py +++ b/src/Mod/Draft/DraftGeomUtils.py @@ -640,8 +640,10 @@ def findClosest(basepoint,pointslist): in a list of 3d points, finds the closest point to the base point. an index from the list is returned. ''' - if not pointslist: return None - smallest = 100000 + npoint = None + if not pointslist: + return None + smallest = 1000000 for n in range(len(pointslist)): new = basepoint.sub(pointslist[n]).Length if new < smallest: diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index c5cd61c65f..69a2e7d1b9 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -4918,6 +4918,10 @@ class ShowSnapBar(): class Draft_Clone(Modifier): "The Draft Clone command definition" + def __init__(self): + Modifier.__init__(self) + self.moveAfterCloning = False + def GetResources(self): return {'Pixmap' : 'Draft_Clone', 'Accel' : "C,L", @@ -4950,6 +4954,11 @@ class Draft_Clone(Modifier): FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.Objects[-(1+i)]) self.finish() + def finish(self,close=False): + Modifier.finish(self,close=False) + if self.moveAfterCloning: + todo.delay(FreeCADGui.runCommand,"Draft_Move") + class ToggleGrid(): "The Draft ToggleGrid command definition"