From c17ed6b3cd4be4c6d04fb1265c3968b2bb162f2a Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 3 Jan 2012 23:29:13 -0200 Subject: [PATCH 01/12] + small fix in Draft perpendicular snap --- src/Mod/Draft/DraftSnap.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/DraftSnap.py index 7d6e59353..7bd5ce5da 100644 --- a/src/Mod/Draft/DraftSnap.py +++ b/src/Mod/Draft/DraftSnap.py @@ -360,6 +360,8 @@ class Snapper: dv = last.sub(shape.Curve.Center) dv = fcvec.scaleTo(dv,shape.Curve.Radius) np = (shape.Curve.Center).add(dv) + else: + return snaps snaps.append([np,'perpendicular',np]) return snaps From ccf878ec167bee52ab86b7fe9cd0a04331691bff Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 4 Jan 2012 12:06:02 -0200 Subject: [PATCH 02/12] Various fixes to Draft and Arch + Renamed Draft Scale object to Clone + Removed BasePoint property from Draft Clone + Reenabled Draft SelectPlane tool + Added Draft context tools to Arch module + Made the Arch module load pycollada later --- src/Mod/Arch/ArchWall.py | 0 src/Mod/Arch/Init.py | 0 src/Mod/Arch/InitGui.py | 148 ++++++++++++++++-------------- src/Mod/Arch/ifcReader.py | 0 src/Mod/Arch/importDAE.py | 14 ++- src/Mod/Draft/Draft.py | 25 +++-- src/Mod/Draft/DraftTools.py | 0 src/Mod/Draft/InitGui.py | 16 ++-- src/Mod/Draft/importAirfoilDAT.py | 0 src/Mod/Draft/macros.py | 0 10 files changed, 110 insertions(+), 93 deletions(-) mode change 100755 => 100644 src/Mod/Arch/ArchWall.py mode change 100755 => 100644 src/Mod/Arch/Init.py mode change 100755 => 100644 src/Mod/Arch/InitGui.py mode change 100755 => 100644 src/Mod/Arch/ifcReader.py mode change 100755 => 100644 src/Mod/Draft/DraftTools.py mode change 100755 => 100644 src/Mod/Draft/importAirfoilDAT.py mode change 100755 => 100644 src/Mod/Draft/macros.py diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py old mode 100755 new mode 100644 diff --git a/src/Mod/Arch/Init.py b/src/Mod/Arch/Init.py old mode 100755 new mode 100644 diff --git a/src/Mod/Arch/InitGui.py b/src/Mod/Arch/InitGui.py old mode 100755 new mode 100644 index 7df441047..0d069b29b --- a/src/Mod/Arch/InitGui.py +++ b/src/Mod/Arch/InitGui.py @@ -22,78 +22,84 @@ #*************************************************************************** class ArchWorkbench(Workbench): - "Arch workbench object" - Icon = """ - /* XPM */ - static char * arch_xpm[] = { - "16 16 9 1", - " c None", - ". c #543016", - "+ c #6D2F08", - "@ c #954109", - "# c #874C24", - "$ c #AE6331", - "% c #C86423", - "& c #FD7C26", - "* c #F5924F", - " ", - " ", - " # ", - " ***$# ", - " .*******. ", - " *##$****#+ ", - " #**%&&##$#@@ ", - ".$**%&&&&+@@+ ", - "@&@#$$%&&@@+.. ", - "@&&&%#.#$#+..#$.", - " %&&&&+%#.$**$@+", - " @%&+&&&$##@@+", - " @.&&&&&@@@ ", - " @%&&@@ ", - " @+ ", - " "}; - """ - MenuText = "Arch" - ToolTip = "Architecture workbench" + "Arch workbench object" + Icon = """ + /* XPM */ + static char * arch_xpm[] = { + "16 16 9 1", + " c None", + ". c #543016", + "+ c #6D2F08", + "@ c #954109", + "# c #874C24", + "$ c #AE6331", + "% c #C86423", + "& c #FD7C26", + "* c #F5924F", + " ", + " ", + " # ", + " ***$# ", + " .*******. ", + " *##$****#+ ", + " #**%&&##$#@@ ", + ".$**%&&&&+@@+ ", + "@&@#$$%&&@@+.. ", + "@&&&%#.#$#+..#$.", + " %&&&&+%#.$**$@+", + " @%&+&&&$##@@+", + " @.&&&&&@@@ ", + " @%&&@@ ", + " @+ ", + " "}; + """ + MenuText = "Arch" + ToolTip = "Architecture workbench" - def Initialize(self): - import DraftTools,DraftGui,Arch_rc,Arch - archtools = ["Arch_Wall","Arch_Structure","Arch_Cell", - "Arch_Floor","Arch_Building","Arch_Site", - "Arch_Window","Arch_Axis", - "Arch_SectionPlane","Arch_Add","Arch_Remove"] - drafttools = ["Draft_Line","Draft_Wire","Draft_Rectangle", - "Draft_Polygon","Draft_Arc", - "Draft_Circle","Draft_Dimension", - "Draft_Move","Draft_Rotate", - "Draft_Offset","Draft_Upgrade", - "Draft_Downgrade","Draft_Trimex"] - meshtools = ["Arch_SplitMesh","Arch_MeshToShape", - "Arch_SelectNonSolidMeshes","Arch_RemoveShape"] - self.appendToolbar(str(DraftTools.translate("arch","Arch tools")),archtools) - self.appendToolbar(str(DraftTools.translate("arch","Draft tools")),drafttools) - self.appendMenu([str(DraftTools.translate("arch","Architecture")),str(DraftTools.translate("arch","Tools"))],meshtools) - self.appendMenu(str(DraftTools.translate("arch","Architecture")),archtools) - self.appendMenu(str(DraftTools.translate("arch","Draft")),drafttools) - FreeCADGui.addIconPath(":/icons") - FreeCADGui.addLanguagePath(":/translations") - FreeCADGui.addPreferencePage(":/ui/archprefs-base.ui","Arch") - FreeCAD.addImportType("Industry Foundation Classes (*.ifc)","importIFC") - FreeCAD.addExportType("Wavefront OBJ - Arch module (*.obj)","importOBJ") - try: - import collada - except: - Log("pycollada not found, no collada support\n") - else: - FreeCAD.addImportType("Collada (*.dae)","importDAE") - FreeCAD.addExportType("Collada (*.dae)","importDAE") - Log ('Loading Arch module... done\n') - def Activated(self): - FreeCADGui.draftToolBar.Activated() - Msg("Arch workbench activated\n") - def Deactivated(self): - FreeCADGui.draftToolBar.Deactivated() - Msg("Arch workbench deactivated\n") + def Initialize(self): + import DraftTools,DraftGui,Arch_rc,Arch + self.archtools = ["Arch_Wall","Arch_Structure","Arch_Cell", + "Arch_Floor","Arch_Building","Arch_Site", + "Arch_Window","Arch_Axis", + "Arch_SectionPlane","Arch_Add","Arch_Remove"] + self.drafttools = ["Draft_Line","Draft_Wire","Draft_Rectangle", + "Draft_Polygon","Draft_Arc", + "Draft_Circle","Draft_Dimension", + "Draft_Move","Draft_Rotate", + "Draft_Offset","Draft_Upgrade", + "Draft_Downgrade","Draft_Trimex"] + self.draftcontexttools = ["Draft_ApplyStyle","Draft_ToggleDisplayMode", + "Draft_AddToGroup","Draft_SelectGroup", + "Draft_SelectPlane"] + self.meshtools = ["Arch_SplitMesh","Arch_MeshToShape", + "Arch_SelectNonSolidMeshes","Arch_RemoveShape"] + self.appendToolbar(str(DraftTools.translate("arch","Arch tools")),self.archtools) + self.appendToolbar(str(DraftTools.translate("arch","Draft tools")),self.drafttools) + self.appendMenu([str(DraftTools.translate("arch","Architecture")),str(DraftTools.translate("arch","Tools"))],self.meshtools) + self.appendMenu(str(DraftTools.translate("arch","Architecture")),self.archtools) + self.appendMenu(str(DraftTools.translate("arch","Draft")),self.drafttools+self.draftcontexttools) + FreeCADGui.addIconPath(":/icons") + FreeCADGui.addLanguagePath(":/translations") + FreeCADGui.addPreferencePage(":/ui/archprefs-base.ui","Arch") + FreeCAD.addImportType("Industry Foundation Classes (*.ifc)","importIFC") + FreeCAD.addExportType("Wavefront OBJ - Arch module (*.obj)","importOBJ") + FreeCAD.addImportType("Collada (*.dae)","importDAE") + FreeCAD.addExportType("Collada (*.dae)","importDAE") + Log ('Loading Arch module... done\n') + + def Activated(self): + FreeCADGui.draftToolBar.Activated() + Msg("Arch workbench activated\n") + + def Deactivated(self): + FreeCADGui.draftToolBar.Deactivated() + Msg("Arch workbench deactivated\n") + + def ContextMenu(self, recipient): + self.appendContextMenu("Display tools",self.draftcontexttools) + + def GetClassName(self): + return "Gui::PythonWorkbench" FreeCADGui.addWorkbench(ArchWorkbench) diff --git a/src/Mod/Arch/ifcReader.py b/src/Mod/Arch/ifcReader.py old mode 100755 new mode 100644 diff --git a/src/Mod/Arch/importDAE.py b/src/Mod/Arch/importDAE.py index f0c73b882..11aa527e1 100644 --- a/src/Mod/Arch/importDAE.py +++ b/src/Mod/Arch/importDAE.py @@ -21,7 +21,7 @@ #* * #*************************************************************************** -import FreeCAD, collada, Mesh, os, numpy +import FreeCAD, Mesh, os, numpy __title__="FreeCAD Collada importer" __author__ = "Yorik van Havre" @@ -29,8 +29,19 @@ __url__ = "http://free-cad.sourceforge.net" DEBUG = True +def checkCollada(): + "checks if collada if available" + try: + import collada + except: + FreeCAD.Console.PrintError("pycollada not found, no collada support.\n") + return False + else: + return True + def open(filename): "called when freecad wants to open a file" + if not checkCollada(): return docname = os.path.splitext(os.path.basename(filename))[0] doc = FreeCAD.newDocument(docname) doc.Label = decode(docname) @@ -76,6 +87,7 @@ def read(filename): def export(exportList,filename): "called when freecad exports a file" + if not checkCollada(): return colmesh = collada.Collada() effect = collada.material.Effect("effect0", [], "phong", diffuse=(.7,.7,.7), specular=(1,1,1)) mat = collada.material.Material("material0", "mymaterial", effect) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 454be1f39..0640bb7fa 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -796,11 +796,16 @@ def scale(objectslist,delta=Vector(1,1,1),center=Vector(0,0,0),copy=False,legacy return newobjlist else: obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Scale") - _Scale(obj) + _Clone(obj) _ViewProviderDraft(obj.ViewObject) obj.Objects = objectslist obj.Scale = delta - obj.BasePoint = center + corr = Vector(center.x,center.y,center.z) + corr.scale(delta.x,delta.y,delta.z) + corr = fcvec.neg(corr.sub(center)) + p = obj.Placement + p.move(corr) + obj.Placement = p if not copy: for o in objectslist: o.ViewObject.hide() @@ -2422,25 +2427,23 @@ class _ViewProviderPoint: def getIcon(self): return ":/icons/Draft_Dot.svg" -class _Scale: - "The Scale object" +class _Clone: + "The Clone object" def __init__(self,obj): obj.addProperty("App::PropertyLinkList","Objects","Base", "The objects included in this scale object") obj.addProperty("App::PropertyVector","Scale","Base", "The scale vector of this object") - obj.addProperty("App::PropertyVector","BasePoint","Base", - "The base point of this scale object") obj.Scale = Vector(1,1,1) obj.Proxy = self - self.Type = "Scale" + self.Type = "Clone" def execute(self,obj): self.createGeometry(obj) def onChanged(self,obj,prop): - if prop in ["Scale","BasePoint","Objects"]: + if prop in ["Scale","Objects"]: self.createGeometry(obj) def createGeometry(self,obj): @@ -2449,15 +2452,11 @@ class _Scale: pl = obj.Placement shapes = [] for o in obj.Objects: - if hasattr(o,"Shape"): + if o.isDerivedFrom("Part::Feature"): sh = o.Shape.copy() m = FreeCAD.Matrix() m.scale(obj.Scale) sh = sh.transformGeometry(m) - corr = Vector(obj.BasePoint) - corr.scale(obj.Scale.x,obj.Scale.y,obj.Scale.z) - corr = fcvec.neg(corr.sub(obj.BasePoint)) - sh.translate(corr) shapes.append(sh) if shapes: obj.Shape = Part.makeCompound(shapes) diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py old mode 100755 new mode 100644 diff --git a/src/Mod/Draft/InitGui.py b/src/Mod/Draft/InitGui.py index b096c4a50..506904c2a 100644 --- a/src/Mod/Draft/InitGui.py +++ b/src/Mod/Draft/InitGui.py @@ -178,10 +178,10 @@ class DraftWorkbench (Workbench): FreeCADGui.addPreferencePage(":/ui/userprefs-import.ui","Draft") else: return - Log ('Loading Draft GUI...\n') try: import macros,DraftTools,DraftGui self.appendMenu(["&Macro",str(DraftTools.translate("draft","Installed Macros"))],macros.macrosList) + Log ('Loading Draft GUI...done\n') except: pass self.cmdList = ["Draft_Line","Draft_Wire","Draft_Circle","Draft_Arc", @@ -191,7 +191,7 @@ class DraftWorkbench (Workbench): "Draft_Trimex", "Draft_Upgrade", "Draft_Downgrade", "Draft_Scale", "Draft_Drawing","Draft_Edit","Draft_WireToBSpline","Draft_AddPoint", "Draft_DelPoint","Draft_Shape2DView","Draft_Draft2Sketch","Draft_Array"] - self.treecmdList = ["Draft_ApplyStyle","Draft_ToggleDisplayMode","Draft_AddToGroup","Draft_SelectGroup"] + self.treecmdList = ["Draft_ApplyStyle","Draft_ToggleDisplayMode","Draft_AddToGroup","Draft_SelectGroup","Draft_SelectPlane"] self.lineList = ["Draft_UndoLine","Draft_FinishLine","Draft_CloseLine"] self.appendToolbar(str(DraftTools.translate("draft","Draft creation tools")),self.cmdList) self.appendToolbar(str(DraftTools.translate("draft","Draft modification tools")),self.modList) @@ -208,17 +208,17 @@ class DraftWorkbench (Workbench): def ContextMenu(self, recipient): if (recipient == "View"): if (FreeCAD.activeDraftCommand == None): - if (FreeCADGui.Selection.getSelection() != []): - self.appendContextMenu(str(DraftTools.translate("draft","Draft")),self.cmdList+self.modList) - self.appendContextMenu(str(DraftTools.translate("draft","Display options")),self.treecmdList) + if (FreeCADGui.Selection.getSelection()): + self.appendContextMenu("Draft",self.cmdList+self.modList) + self.appendContextMenu("Display options",self.treecmdList) else: - self.appendContextMenu(str(DraftTools.translate("draft","Draft")),self.cmdList) + self.appendContextMenu("Draft",self.cmdList) else: if (FreeCAD.activeDraftCommand.featureName == "Line"): self.appendContextMenu("",self.lineList) else: - if (FreeCADGui.Selection.getSelection() != []): - self.appendContextMenu(str(DraftTools.translate("draft","Display options")),self.treecmdList) + if (FreeCADGui.Selection.getSelection()): + self.appendContextMenu("Display options",self.treecmdList) def GetClassName(self): return "Gui::PythonWorkbench" diff --git a/src/Mod/Draft/importAirfoilDAT.py b/src/Mod/Draft/importAirfoilDAT.py old mode 100755 new mode 100644 diff --git a/src/Mod/Draft/macros.py b/src/Mod/Draft/macros.py old mode 100755 new mode 100644 From 24ff289b65448ef650e353c439250b6810bad46a Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 4 Jan 2012 18:02:00 -0200 Subject: [PATCH 03/12] misc updates to the Draft module + added an Axis property to Array objects, for polar arrays + added Draft.clone() API function + changed icon of Draft clone,array and block objects --- src/Mod/Draft/Draft.py | 51 +++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 0640bb7fa..eadc25d54 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -200,7 +200,6 @@ def shapify(obj): non-parametric and returns the new object''' if not (obj.isDerivedFrom("Part::Feature")): return None if not "Shape" in obj.PropertiesList: return None - if obj.Type == "Part::Feature": return obj shape = obj.Shape name = getRealName(obj.Name) FreeCAD.ActiveDocument.removeObject(obj.Name) @@ -515,7 +514,7 @@ def makeCopy(obj): _ViewProviderBSpline(newobj.ViewObject) elif getType(obj) == "Block": _Block(newobj) - _ViewProviderBlock(newobj.ViewObject) + _ViewProviderDraftPart(newobj.ViewObject) elif getType(obj) == "Structure": import Structure Structure._Structure(newobj) @@ -539,7 +538,7 @@ def makeBlock(objectslist): '''makeBlock(objectslist): Creates a Draft Block from the given objects''' obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Block") _Block(obj) - _ViewProviderBlock(obj.ViewObject) + _ViewProviderDraftPart(obj.ViewObject) obj.Components = objectslist for o in objectslist: o.ViewObject.Visibility = False @@ -557,7 +556,7 @@ def makeArray(baseobject,arg1,arg2,arg3,arg4=None): The result is a parametric Draft Array.''' obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Array") _Array(obj) - _ViewProviderDraft(obj.ViewObject) + _ViewProviderDraftPart(obj.ViewObject) obj.Base = baseobject if arg4: obj.ArrayType = "ortho" @@ -797,7 +796,7 @@ def scale(objectslist,delta=Vector(1,1,1),center=Vector(0,0,0),copy=False,legacy else: obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Scale") _Clone(obj) - _ViewProviderDraft(obj.ViewObject) + _ViewProviderDraftPart(obj.ViewObject) obj.Objects = objectslist obj.Scale = delta corr = Vector(center.x,center.y,center.z) @@ -1323,6 +1322,21 @@ def makePoint(X=0, Y=0, Z=0,color=(0,1,0),name = "Point", point_size= 5): obj.ViewObject.Visibility = True FreeCAD.ActiveDocument.recompute() return obj + +def clone(obj,delta=None): + '''clone(obj,[delta]): makes a clone of the given object(s). The clone is an exact, + linked copy of the given object. If the original object changes, the final object + changes too. Optionally, you can give a delta Vector to move the clone from the + original position.''' + if not isinstance(obj,list): + obj = [obj] + cl = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Clone") + _Clone(cl) + _ViewProviderDraftPart(cl.ViewObject) + cl.Objects = obj + if delta: + cl.Placement.move(delta) + return cl #--------------------------------------------------------------------------- # Python Features definitions @@ -1376,6 +1390,8 @@ class _ViewProviderDraft: objs.append(self.Object.Base) if hasattr(self.Object,"Objects"): objs.extend(self.Object.Objects) + if hasattr(self.Object,"Components"): + objs.extend(self.Object.Components) return objs class _Dimension: @@ -2268,14 +2284,6 @@ class _Block: fp.Shape = shape fp.Placement = plm -class _ViewProviderBlock(_ViewProviderDraft): - "A View Provider for the Block object" - def __init__(self,obj): - _ViewProviderDraft.__init__(self,obj) - - def claimChildren(self): - return self.Object.Components - class _Shape2DView: "The Shape2DView object" @@ -2315,6 +2323,8 @@ class _Array: "The base object that must be duplicated") obj.addProperty("App::PropertyEnumeration","ArrayType","Base", "The type of array to create") + obj.addProperty("App::PropertyVector","Axis","Base", + "The axis direction for polar arrays") obj.addProperty("App::PropertyInteger","NumberX","Base", "Number of copies in X direction (ortho arrays)") obj.addProperty("App::PropertyInteger","NumberY","Base", @@ -2338,6 +2348,7 @@ class _Array: obj.IntervalX = Vector(1,0,0) obj.IntervalY = Vector(0,1,0) obj.Angle = 360 + obj.Axis = Vector(0,0,1) def execute(self,obj): self.createGeometry(obj) @@ -2353,7 +2364,7 @@ class _Array: if obj.ArrayType == "ortho": sh = self.rectArray(obj.Base.Shape,obj.IntervalX,obj.IntervalY,obj.NumberX,obj.NumberY) else: - sh = self.polarArray(obj.Base.Shape,obj.Center,obj.Angle,obj.NumberPolar) + sh = self.polarArray(obj.Base.Shape,obj.Center,obj.Angle,obj.NumberPolar,obj.Axis) obj.Shape = sh if not fcgeo.isNull(pl): obj.Placement = pl @@ -2376,14 +2387,14 @@ class _Array: base.append(nshape) return Part.makeCompound(base) - def polarArray(self,shape,center,angle,num): + def polarArray(self,shape,center,angle,num,axis): import Part fraction = angle/num base = [shape.copy()] for i in range(num): currangle = fraction + (i*fraction) nshape = shape.copy() - nshape.rotate(fcvec.tup(center), (0,0,1), currangle) + nshape.rotate(fcvec.tup(center), fcvec.tup(axis), currangle) base.append(nshape) return Part.makeCompound(base) @@ -2463,4 +2474,12 @@ class _Clone: if not fcgeo.isNull(pl): obj.Placement = pl +class _ViewProviderDraftPart(_ViewProviderDraft): + "a view provider that displays a Part icon instead of a Draft icon" + + def __init__(self,vobj): + _ViewProviderDraft.__init__(self,vobj) + + def getIcon(self): + return ":/icons/Tree_Part.svg" From b84a59f97777cec9b2f281c7b1b6f55a308ea05b Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 4 Jan 2012 18:41:13 -0200 Subject: [PATCH 04/12] fixed bug 562 - Draft module - problem in SVG import --- src/Mod/Draft/importSVG.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 6a47fea1f..74ffdcb43 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -561,8 +561,8 @@ class svgHandler(xml.sax.ContentHandler): pole2 = lastvec.add(Vector(point[2],-point[3],0)) else: currentvec = Vector(point[4],-point[5],0) - pole1 = Vector(point[0],point[1],0) - pole2 = Vector(point[2],point[3],0) + pole1 = Vector(point[0],-point[1],0) + pole2 = Vector(point[2],-point[3],0) if not fcvec.equals(currentvec,lastvec): mainv = currentvec.sub(lastvec) pole1v = lastvec.add(pole1) From e2f53df8354645a884c34fbddfd6329d380f8a13 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 5 Jan 2012 10:12:25 -0200 Subject: [PATCH 05/12] small bugfix in Draft SVG import --- src/Mod/Draft/importSVG.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 74ffdcb43..429d6fdf3 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -242,6 +242,7 @@ class svgHandler(xml.sax.ContentHandler): self.grouptransform = [] self.lastdim = None + global Part import Part if gui and draftui: From cb4e6b7d30b1b1c24552bcc35a90fdbc6a62a561 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 5 Jan 2012 10:22:06 -0200 Subject: [PATCH 06/12] used precision value from preferences in Draft SVG import --- src/Mod/Draft/importSVG.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 429d6fdf3..0590d7701 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -569,8 +569,8 @@ class svgHandler(xml.sax.ContentHandler): pole1v = lastvec.add(pole1) pole2v = currentvec.add(pole2) print "curve data:",mainv.normalize(),pole1v.normalize(),pole2v.normalize() - if (round(mainv.getAngle(pole1v),4) in [0,round(math.pi,4)]) \ - and (round(mainv.getAngle(pole2v),4) in [0,round(math.pi,4)]): + if (round(mainv.getAngle(pole1v),Draft.precision()) in [0,round(math.pi,Draft.precision())]) \ + and (round(mainv.getAngle(pole2v),Draft.precision()) in [0,round(math.pi,Draft.precision())]): print "straight segment" seg = Part.Line(lastvec,currentvec).toShape() else: From 3afbab3c477e2c854cb3f5f20057722cbaa07a03 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 5 Jan 2012 18:33:33 -0200 Subject: [PATCH 07/12] small fix to the Draft module --- src/Mod/Draft/Draft.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index eadc25d54..85fafb554 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -273,13 +273,14 @@ def getSelection(): "getSelection(): returns the current FreeCAD selection" return FreeCADGui.Selection.getSelection() -def select(objs): +def select(objs=None): "select(object): deselects everything and selects only the passed object or list" FreeCADGui.Selection.clearSelection() - if not isinstance(objs,list): - objs = [objs] - for obj in objs: - FreeCADGui.Selection.addSelection(obj) + if objs: + if not isinstance(objs,list): + objs = [objs] + for obj in objs: + FreeCADGui.Selection.addSelection(obj) def makeCircle(radius, placement=None, face=True, startangle=None, endangle=None, support=None): '''makeCircle(radius,[placement,face,startangle,endangle]): Creates a circle @@ -2354,9 +2355,9 @@ class _Array: self.createGeometry(obj) def onChanged(self,obj,prop): - if prop in ["ArrayType","NumberX","NumberY","NumberPolar","IntervalX","IntervalY","Angle","Center"]: + if prop in ["ArrayType","NumberX","NumberY","NumberPolar","IntervalX","IntervalY","Angle","Center","Axis"]: self.createGeometry(obj) - + def createGeometry(self,obj): from draftlibs import fcgeo if obj.Base: From 4b51d8daa8c1fe4ced10f3f1a1304c502e9f5041 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 5 Jan 2012 19:50:25 -0200 Subject: [PATCH 08/12] started integrating ifcopenshell in Arch IFC reader --- src/Mod/Arch/Arch_rc.py | 261 ++++++++++---------- src/Mod/Arch/Resources/ui/archprefs-base.ui | 34 +++ src/Mod/Arch/importIFC.py | 23 +- 3 files changed, 188 insertions(+), 130 deletions(-) diff --git a/src/Mod/Arch/Arch_rc.py b/src/Mod/Arch/Arch_rc.py index 9dc96a3c1..2ad9bacd7 100644 --- a/src/Mod/Arch/Arch_rc.py +++ b/src/Mod/Arch/Arch_rc.py @@ -2,7 +2,7 @@ # Resource object code # -# Created: Tue Jan 3 20:45:25 2012 +# Created: Thu Jan 5 19:10:05 2012 # by: The Resource Compiler for PyQt (Qt v4.7.3) # # WARNING! All changes made in this file will be lost! @@ -5697,111 +5697,114 @@ qt_resource_data = "\ \x00\x00\x00\x12\x00\x57\x00\x65\x00\x72\x00\x6b\x00\x7a\x00\x65\ \x00\x75\x00\x67\x00\x65\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05\ \x54\x6f\x6f\x6c\x73\x07\x00\x00\x00\x04\x61\x72\x63\x68\x01\ -\x00\x00\x06\x65\ +\x00\x00\x06\x9c\ \x00\ -\x00\x22\x4d\x78\x9c\xed\x5a\x6d\x6f\xdb\x36\x10\xfe\x9e\x5f\xc1\ -\x79\x40\xbb\x01\xb1\x69\xe7\xad\x89\x22\xbb\x68\x9d\xa4\x29\x90\ -\x6e\x69\xe3\xb6\xd8\xa7\x40\x96\x68\x8b\x1d\x25\x2a\x24\x55\xd9\ -\x1d\xf6\xdf\x77\xa4\x28\x5b\xb2\x1c\x27\x8d\xbd\xb6\x1b\x52\xa4\ -\x88\xc8\xa3\xee\x1e\x3e\x77\xbc\x3b\x49\x71\x9f\x4f\x22\x86\x3e\ -\x13\x21\x29\x8f\xbb\x8d\x4e\xab\xdd\x40\x24\xf6\x79\x40\xe3\x71\ -\xb7\xf1\x7e\x70\xd6\x3c\x6c\x3c\xef\x6d\xb9\x29\x9d\x2f\xda\x83\ -\x45\xbd\x2d\xe4\xfa\xcc\x93\xb2\xf7\x2a\xa5\x8e\x73\x42\x3d\xc6\ -\xc7\xf0\x9b\x8d\xaf\x88\x52\x70\xb3\x7c\x21\xfc\xd0\xc5\xf9\x1a\ -\x58\x9c\xd1\x60\x4c\x14\x32\xe3\x6e\xe3\xed\x47\x33\x6c\xa0\xd8\ -\x8b\x48\xb7\xb1\x4a\x87\x36\x85\xdc\x44\xf0\x84\x08\x35\xb5\x37\ -\x8c\x09\x8f\x88\x12\x53\x23\x44\xae\x20\xbe\x32\x57\xc8\x9d\xf4\ -\xda\x2e\x9e\xd8\xc1\x54\x0f\xa6\x76\x00\x08\x54\xd8\xdb\x7f\xb6\ -\xef\xe2\xfc\x32\x9f\x0e\x09\x1d\x87\xaa\x77\xb0\x73\xe4\x62\x7b\ -\x6d\x74\xe2\x42\xa9\x8b\x0b\xe3\xcb\x90\x64\x34\x0e\x78\x36\xa0\ -\x8a\x11\x0b\x46\x2a\x01\xd8\x7b\xaf\x48\x4c\x84\xc7\x90\xb4\x7b\ -\x71\xb1\x15\xd4\x55\x32\x6f\xca\xd3\x39\x37\x1f\x5e\xf2\xc9\x85\ -\x99\xb2\x1a\x17\x4c\xca\xc4\xf3\x41\x51\xc3\x6e\x20\x4e\xa3\x21\ -\x11\xbd\x03\x17\xdb\xab\x1c\x7e\xd9\x42\x4d\x45\xe4\x89\x31\x8d\ -\x17\x34\x1c\xad\xd4\x40\x15\x89\xe6\x4c\x96\x7d\xf9\x4a\xf0\x34\ -\x01\xcc\x85\x37\xc7\xc5\x38\x5f\x5e\x33\xae\xe6\x64\x2d\xe1\x4b\ -\xfb\x1c\x5d\x2d\x21\xad\x8e\x69\x25\x75\xd6\x18\x44\xad\xa2\xbe\ -\xc7\xf2\xd9\xeb\x9d\xb9\xdd\xf9\x86\x96\x28\x3a\xaf\x29\x0a\xb9\ -\xa0\x5f\x78\xac\x96\xa8\x5a\x54\x56\xa7\xe8\xc2\x1b\x12\x56\x68\ -\x62\x7a\x50\xb9\x7d\x09\x47\x64\xa2\x2a\x0b\x66\x3c\x9d\x90\x91\ -\x97\x32\x50\xcd\x19\x17\x68\x04\xff\x33\x8f\xb1\x45\xa6\x96\xd3\ -\x95\x4f\xe6\xd8\x4a\xe0\x71\x15\x7d\x6d\x33\x3a\xe0\x88\xa8\xf1\ -\x70\x65\xa6\x57\x6e\x03\xd6\x12\x58\xaa\x20\x6f\x2c\xec\x86\x40\ -\xa8\xf5\xde\x2a\xc7\x39\x9f\xe9\x73\xb1\x99\xbc\x6b\x03\xf5\xf3\ -\x40\xbf\x90\x73\x1a\x83\xa7\xa4\x0a\xe0\xb8\x75\x1b\xed\x45\xea\ -\x60\x45\x65\xa6\xc8\x06\x7b\xed\x4a\x32\x98\x49\x6d\x22\xd8\x69\ -\x57\x72\xc2\x1c\xd6\xa2\xc2\x5b\x98\xce\x89\xfb\x0a\xa6\xab\x61\ -\x63\xd2\xe2\xa5\x20\xa3\xbe\xf6\xf5\xcb\x54\x29\xa0\xb1\x38\x64\ -\x5a\x96\x80\xcc\xc4\xc1\x30\x97\xad\x8c\x28\xce\xd9\x80\x26\xcb\ -\x83\x6a\x10\x52\x89\xe0\x47\x85\x04\x05\xb5\x00\x8b\x49\x86\x3e\ -\x42\x90\x21\x3e\xfc\x04\x49\xf1\xfe\xb1\x56\x03\x61\x74\x2e\x40\ -\x30\x73\x0b\xfc\x0b\x12\xf4\x76\xf6\xf7\x75\x12\x0e\x16\x44\x63\ -\x41\x48\xdc\xeb\x1c\x81\x6b\xf2\xcb\xaa\x78\xc8\x52\xd2\xeb\x3c\ -\x03\xa9\xb9\xaa\xba\xad\x66\xea\x7e\xa8\x35\xcd\xa7\xb1\x2e\x37\ -\xb7\x46\x98\x6f\x19\xd1\x34\x19\x6f\x81\xb1\x87\x92\xa4\xcd\x5d\ -\x7a\x2a\xbc\xdb\xda\x1b\x1e\x60\x5b\x67\x37\x75\xfa\x5d\x9c\x67\ -\xc2\x59\x9a\xac\x88\xd7\x4d\x9a\x6b\xa5\xcc\x8d\x25\x4c\x10\xa4\ -\xbe\x4a\x05\xf9\x7e\x59\xf3\x8e\xf4\xff\x98\x37\xbf\x65\xde\xbc\ -\xab\x16\xaf\x97\x39\xaf\x8a\x68\xfb\xb6\xe9\xb3\xb3\xdf\x5e\x91\ -\x3e\x0f\x8e\x56\xa5\xcf\xc3\x83\xef\x94\x3e\x67\x5c\xfd\x7f\x73\ -\x68\x55\x58\xd1\x55\x5a\xf7\x80\x76\x7b\x1e\xc5\xf7\x6b\xb8\x5f\ -\x9f\xf5\x11\x8d\x12\x2e\xd4\xa6\xbb\xec\xcd\xf5\xd8\xbb\xeb\xf5\ -\xd8\xbb\x0f\x2c\x19\x4f\x98\x3a\xfe\xe9\xe4\xf7\xfe\xe0\x8f\xcb\ -\x53\x74\x3e\x78\x73\x81\x2e\xdf\xbf\xbc\x78\xdd\x47\x4f\x6e\x52\ -\xae\x8e\x9b\x18\x7f\xdc\xed\x63\x7c\x32\x38\xc9\xa5\xf0\x44\x8c\ -\xf1\xe9\x6f\xb9\xd4\x2e\x0a\x95\x4a\x1c\x8c\xb3\x2c\x6b\x65\xbb\ -\x2d\x2e\xc6\x78\xf0\x0e\xbf\x3b\xed\x37\x43\x15\xb1\xbd\xb6\xa1\ -\xdc\x57\xad\x40\x05\xf9\xfa\x27\x63\x75\xbc\xa5\x0d\x6b\xb9\x1e\ -\x98\x6b\xe2\x05\xc5\x35\x3c\xf0\x7a\x39\xf2\xfc\x86\x1b\xb8\x3f\ -\xd4\x7b\xb0\x66\x7d\x20\x0e\x8a\x86\x95\x76\xec\x2c\x2e\x6e\x97\ -\x6a\xca\x08\x52\xd3\xa4\xb8\x5f\xdf\x0a\x31\x2f\x4b\xe6\x93\x6d\ -\xc4\x28\xfa\x0b\x65\x21\x70\xdd\x34\x59\xd8\x41\x70\x94\x9a\x99\ -\xf0\x92\x63\xf4\xb7\xc1\x87\x8d\xa6\x42\x2d\x2e\x43\x1c\xf2\x60\ -\x8a\x8c\xd8\xda\x80\x24\x18\xab\xe6\xc8\x8b\x28\x9b\x3a\x4f\x4f\ -\xc8\x27\xef\x43\x8a\xae\xbc\x58\x3e\xb5\x22\x5d\x10\x9c\xc3\xa4\ -\x58\x99\x99\xa2\xe1\xec\xb5\xdb\x85\x5c\x2b\x73\x62\x2e\x22\x8f\ -\x1d\x2f\x10\x95\x54\x4d\xe5\xcf\xb4\x4d\xc5\x13\xa7\x9d\x4c\x66\ -\xe3\x21\x87\x14\x1f\x55\xa6\x18\x19\xa9\xca\x84\x30\x56\xcd\x4c\ -\xf3\x46\x35\x87\x8c\xfb\x7f\x36\xe1\xc1\x1e\xe8\x74\x00\x89\x66\ -\x6a\x36\x84\x45\x73\x1c\x67\x90\xe3\x75\xe6\xd7\x67\x49\x00\x11\ -\x50\xef\x15\x47\xa3\x34\xf6\x75\xe9\xde\x46\x10\xc4\x50\x03\x48\ -\x80\xbc\xd8\xac\xb9\xf2\x43\x12\x79\xe8\x74\x02\xa4\x4a\x89\x46\ -\x14\x5c\xf2\x4b\x8b\x4c\x92\x5f\x91\xf7\xd9\xa3\x10\xb5\x30\x11\ -\x12\x41\x1c\xc3\x6d\xf2\x23\xed\x55\xc3\xf0\x50\x08\x89\xb5\x5b\ -\x8b\x70\xa9\x48\xa2\xcb\xa4\x6c\xf9\x3c\xc2\x32\x4d\x74\x5a\x81\ -\x40\x09\xc8\xe7\xeb\x80\xfb\x12\x93\x7c\xc7\x98\x8e\xfc\x9d\xc9\ -\xae\xfd\x75\xad\xfc\x8e\xde\x7c\xd5\x06\x84\x5d\x5c\xdd\xad\xc1\ -\x14\x10\x9f\x0b\xd3\x11\x39\x28\x05\x7c\x82\xd1\x98\x1c\xe7\xb5\ -\xd6\xf9\x79\xbf\x7d\x48\x82\xc3\x12\xda\xcd\x81\x33\x21\x0f\x98\ -\x66\x11\xef\xcd\xae\x92\xd9\x95\x8e\xfc\xf9\x91\xb0\x27\x78\x73\ -\xdd\xe5\xbf\xdb\x95\x5f\xef\xad\x97\x66\xf7\x1e\x98\x66\x4b\x27\ -\xc2\x9c\x04\x08\x45\xe3\xe0\xef\xd7\x95\xaf\x2e\x18\x8f\x5d\xf9\ -\x46\xba\xf2\x33\xf0\x75\x3f\xe4\x5c\x12\x51\xeb\xca\x75\x1c\xf8\ -\x56\xf6\xe0\x9e\xfc\xb1\x7c\x3f\x96\xef\x6f\x5d\xbe\x97\xfc\xfb\ -\xf1\x4a\xf8\xbc\xc7\xf8\x8f\x15\x73\xe8\x88\x5a\xe8\x96\x4a\xac\ -\x9d\xc8\xa8\x4f\x62\x09\x67\x5f\xbb\x51\xf2\x58\xa2\x8c\x20\x0f\ -\x1e\xb9\x63\xae\x90\xc7\x18\xcf\xc0\x89\xe0\x5a\x19\xd2\x04\x3c\ -\xee\xa9\xdc\x77\x3f\x9e\x87\x32\xaa\x42\x74\x06\x0f\xe6\xfd\x17\ -\x27\xdb\x48\x72\x13\x82\x51\x2a\x15\x0a\x78\x16\x33\xee\x05\x88\ -\x2a\x3d\x29\x24\x61\xa3\x16\xba\x64\x70\xc8\x4b\x3b\xa2\xc0\x36\ -\x8f\xc8\x8f\xb7\xb1\xa2\xb6\x23\xf8\xd1\xf0\xc1\xd7\x51\x92\x2a\ -\x22\xb6\xe1\x70\x05\x08\x76\x43\x7c\x65\x0e\xa3\xd9\x87\xf1\xf8\ -\x46\x7b\xac\x75\x5e\x4b\xbc\x1e\xf9\xf9\xd1\x7f\x7c\x23\x91\xd7\ -\xd9\x72\x13\x55\x3c\xfb\x57\x3f\x07\xdd\xa7\x77\x9a\xb7\x4d\x1f\ -\xac\x8e\x4a\xd3\x54\x7f\x0f\xf1\x15\xad\x52\xb5\x4b\xb2\x0d\xd2\ -\x4e\xad\x41\x2a\x7a\xa3\xbd\x5a\x6f\x54\x69\x8b\x16\xa1\x54\x9a\ -\xa1\x39\x49\x25\x26\x4b\x34\xda\x86\xbc\x78\x3b\x68\x3f\xdf\x76\ -\x1b\x07\x0d\x7b\xaa\xba\x8d\x4e\xa7\x81\xf5\xca\x84\x4e\x22\x2f\ -\x29\x0a\x50\xef\xe6\xd2\x8c\xcf\x04\x8f\xde\xd0\x88\x5c\xc1\xb9\ -\xf1\x09\x60\xa9\xae\xd2\x9f\xe2\x21\x43\xf0\x28\xb7\x28\x0d\x92\ -\xf2\x4c\x8e\xb2\xf4\xb9\xbe\xd4\x81\xcd\x3f\xd1\x6b\x7f\x4c\xa0\ -\x05\x09\x64\xcf\x7e\x9e\x07\x6f\xd8\x89\xad\x9c\x2a\x5d\x21\xb5\ -\x06\xac\x15\xe4\xdf\xeb\x5b\xa1\x8b\xad\xc0\x10\xb0\x68\x77\x35\ -\x90\xd2\x0b\xda\xe5\x40\x2e\x53\x19\x16\xf2\xdb\xc0\xe4\x60\xe5\ -\x7a\x48\x16\x1a\xd3\xa5\x68\xea\xdc\xdd\x06\x49\x6b\xdb\x18\xac\ -\xbb\x48\xaa\x33\xb9\x3e\xac\xea\x84\xf9\x0b\x0e\x28\xf9\x26\xfe\ -\xa4\x89\x54\x68\x57\x63\x62\xe2\x4f\x8f\x5d\x9c\xd2\xde\xd6\x3f\ -\x48\xb4\x84\x40\ +\x00\x26\x4b\x78\x9c\xed\x5a\x51\x53\xdb\x38\x10\x7e\xe7\x57\xe8\ +\x72\x33\xed\xdd\x0c\x89\x12\x20\x14\x82\x93\x4e\x1b\xa0\x74\x86\ +\x5e\x69\x93\xb6\x73\x4f\x8c\x63\x2b\xb1\x7a\xb2\x65\x24\xb9\x4e\ +\x7a\x73\xff\xfd\x56\xb2\x9c\xc4\x71\x08\x85\xe4\x80\xeb\xd0\xa1\ +\x83\xa5\x95\x77\x57\xdf\x7e\xda\x5d\x1b\x3b\x2f\xc7\x21\x43\xdf\ +\x88\x90\x94\x47\xed\x4a\xa3\x56\xaf\x20\x12\x79\xdc\xa7\xd1\xa8\ +\x5d\xf9\xd4\x3f\xad\x1e\x54\x5e\x76\xb6\x9c\x84\xce\x16\xed\xc1\ +\xa2\xce\x16\x72\x3c\xe6\x4a\xd9\x79\x93\xd0\x56\xeb\x98\xba\x8c\ +\x8f\xe0\x37\x1b\xf5\x88\x52\x70\xb3\x7c\x25\xbc\xc0\xc1\xd9\x1a\ +\x58\x9c\x52\x7f\x44\x14\x32\xe3\x76\xe5\xc3\x17\x33\xac\xa0\xc8\ +\x0d\x49\xbb\xb2\x4a\x87\x36\x85\x9c\x58\xf0\x98\x08\x35\xb1\x37\ +\x8c\x08\x0f\x89\x12\x13\x23\x44\x8e\x20\x9e\x32\x57\xc8\x19\x77\ +\xea\x0e\x1e\xdb\xc1\x44\x0f\x26\x76\x00\x1e\xa8\xa0\xd3\x7c\xd1\ +\x74\x70\x76\x99\x4d\x07\x84\x8e\x02\xd5\xd9\xdf\x39\x74\xb0\xbd\ +\x36\x3a\x71\xae\xd4\xc1\xb9\xf1\x65\x9e\xa4\x34\xf2\x79\xda\xa7\ +\x8a\x11\xeb\x8c\x54\x02\x7c\xef\xbc\x21\x11\x11\x2e\x43\xd2\xee\ +\xc5\xc1\x56\x50\x56\xc9\xdc\x09\x4f\x66\xd8\x7c\x7e\xcd\xc7\xe7\ +\x66\xca\x6a\x5c\x30\x29\x63\xd7\x03\x45\x15\xbb\x81\x28\x09\x07\ +\x44\x74\xf6\x1d\x6c\xaf\x32\xf7\xe7\x2d\x94\x54\x84\xae\x18\xd1\ +\x68\x41\xc3\xe1\x4a\x0d\x54\x91\x70\x86\xe4\x7c\x2c\xdf\x08\x9e\ +\xc4\xe0\x73\x1e\xcd\x51\x3e\xce\x96\x97\x8c\xab\x19\x58\x4b\xf0\ +\xd2\x31\x47\xbd\x25\xa0\x95\x7d\x5a\x09\x9d\x35\x06\xac\x55\xd4\ +\x73\x59\x36\x7b\xb9\x33\xb3\x3b\xdb\xd0\x12\x45\x67\x25\x45\x01\ +\x17\xf4\x3b\x8f\xd4\x12\x55\x8b\xca\xca\x10\x9d\xbb\x03\xc2\x72\ +\x4d\x4c\x0f\x0a\xb7\x2f\xc1\x88\x8c\x55\x61\xc1\x14\xa7\x63\x32\ +\x74\x13\x06\xaa\x39\xe3\x02\x0d\xe1\x7f\xea\x32\xb6\x88\xd4\x72\ +\xb8\xb2\xc9\xcc\xb7\x39\xe7\x71\xd1\xfb\xd2\x66\x34\xe1\x88\x28\ +\xe1\xd0\x33\xd3\x2b\xb7\x01\x6b\x09\x2c\x55\x90\x37\x16\x76\x43\ +\x80\x6a\x9d\x0f\xaa\xd5\x3a\x9b\xea\x73\xb0\x99\xbc\x69\x03\xe5\ +\xf3\x40\xbf\x93\x33\x1a\x41\xa4\xa4\xf2\xe1\xb8\xb5\x2b\xf5\x45\ +\xe8\x60\x45\x61\x26\xcf\x06\x7b\xf5\x42\x32\x98\x4a\x6d\x22\xd8\ +\xa9\x17\x72\xc2\xcc\xad\x45\x85\xd7\x20\x9d\x01\x77\x0b\xa4\x8b\ +\xb4\x31\x69\xf1\x42\x90\x61\x57\xc7\xfa\x75\xa2\x14\xc0\x98\x1f\ +\x32\x2d\x8b\x41\x66\x78\x30\xc8\x64\x2b\x19\xc5\x39\xeb\xd3\x78\ +\x39\xa9\xfa\x01\x95\x08\x7e\x54\x40\x90\x5f\x22\x58\x44\x52\xf4\ +\x05\x48\x86\xf8\xe0\x2b\x24\xc5\x1f\xe7\x5a\xc9\x09\xa3\x73\xc1\ +\x05\x33\xb7\x80\xbf\x20\x7e\x67\xa7\xd9\xd4\x49\xd8\x5f\x10\x8d\ +\x04\x21\x51\xa7\x71\x08\xa1\xc9\x2e\x8b\xe2\x01\x4b\x48\xa7\xf1\ +\x02\xa4\xe6\xaa\x18\xb6\x92\xa9\x1f\xf3\x5a\xc3\x7c\x12\xe9\x72\ +\x73\x2d\xc3\x3c\x8b\x88\x86\xc9\x44\x0b\x8c\xdd\x15\x24\x6d\xee\ +\xc2\x55\xc1\xcd\xd6\xde\x71\x1f\xdb\x3a\xbb\xa9\xd3\xef\xe0\x2c\ +\x13\x4e\xd3\x64\x41\xbc\x6e\xd2\x5c\x2b\x65\x6e\x2c\x61\x82\x20\ +\xf1\x54\x22\xc8\xc3\x65\xcd\x1b\xd2\xff\x53\xde\xbc\xcf\xbc\x79\ +\x53\x2d\x5e\x2f\x73\xf6\x72\xb6\xdd\x6f\xfa\x6c\x34\xeb\x2b\xd2\ +\xe7\xfe\xe1\xaa\xf4\x79\xb0\xff\x40\xe9\x73\x8a\xd5\xcf\x9b\x43\ +\x8b\xc2\x82\xae\xb9\x75\x77\x68\xb7\x67\x2c\xfe\xb1\x86\xfb\xed\ +\x69\x17\xd1\x30\xe6\x42\x6d\xba\xcb\xde\x5c\x8f\xbd\xbb\x5e\x8f\ +\xbd\x7b\xc7\x92\xf1\x8c\xa9\xa3\x5f\x8e\xdf\x77\xfb\x7f\x5e\x9c\ +\xa0\xb3\xfe\xbb\x73\x74\xf1\xe9\xf5\xf9\xdb\x2e\x7a\x76\x95\x70\ +\x75\x54\xc5\xf8\xcb\x6e\x17\xe3\xe3\xfe\x71\x26\x85\x27\x62\x8c\ +\x4f\xfe\xc8\xa4\x76\x51\xa0\x54\xdc\xc2\x38\x4d\xd3\x5a\xba\x5b\ +\xe3\x62\x84\xfb\x1f\xf1\xc7\x93\x6e\x35\x50\x21\xdb\xab\x1b\xc8\ +\x3d\x55\xf3\x95\x9f\xad\x7f\x36\x52\x47\x5b\xda\xb0\x96\xeb\x81\ +\xb9\x26\xae\x9f\x5f\xc3\x03\xaf\x9b\x79\x9e\xdd\x70\x05\xf7\x07\ +\x7a\x0f\xd6\xac\x07\xc0\x41\xd1\xb0\xd2\x86\x9d\xc5\xf9\xed\x52\ +\x4d\x18\x41\x6a\x12\xe7\xf7\xeb\x5b\x81\xf3\x72\xce\x7c\xbc\x8d\ +\x18\x45\x7f\xa3\x34\x00\xac\xab\x26\x0b\xb7\x10\x1c\xa5\x6a\x2a\ +\xdc\xf8\x08\xfd\x63\xfc\xc3\x46\x53\xae\x16\xcf\xbb\x38\xe0\xfe\ +\x04\x19\xb1\xb5\x01\x49\x30\x52\xd5\xa1\x1b\x52\x36\x69\x3d\x3f\ +\x26\x5f\xdd\xcf\x09\xea\xb9\x91\x7c\x6e\x45\xba\x20\xb4\x0e\xe2\ +\x7c\x65\x6a\x8a\x46\x6b\xaf\x5e\xcf\xe5\x5a\x59\x2b\xe2\x22\x74\ +\xd9\xd1\x02\x50\x71\xd1\x54\xf6\x4c\x5b\x55\x3c\x6e\xd5\xe3\xf1\ +\x74\x3c\xe0\x90\xe2\xc3\xc2\x14\x23\x43\x55\x98\x10\xc6\xaa\x99\ +\xa9\x5e\xa9\xea\x80\x71\xef\xaf\x2a\x3c\xd8\x03\x9c\x2d\xf0\x44\ +\x23\x35\x1d\xc2\xa2\x99\x1f\xa7\x90\xe3\x75\xe6\xd7\x67\x49\x00\ +\x10\x50\xef\x15\x47\xc3\x24\xf2\x74\xe9\xde\x46\x40\x62\xa8\x01\ +\xc4\x47\x6e\x64\xd6\xf4\xbc\x80\x84\x2e\x3a\x19\x03\xa8\x52\xa2\ +\x21\x85\x90\xfc\x56\x23\xe3\xf8\x77\xe4\x7e\x73\x29\xb0\x16\x26\ +\x02\x22\x48\xcb\x60\x1b\x3f\xa6\xbd\x6a\x37\x5c\x14\x40\x62\x6d\ +\x97\x18\x2e\x15\x89\x75\x99\x94\x35\x8f\x87\x58\x26\xb1\x4e\x2b\ +\x40\x14\x9f\x7c\xbb\xf4\xb9\x27\x31\xc9\x76\x8c\xe9\xd0\xdb\x19\ +\xef\xda\x5f\x97\xca\x6b\xe8\xcd\x17\x6d\x00\xed\xa2\xe2\x6e\x8d\ +\x4f\x3e\xf1\xb8\x30\x1d\x51\x0b\x25\xe0\x9f\x60\x34\x22\x47\x59\ +\xad\x6d\xfd\xda\xac\x1f\x10\xff\x60\xce\xdb\xcd\x39\x67\x28\x0f\ +\x3e\x4d\x19\xef\x4e\xaf\xe2\xe9\x95\x66\xfe\xec\x48\xd8\x13\xbc\ +\xb9\xee\xf2\xbf\xed\xca\x2f\xf7\xd6\x4b\xb3\x7b\x77\x4c\xb3\x73\ +\x27\xc2\x9c\x04\xa0\xa2\x09\xf0\xc3\x75\xe5\xab\x0b\xc6\x53\x57\ +\xbe\x91\xae\xfc\x14\x62\xdd\x0d\x38\x97\x44\x94\xba\x72\xcd\x03\ +\xcf\xca\xee\xdc\x93\x3f\x95\xef\xa7\xf2\x7d\xdf\xe5\x7b\xc9\xbf\ +\xc7\x57\xc2\x67\x3d\xc6\xff\xac\x98\x43\x47\x54\x43\xd7\x54\x62\ +\x1d\x44\x46\x3d\x12\x49\x38\xfb\x3a\x8c\x92\x47\x12\xa5\x04\xb9\ +\xf0\xc8\x1d\x71\x85\x5c\xc6\x78\x0a\x41\x84\xd0\xca\x80\xc6\x10\ +\x71\x57\x65\xb1\x7b\x7c\x11\x4a\xa9\x0a\xd0\x29\x3c\x98\x77\x5f\ +\x1d\x6f\x23\xc9\x0d\x05\xc3\x44\x2a\xe4\xf3\x34\x62\xdc\xf5\x11\ +\x55\x7a\x52\x48\xc2\x86\x35\x74\xc1\xe0\x90\xcf\xed\x88\x02\xda\ +\x3c\x24\x8f\x6f\x63\x79\x6d\x47\xf0\xa3\xdd\x87\x58\x87\x71\xa2\ +\x88\xd8\x86\xc3\xe5\x23\xd8\x0d\xf1\x94\x39\x8c\x66\x1f\x26\xe2\ +\x1b\xed\xb1\xd6\x79\x2d\xf1\x76\xe8\x65\x47\xff\xa7\x7c\x23\xb1\ +\x7e\xff\xd8\x5c\xaf\x7f\x6c\xde\xb1\x7f\xd4\x70\xea\x53\x0d\xe1\ +\x79\x1f\x93\xa8\x17\x10\xc6\x1e\xae\x77\x5c\xdd\x05\x3f\xf5\x8e\ +\xf7\xd9\x3b\xde\xf0\x46\xf7\x16\x47\x1f\x8a\x1b\xdc\x1a\xc9\x8c\ +\x5b\x3f\xe1\xe9\xbf\xfd\xfb\xc8\xc2\x31\xc8\xdf\xfc\x15\xff\x18\ +\xfc\x23\xec\x9f\x11\xff\xb3\xd5\x51\xa0\x7d\xf9\x2d\xe4\x2d\xc8\ +\x5e\xe4\xb9\xa5\xf8\x4e\x89\xe2\x39\xbb\xf7\x4a\xec\x2e\x10\x7b\ +\xd1\x95\x02\x9d\x67\x20\xcd\x21\x39\x07\xa3\x4d\xa7\xf9\xdf\x06\ +\xec\xc7\x1b\xed\xca\x7e\xc5\xd6\xd4\x76\xa5\xd1\xa8\x60\xbd\x32\ +\xa6\xe3\xd0\x8d\xf3\xf6\xb3\x73\x75\x61\xc6\xa7\x82\x87\xef\x68\ +\x48\x7a\x50\x35\x3d\x02\xbe\x14\x57\xe9\x0f\x71\xa0\x3f\xe0\x61\ +\x66\x51\x1a\x4f\xe6\x67\x32\x2f\xe7\x3e\xd6\x99\x3b\x43\xb3\x0f\ +\x74\x74\x3c\xc6\xf0\x00\xe2\xcb\x8e\xfd\x38\x07\xa2\x61\x27\xb6\ +\x32\xa8\x74\x7f\xac\x35\x60\xad\x20\xfb\x5a\xa7\x16\x38\xd8\x0a\ +\x0c\x00\x8b\x76\x57\x3b\x32\xf7\xe7\x99\xe5\x8e\x5c\x24\x32\xc8\ +\xe5\xd7\x39\x93\x39\x2b\xd7\xf3\x64\x21\xb5\x2c\xf5\xa6\x8c\xdd\ +\x75\x2e\x69\x6d\x1b\x73\xeb\x26\x90\xca\x48\xae\xef\x56\x71\xc2\ +\x7c\xbf\x05\x0d\xbf\xe1\x9f\x34\x4c\x85\x87\xd5\x88\x18\xfe\xe9\ +\xb1\x83\x13\xda\xd9\xfa\x17\x2b\x0e\x9e\x7d\ \x00\x00\x07\x4c\ \x00\ \x00\x29\xd1\x78\x9c\xed\x59\x5b\x8f\xe2\x46\x16\x7e\xef\x5f\xe1\ @@ -10078,30 +10081,30 @@ qt_resource_struct = "\ \x00\x00\x00\x86\x00\x00\x00\x00\x00\x01\x00\x00\x3e\x30\ \x00\x00\x01\x70\x00\x00\x00\x00\x00\x01\x00\x01\x08\x08\ \x00\x00\x00\x38\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x2f\x81\ -\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf1\xb2\ -\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa3\x40\ -\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5b\x13\ -\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x28\xaf\ -\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb1\xaf\ -\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc5\x36\ -\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x88\xa0\ -\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0b\x8c\ -\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x7f\xa7\ -\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbb\x07\ -\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x6e\xff\ -\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x78\xa7\ -\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1a\xfa\ -\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe1\x31\ -\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x20\x4a\ -\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x36\x5c\ -\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xca\x4d\ -\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x52\x99\ -\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x48\x5f\ -\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x05\x74\ -\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x90\xe2\ -\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd2\x35\ -\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x67\xaf\ +\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x2f\xb8\ +\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf1\xe9\ +\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa3\x77\ +\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5b\x4a\ +\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x28\xe6\ +\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb1\xe6\ +\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc5\x6d\ +\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x88\xd7\ +\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0b\xc3\ +\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x7f\xde\ +\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbb\x3e\ +\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x6f\x36\ +\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x78\xde\ +\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1b\x31\ +\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe1\x68\ +\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x20\x81\ +\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x36\x93\ +\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xca\x84\ +\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x52\xd0\ +\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x48\x96\ +\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x05\xab\ +\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x91\x19\ +\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd2\x6c\ +\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x67\xe6\ \x00\x00\x01\xd8\x00\x01\x00\x00\x00\x01\x00\x01\x61\x46\ " diff --git a/src/Mod/Arch/Resources/ui/archprefs-base.ui b/src/Mod/Arch/Resources/ui/archprefs-base.ui index 663bda9ca..cbfe9d49f 100644 --- a/src/Mod/Arch/Resources/ui/archprefs-base.ui +++ b/src/Mod/Arch/Resources/ui/archprefs-base.ui @@ -183,6 +183,40 @@ p, li { white-space: pre-wrap; } + + + + + + Path to IfcOpenShell + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ifcopenshell + + + Mod/Arch + + + + + diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index e165b0126..fd099e79a 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -21,7 +21,7 @@ #* * #*************************************************************************** -import ifcReader, FreeCAD, Arch, Draft, os, time +import ifcReader, FreeCAD, Arch, Draft, os, sys, time from draftlibs import fcvec __title__="FreeCAD IFC importer" @@ -52,6 +52,7 @@ def decode(name): return decodedName def getSchema(): + "retrieves the express schema" default = "IFC2X3_TC1.exp" p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") p = p.GetString("IfcSchema") @@ -62,6 +63,26 @@ def getSchema(): if os.path.exists(p): return p return None + +def getIfcOpenShell(): + "locates and imports ifcopenshell" + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") + p = p.GetString("ifcopenshell") + if p: + try: + sys.path.append(os.path.dirname(p)) + global IfcOpenShell + IfcOpenShell = None + import IfcImport as IfcOpenShell + except: + print "Couldn't import IfcOpenShell" + +def readOpenShell(filename): + getIfcOpenShell() + if IfcOpenShell: + IfcOpenShell.Init(filename) + return IfcOpenShell.Get() + return None def read(filename): "processes an ifc file and add its objects to the given document" From 169abb6f34854e70e9d3d9048eb379e4cc75188b Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 6 Jan 2012 13:11:19 -0200 Subject: [PATCH 09/12] Draft SVG importer now supports quadratic and cubic curves (shoogen) --- src/Mod/Draft/importSVG.py | 124 +++++++++++++++++++++++++++++++------ 1 file changed, 104 insertions(+), 20 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 0590d7701..ae560f138 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -22,13 +22,12 @@ #*************************************************************************** __title__="FreeCAD Draft Workbench - SVG importer/exporter" -__author__ = "Yorik van Havre " -__url__ = ["http://yorik.orgfree.com","http://free-cad.sourceforge.net"] +__author__ = "Yorik van Havre, Sebastian Hoogen" +__url__ = ["http://free-cad.sourceforge.net"] ''' This script imports SVG files in FreeCAD. Currently only reads the following entities: paths, lines, arcs and rects. -Bezier curves are skipped. ''' import xml.sax, string, FreeCAD, os, math, re, Draft @@ -373,13 +372,14 @@ class svgHandler(xml.sax.ContentHandler): path = [] point = [] lastvec = Vector(0,0,0) + lastpole = None command = None relative = False firstvec = None pathdata = [] for d in data['d']: - if (len(d) == 1) and (d in ['m','M','l','L','h','H','v','V','a','A','c','C']): + if (len(d) == 1) and (d in ['m','M','l','L','h','H','v','V','a','A','c','C','q','Q','s','S','t','T']): pathdata.append(d) else: try: @@ -453,12 +453,44 @@ class svgHandler(xml.sax.ContentHandler): command = "close" point = [] elif (d == "C"): - command = "curve" + command = "cubic" relative = False + smooth = False point = [] elif (d == "c"): - command = "curve" + command = "cubic" relative = True + smooth = False + point = [] + elif (d == "Q"): + command = "quadratic" + relative = False + smooth = False + point = [] + elif (d == "q"): + command = "quadratic" + relative = True + smooth = False + point = [] + elif (d == "S"): + command = "cubic" + relative = False + smooth = True + point = [] + elif (d == "s"): + command = "cubic" + relative = True + smooth = True + point = [] + elif (d == "T"): + command = "quadratic" + relative = False + smooth = True + point = [] + elif (d == "t"): + command = "quadratic" + relative = True + smooth = True point = [] else: try: @@ -485,6 +517,7 @@ class svgHandler(xml.sax.ContentHandler): firstvec = lastvec print "move ",lastvec command = "line" + lastpole = None point = [] elif (len(point)==2) and (command=="line"): if relative: @@ -496,6 +529,7 @@ class svgHandler(xml.sax.ContentHandler): print "line ",lastvec,currentvec lastvec = currentvec path.append(seg) + lastpole = None point = [] elif (len(point)==1) and (command=="horizontal"): if relative: @@ -505,6 +539,7 @@ class svgHandler(xml.sax.ContentHandler): currentvec = Vector(point[0],lasty,0) seg = Part.Line(lastvec,currentvec).toShape() lastvec = currentvec + lastpole = None path.append(seg) point = [] elif (len(point)==1) and (command=="vertical"): @@ -515,6 +550,7 @@ class svgHandler(xml.sax.ContentHandler): currentvec = Vector(lastx,-point[0],0) seg = Part.Line(lastvec,currentvec).toShape() lastvec = currentvec + lastpole = None path.append(seg) point = [] elif (len(point)==7) and (command=="arc"): @@ -539,6 +575,7 @@ class svgHandler(xml.sax.ContentHandler): midpoint = lastvec.add(chord.add(perp)) seg = Part.Arc(lastvec,midpoint,currentvec).toShape() lastvec = currentvec + lastpole = None path.append(seg) point = [] elif (command == "close"): @@ -555,31 +592,78 @@ class svgHandler(xml.sax.ContentHandler): path = [] point = [] command = None - elif (len(point)==6) and (command=="curve"): - if relative: - currentvec = lastvec.add(Vector(point[4],-point[5],0)) - pole1 = lastvec.add(Vector(point[0],-point[1],0)) - pole2 = lastvec.add(Vector(point[2],-point[3],0)) - else: - currentvec = Vector(point[4],-point[5],0) - pole1 = Vector(point[0],-point[1],0) - pole2 = Vector(point[2],-point[3],0) + #elif (len(point)==6) and (command=="cubic"): + elif (command=="cubic") and (((smooth==False) and (len(point)==6)) or (smooth==True and (len(point)==4))) : + if smooth: + if relative: + currentvec = lastvec.add(Vector(point[2],-point[3],0)) + pole2 = lastvec.add(Vector(point[0],-point[1],0)) + else: + currentvec = Vector(point[2],-point[3],0) + pole2 = Vector(point[0],-point[1],0) + if lastpole: + pole1 = lastvec.sub(lastpole).add(lastvec) + else: + pole1 = lastvec + else: #not smooth + if relative: + currentvec = lastvec.add(Vector(point[4],-point[5],0)) + pole1 = lastvec.add(Vector(point[0],-point[1],0)) + pole2 = lastvec.add(Vector(point[2],-point[3],0)) + else: + currentvec = Vector(point[4],-point[5],0) + pole1 = Vector(point[0],-point[1],0) + pole2 = Vector(point[2],-point[3],0) + if not fcvec.equals(currentvec,lastvec): mainv = currentvec.sub(lastvec) pole1v = lastvec.add(pole1) pole2v = currentvec.add(pole2) - print "curve data:",mainv.normalize(),pole1v.normalize(),pole2v.normalize() - if (round(mainv.getAngle(pole1v),Draft.precision()) in [0,round(math.pi,Draft.precision())]) \ - and (round(mainv.getAngle(pole2v),Draft.precision()) in [0,round(math.pi,Draft.precision())]): + print "cubic curve data:",mainv.normalize(),pole1v.normalize(),pole2v.normalize() + if pole1.distanceToLine(lastvec,currentvec) < 10**(-1*Draft.precision()) and pole2.distanceToLine(lastvec,currentvec) < 10**(-1*Draft.precision()): print "straight segment" seg = Part.Line(lastvec,currentvec).toShape() else: - print "bezier segment" + print "cubic bezier segment" b = Part.BezierCurve() b.setPoles([lastvec,pole1,pole2,currentvec]) seg = b.toShape() print "connect ",lastvec,currentvec lastvec = currentvec + lastpole = pole2 + path.append(seg) + point = [] + + elif (command=="quadratic") and (((smooth==False) and (len(point)==4)) or (smooth==True and (len(point)==2))) : + if smooth: + if relative: + currentvec = lastvec.add(Vector(point[0],-point[1],0)) + else: + currentvec = Vector(point[0],-point[1],0) + if lastpole: + pole1 = lastvec.sub(lastpole).add(lastvec) + else: + pole1 = lastvec + else: #not smooth + if relative: + currentvec = lastvec.add(Vector(point[2],-point[3],0)) + pole1 = lastvec.add(Vector(point[0],-point[1],0)) + else: + currentvec = Vector(point[2],-point[3],0) + pole1 = Vector(point[0],-point[1],0) + + if not fcvec.equals(currentvec,lastvec): + if pole1.distanceToLine(lastvec,currentvec) < 10**(-1*Draft.precision()): + print "straight segment" + seg = Part.Line(lastvec,currentvec).toShape() + else: + print "quadratic bezier segment" + b = Part.BezierCurve() + b.setPoles([lastvec,pole1,currentvec]) + seg = b.toShape() + print "connect ",lastvec,currentvec + lastvec = currentvec + lastpole = pole1 path.append(seg) point = [] @@ -749,7 +833,7 @@ def decodeName(name): try: decodedName = (name.decode("latin1")) except UnicodeDecodeError: - print "dxf: error: couldn't determine character encoding" + print "svg: error: couldn't determine character encoding" decodedName = name return decodedName From 30f97b312404b7ea34e506b8f304fbbcb6281bee Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 6 Jan 2012 13:40:58 -0200 Subject: [PATCH 10/12] fixed bug 564 - bug in Draft to Sketch --- src/Mod/Draft/Draft.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 85fafb554..22457a4e2 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -1270,10 +1270,10 @@ def makeSketch(objectslist,autoconstraints=False,addTo=None,name="Sketch"): if closed: nobj.addConstraint(Constraint("Coincident",last-1,EndPoint,segs[0],StartPoint)) ok = True - else: + elif obj.isDerivedFrom("Part::Feature"): if fcgeo.hasOnlyWires(obj.Shape): for w in obj.Shape.Wires: - for edge in w.Edges: + for edge in fcgeo.sortEdges(w.Edges): nobj.addGeometry(fcgeo.geom(edge)) if autoconstraints: last = nobj.GeometryCount From d54d644c0ea4075a5e75bf445ebf9fd9c1f9a40a Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 6 Jan 2012 18:39:17 -0200 Subject: [PATCH 11/12] further work on ifcopenshell integration --- src/Mod/Arch/ArchCommands.py | 30 ++- src/Mod/Arch/Arch_rc.py | 282 +++++++++++--------- src/Mod/Arch/Resources/ui/archprefs-base.ui | 78 +++++- src/Mod/Arch/importIFC.py | 38 ++- 4 files changed, 271 insertions(+), 157 deletions(-) diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 38452421c..0803b5411 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -138,6 +138,7 @@ def splitMesh(obj,mark=True): def meshToShape(obj,mark=True): '''meshToShape(object,[mark]): turns a mesh into a shape, joining coplanar facets. If mark is True (default), non-solid objects will be marked in red''' + name = obj.Name import Part,MeshPart from draftlibs import fcgeo if "Mesh" in obj.PropertiesList: @@ -177,21 +178,26 @@ def meshToShape(obj,mark=True): # make sure that the exterior wires comes as first in the list wires.insert(0, ext) print "done sorting", wires - faces.append(Part.Face(wires)) + if wires: + faces.append(Part.Face(wires)) print "done facing" print "faces",faces - shell=Part.Compound(faces) - solid = Part.Solid(Part.Shell(faces)) - name = obj.Name - if solid.isClosed(): - FreeCAD.ActiveDocument.removeObject(name) - newobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name) - newobj.Shape = solid - newobj.Placement = plac - if not solid.isClosed(): - newobj.ViewObject.ShapeColor = (1.0,0.0,0.0,1.0) - return newobj + try: + se = Part.makeShell(faces) + solid = Part.Solid(se) + except: + pass + else: + if solid.isClosed(): + FreeCAD.ActiveDocument.removeObject(name) + else: + if mark: + newobj.ViewObject.ShapeColor = (1.0,0.0,0.0,1.0) + newobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name) + newobj.Shape = solid + newobj.Placement = plac + return newobj return None def removeShape(objs,mark=True): diff --git a/src/Mod/Arch/Arch_rc.py b/src/Mod/Arch/Arch_rc.py index 2ad9bacd7..a8691486c 100644 --- a/src/Mod/Arch/Arch_rc.py +++ b/src/Mod/Arch/Arch_rc.py @@ -2,7 +2,7 @@ # Resource object code # -# Created: Thu Jan 5 19:10:05 2012 +# Created: Fri Jan 6 18:11:49 2012 # by: The Resource Compiler for PyQt (Qt v4.7.3) # # WARNING! All changes made in this file will be lost! @@ -5697,114 +5697,132 @@ qt_resource_data = "\ \x00\x00\x00\x12\x00\x57\x00\x65\x00\x72\x00\x6b\x00\x7a\x00\x65\ \x00\x75\x00\x67\x00\x65\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05\ \x54\x6f\x6f\x6c\x73\x07\x00\x00\x00\x04\x61\x72\x63\x68\x01\ -\x00\x00\x06\x9c\ +\x00\x00\x07\xb2\ \x00\ -\x00\x26\x4b\x78\x9c\xed\x5a\x51\x53\xdb\x38\x10\x7e\xe7\x57\xe8\ -\x72\x33\xed\xdd\x0c\x89\x12\x20\x14\x82\x93\x4e\x1b\xa0\x74\x86\ -\x5e\x69\x93\xb6\x73\x4f\x8c\x63\x2b\xb1\x7a\xb2\x65\x24\xb9\x4e\ -\x7a\x73\xff\xfd\x56\xb2\x9c\xc4\x71\x08\x85\xe4\x80\xeb\xd0\xa1\ -\x83\xa5\x95\x77\x57\xdf\x7e\xda\x5d\x1b\x3b\x2f\xc7\x21\x43\xdf\ -\x88\x90\x94\x47\xed\x4a\xa3\x56\xaf\x20\x12\x79\xdc\xa7\xd1\xa8\ -\x5d\xf9\xd4\x3f\xad\x1e\x54\x5e\x76\xb6\x9c\x84\xce\x16\xed\xc1\ -\xa2\xce\x16\x72\x3c\xe6\x4a\xd9\x79\x93\xd0\x56\xeb\x98\xba\x8c\ -\x8f\xe0\x37\x1b\xf5\x88\x52\x70\xb3\x7c\x25\xbc\xc0\xc1\xd9\x1a\ -\x58\x9c\x52\x7f\x44\x14\x32\xe3\x76\xe5\xc3\x17\x33\xac\xa0\xc8\ -\x0d\x49\xbb\xb2\x4a\x87\x36\x85\x9c\x58\xf0\x98\x08\x35\xb1\x37\ -\x8c\x08\x0f\x89\x12\x13\x23\x44\x8e\x20\x9e\x32\x57\xc8\x19\x77\ -\xea\x0e\x1e\xdb\xc1\x44\x0f\x26\x76\x00\x1e\xa8\xa0\xd3\x7c\xd1\ -\x74\x70\x76\x99\x4d\x07\x84\x8e\x02\xd5\xd9\xdf\x39\x74\xb0\xbd\ -\x36\x3a\x71\xae\xd4\xc1\xb9\xf1\x65\x9e\xa4\x34\xf2\x79\xda\xa7\ -\x8a\x11\xeb\x8c\x54\x02\x7c\xef\xbc\x21\x11\x11\x2e\x43\xd2\xee\ -\xc5\xc1\x56\x50\x56\xc9\xdc\x09\x4f\x66\xd8\x7c\x7e\xcd\xc7\xe7\ -\x66\xca\x6a\x5c\x30\x29\x63\xd7\x03\x45\x15\xbb\x81\x28\x09\x07\ -\x44\x74\xf6\x1d\x6c\xaf\x32\xf7\xe7\x2d\x94\x54\x84\xae\x18\xd1\ -\x68\x41\xc3\xe1\x4a\x0d\x54\x91\x70\x86\xe4\x7c\x2c\xdf\x08\x9e\ -\xc4\xe0\x73\x1e\xcd\x51\x3e\xce\x96\x97\x8c\xab\x19\x58\x4b\xf0\ -\xd2\x31\x47\xbd\x25\xa0\x95\x7d\x5a\x09\x9d\x35\x06\xac\x55\xd4\ -\x73\x59\x36\x7b\xb9\x33\xb3\x3b\xdb\xd0\x12\x45\x67\x25\x45\x01\ -\x17\xf4\x3b\x8f\xd4\x12\x55\x8b\xca\xca\x10\x9d\xbb\x03\xc2\x72\ -\x4d\x4c\x0f\x0a\xb7\x2f\xc1\x88\x8c\x55\x61\xc1\x14\xa7\x63\x32\ -\x74\x13\x06\xaa\x39\xe3\x02\x0d\xe1\x7f\xea\x32\xb6\x88\xd4\x72\ -\xb8\xb2\xc9\xcc\xb7\x39\xe7\x71\xd1\xfb\xd2\x66\x34\xe1\x88\x28\ -\xe1\xd0\x33\xd3\x2b\xb7\x01\x6b\x09\x2c\x55\x90\x37\x16\x76\x43\ -\x80\x6a\x9d\x0f\xaa\xd5\x3a\x9b\xea\x73\xb0\x99\xbc\x69\x03\xe5\ -\xf3\x40\xbf\x93\x33\x1a\x41\xa4\xa4\xf2\xe1\xb8\xb5\x2b\xf5\x45\ -\xe8\x60\x45\x61\x26\xcf\x06\x7b\xf5\x42\x32\x98\x4a\x6d\x22\xd8\ -\xa9\x17\x72\xc2\xcc\xad\x45\x85\xd7\x20\x9d\x01\x77\x0b\xa4\x8b\ -\xb4\x31\x69\xf1\x42\x90\x61\x57\xc7\xfa\x75\xa2\x14\xc0\x98\x1f\ -\x32\x2d\x8b\x41\x66\x78\x30\xc8\x64\x2b\x19\xc5\x39\xeb\xd3\x78\ -\x39\xa9\xfa\x01\x95\x08\x7e\x54\x40\x90\x5f\x22\x58\x44\x52\xf4\ -\x05\x48\x86\xf8\xe0\x2b\x24\xc5\x1f\xe7\x5a\xc9\x09\xa3\x73\xc1\ -\x05\x33\xb7\x80\xbf\x20\x7e\x67\xa7\xd9\xd4\x49\xd8\x5f\x10\x8d\ -\x04\x21\x51\xa7\x71\x08\xa1\xc9\x2e\x8b\xe2\x01\x4b\x48\xa7\xf1\ -\x02\xa4\xe6\xaa\x18\xb6\x92\xa9\x1f\xf3\x5a\xc3\x7c\x12\xe9\x72\ -\x73\x2d\xc3\x3c\x8b\x88\x86\xc9\x44\x0b\x8c\xdd\x15\x24\x6d\xee\ -\xc2\x55\xc1\xcd\xd6\xde\x71\x1f\xdb\x3a\xbb\xa9\xd3\xef\xe0\x2c\ -\x13\x4e\xd3\x64\x41\xbc\x6e\xd2\x5c\x2b\x65\x6e\x2c\x61\x82\x20\ -\xf1\x54\x22\xc8\xc3\x65\xcd\x1b\xd2\xff\x53\xde\xbc\xcf\xbc\x79\ -\x53\x2d\x5e\x2f\x73\xf6\x72\xb6\xdd\x6f\xfa\x6c\x34\xeb\x2b\xd2\ -\xe7\xfe\xe1\xaa\xf4\x79\xb0\xff\x40\xe9\x73\x8a\xd5\xcf\x9b\x43\ -\x8b\xc2\x82\xae\xb9\x75\x77\x68\xb7\x67\x2c\xfe\xb1\x86\xfb\xed\ -\x69\x17\xd1\x30\xe6\x42\x6d\xba\xcb\xde\x5c\x8f\xbd\xbb\x5e\x8f\ -\xbd\x7b\xc7\x92\xf1\x8c\xa9\xa3\x5f\x8e\xdf\x77\xfb\x7f\x5e\x9c\ -\xa0\xb3\xfe\xbb\x73\x74\xf1\xe9\xf5\xf9\xdb\x2e\x7a\x76\x95\x70\ -\x75\x54\xc5\xf8\xcb\x6e\x17\xe3\xe3\xfe\x71\x26\x85\x27\x62\x8c\ -\x4f\xfe\xc8\xa4\x76\x51\xa0\x54\xdc\xc2\x38\x4d\xd3\x5a\xba\x5b\ -\xe3\x62\x84\xfb\x1f\xf1\xc7\x93\x6e\x35\x50\x21\xdb\xab\x1b\xc8\ -\x3d\x55\xf3\x95\x9f\xad\x7f\x36\x52\x47\x5b\xda\xb0\x96\xeb\x81\ -\xb9\x26\xae\x9f\x5f\xc3\x03\xaf\x9b\x79\x9e\xdd\x70\x05\xf7\x07\ -\x7a\x0f\xd6\xac\x07\xc0\x41\xd1\xb0\xd2\x86\x9d\xc5\xf9\xed\x52\ -\x4d\x18\x41\x6a\x12\xe7\xf7\xeb\x5b\x81\xf3\x72\xce\x7c\xbc\x8d\ -\x18\x45\x7f\xa3\x34\x00\xac\xab\x26\x0b\xb7\x10\x1c\xa5\x6a\x2a\ -\xdc\xf8\x08\xfd\x63\xfc\xc3\x46\x53\xae\x16\xcf\xbb\x38\xe0\xfe\ -\x04\x19\xb1\xb5\x01\x49\x30\x52\xd5\xa1\x1b\x52\x36\x69\x3d\x3f\ -\x26\x5f\xdd\xcf\x09\xea\xb9\x91\x7c\x6e\x45\xba\x20\xb4\x0e\xe2\ -\x7c\x65\x6a\x8a\x46\x6b\xaf\x5e\xcf\xe5\x5a\x59\x2b\xe2\x22\x74\ -\xd9\xd1\x02\x50\x71\xd1\x54\xf6\x4c\x5b\x55\x3c\x6e\xd5\xe3\xf1\ -\x74\x3c\xe0\x90\xe2\xc3\xc2\x14\x23\x43\x55\x98\x10\xc6\xaa\x99\ -\xa9\x5e\xa9\xea\x80\x71\xef\xaf\x2a\x3c\xd8\x03\x9c\x2d\xf0\x44\ -\x23\x35\x1d\xc2\xa2\x99\x1f\xa7\x90\xe3\x75\xe6\xd7\x67\x49\x00\ -\x10\x50\xef\x15\x47\xc3\x24\xf2\x74\xe9\xde\x46\x40\x62\xa8\x01\ -\xc4\x47\x6e\x64\xd6\xf4\xbc\x80\x84\x2e\x3a\x19\x03\xa8\x52\xa2\ -\x21\x85\x90\xfc\x56\x23\xe3\xf8\x77\xe4\x7e\x73\x29\xb0\x16\x26\ -\x02\x22\x48\xcb\x60\x1b\x3f\xa6\xbd\x6a\x37\x5c\x14\x40\x62\x6d\ -\x97\x18\x2e\x15\x89\x75\x99\x94\x35\x8f\x87\x58\x26\xb1\x4e\x2b\ -\x40\x14\x9f\x7c\xbb\xf4\xb9\x27\x31\xc9\x76\x8c\xe9\xd0\xdb\x19\ -\xef\xda\x5f\x97\xca\x6b\xe8\xcd\x17\x6d\x00\xed\xa2\xe2\x6e\x8d\ -\x4f\x3e\xf1\xb8\x30\x1d\x51\x0b\x25\xe0\x9f\x60\x34\x22\x47\x59\ -\xad\x6d\xfd\xda\xac\x1f\x10\xff\x60\xce\xdb\xcd\x39\x67\x28\x0f\ -\x3e\x4d\x19\xef\x4e\xaf\xe2\xe9\x95\x66\xfe\xec\x48\xd8\x13\xbc\ -\xb9\xee\xf2\xbf\xed\xca\x2f\xf7\xd6\x4b\xb3\x7b\x77\x4c\xb3\x73\ -\x27\xc2\x9c\x04\xa0\xa2\x09\xf0\xc3\x75\xe5\xab\x0b\xc6\x53\x57\ -\xbe\x91\xae\xfc\x14\x62\xdd\x0d\x38\x97\x44\x94\xba\x72\xcd\x03\ -\xcf\xca\xee\xdc\x93\x3f\x95\xef\xa7\xf2\x7d\xdf\xe5\x7b\xc9\xbf\ -\xc7\x57\xc2\x67\x3d\xc6\xff\xac\x98\x43\x47\x54\x43\xd7\x54\x62\ -\x1d\x44\x46\x3d\x12\x49\x38\xfb\x3a\x8c\x92\x47\x12\xa5\x04\xb9\ -\xf0\xc8\x1d\x71\x85\x5c\xc6\x78\x0a\x41\x84\xd0\xca\x80\xc6\x10\ -\x71\x57\x65\xb1\x7b\x7c\x11\x4a\xa9\x0a\xd0\x29\x3c\x98\x77\x5f\ -\x1d\x6f\x23\xc9\x0d\x05\xc3\x44\x2a\xe4\xf3\x34\x62\xdc\xf5\x11\ -\x55\x7a\x52\x48\xc2\x86\x35\x74\xc1\xe0\x90\xcf\xed\x88\x02\xda\ -\x3c\x24\x8f\x6f\x63\x79\x6d\x47\xf0\xa3\xdd\x87\x58\x87\x71\xa2\ -\x88\xd8\x86\xc3\xe5\x23\xd8\x0d\xf1\x94\x39\x8c\x66\x1f\x26\xe2\ -\x1b\xed\xb1\xd6\x79\x2d\xf1\x76\xe8\x65\x47\xff\xa7\x7c\x23\xb1\ -\x7e\xff\xd8\x5c\xaf\x7f\x6c\xde\xb1\x7f\xd4\x70\xea\x53\x0d\xe1\ -\x79\x1f\x93\xa8\x17\x10\xc6\x1e\xae\x77\x5c\xdd\x05\x3f\xf5\x8e\ -\xf7\xd9\x3b\xde\xf0\x46\xf7\x16\x47\x1f\x8a\x1b\xdc\x1a\xc9\x8c\ -\x5b\x3f\xe1\xe9\xbf\xfd\xfb\xc8\xc2\x31\xc8\xdf\xfc\x15\xff\x18\ -\xfc\x23\xec\x9f\x11\xff\xb3\xd5\x51\xa0\x7d\xf9\x2d\xe4\x2d\xc8\ -\x5e\xe4\xb9\xa5\xf8\x4e\x89\xe2\x39\xbb\xf7\x4a\xec\x2e\x10\x7b\ -\xd1\x95\x02\x9d\x67\x20\xcd\x21\x39\x07\xa3\x4d\xa7\xf9\xdf\x06\ -\xec\xc7\x1b\xed\xca\x7e\xc5\xd6\xd4\x76\xa5\xd1\xa8\x60\xbd\x32\ -\xa6\xe3\xd0\x8d\xf3\xf6\xb3\x73\x75\x61\xc6\xa7\x82\x87\xef\x68\ -\x48\x7a\x50\x35\x3d\x02\xbe\x14\x57\xe9\x0f\x71\xa0\x3f\xe0\x61\ -\x66\x51\x1a\x4f\xe6\x67\x32\x2f\xe7\x3e\xd6\x99\x3b\x43\xb3\x0f\ -\x74\x74\x3c\xc6\xf0\x00\xe2\xcb\x8e\xfd\x38\x07\xa2\x61\x27\xb6\ -\x32\xa8\x74\x7f\xac\x35\x60\xad\x20\xfb\x5a\xa7\x16\x38\xd8\x0a\ -\x0c\x00\x8b\x76\x57\x3b\x32\xf7\xe7\x99\xe5\x8e\x5c\x24\x32\xc8\ -\xe5\xd7\x39\x93\x39\x2b\xd7\xf3\x64\x21\xb5\x2c\xf5\xa6\x8c\xdd\ -\x75\x2e\x69\x6d\x1b\x73\xeb\x26\x90\xca\x48\xae\xef\x56\x71\xc2\ -\x7c\xbf\x05\x0d\xbf\xe1\x9f\x34\x4c\x85\x87\xd5\x88\x18\xfe\xe9\ -\xb1\x83\x13\xda\xd9\xfa\x17\x2b\x0e\x9e\x7d\ +\x00\x28\x75\x78\x9c\xed\x5a\xeb\x73\xd3\x38\x10\xff\xde\xbf\x42\ +\x97\x9b\xe1\x31\xd3\x44\x49\xdb\x94\x36\x75\x7d\x03\x7d\x40\x67\ +\xe0\x28\xb4\xc0\xdc\x27\xc6\xb1\x95\x58\x20\x5b\xc6\x92\x49\xc2\ +\xcd\xfd\xef\xb7\x7a\x38\x7e\xa5\xe9\x23\xa1\x1c\x37\xcc\x14\x6a\ +\x69\xa5\xdd\xd5\x4f\xab\xdf\xae\x5c\x3b\x7f\x4c\x23\x86\xbe\x92\ +\x54\x50\x1e\x1f\xb6\x7a\x9d\x6e\x0b\x91\xd8\xe7\x01\x8d\xc7\x87\ +\xad\x77\x97\xa7\xed\xbd\xd6\x1f\xee\x86\x93\xd1\x62\xd0\x0e\x0c\ +\x72\x37\x90\xe3\x33\x4f\x08\xf7\x79\x46\x07\x83\x63\xea\x31\x3e\ +\x86\xdf\x6c\x7c\x41\xa4\x84\xc9\xe2\x69\xea\x87\x0e\x36\x63\x60\ +\xf0\x84\x06\x63\x22\x91\x6e\x1f\xb6\xde\x7c\xd0\xcd\x16\x8a\xbd\ +\x88\x1c\xb6\x96\xe9\x50\xa6\x90\x93\xa4\x3c\x21\xa9\x9c\xd9\x09\ +\x63\xc2\x23\x22\xd3\x99\x16\x22\x27\x25\xbe\xd4\x4f\xc8\x99\xba\ +\x5d\x07\x4f\x6d\x63\xa6\x1a\x33\xdb\x00\x0f\x64\xe8\xf6\x9f\xf4\ +\x1d\x6c\x1e\x4d\x77\x48\xe8\x38\x94\xee\xee\xd6\xbe\x83\xed\xb3\ +\xd6\x89\x73\xa5\x0e\xce\x8d\x2f\xf2\x64\x42\xe3\x80\x4f\x2e\xa9\ +\x64\xc4\x3a\x23\x64\x0a\xbe\xbb\xcf\x49\x4c\x52\x8f\x21\x61\xd7\ +\xe2\x60\x2b\x68\xaa\x64\xde\x8c\x67\x05\x36\xef\x9f\xf1\xe9\x4b\ +\xdd\x65\x35\xd6\x4c\x8a\xc4\xf3\x41\x51\xcb\x2e\x20\xce\xa2\x21\ +\x49\xdd\x5d\x07\xdb\x27\xe3\x7e\xd9\x42\x43\x45\xe4\xa5\x63\x1a\ +\xd7\x34\xec\x2f\xd5\x40\x25\x89\x0a\x24\xcb\x7b\xf9\x3c\xe5\x59\ +\x02\x3e\xe7\xbb\x39\xce\xdb\x66\x78\xc3\xb8\x2c\xc0\x5a\x80\x97\ +\xda\x73\x74\xb1\x00\xb4\xa6\x4f\x4b\xa1\xb3\xc6\x20\x6a\x25\xf5\ +\x3d\x66\x7a\x3f\x6e\x15\x76\x8b\x05\x2d\x50\xf4\xa2\xa1\x28\xe4\ +\x29\xfd\xc6\x63\xb9\x40\x55\x5d\x59\x13\xa2\x97\xde\x90\xb0\x5c\ +\x13\x53\x8d\xca\xf4\x05\x18\x91\xa9\xac\x0c\x98\xe3\x74\x4c\x46\ +\x5e\xc6\x40\x35\x67\x3c\x45\x23\xf8\x37\xf1\x18\xab\x23\xb5\x18\ +\x2e\xd3\x69\x7c\x2b\x39\x8f\xab\xde\x37\x16\xa3\x02\x8e\xa4\x0d\ +\x1c\x2e\x74\xf7\xd2\x65\xc0\x58\x02\x43\x25\xf0\x46\x6d\x35\x04\ +\x42\xcd\x7d\x23\x07\x83\x17\x73\x7d\x0e\xd6\x9d\xd7\x2d\xa0\x79\ +\x1e\xe8\x37\xf2\x82\xc6\xb0\x53\x42\x06\x70\xdc\x0e\x5b\xdd\x3a\ +\x74\x30\xa2\xd2\x93\xb3\xc1\x4e\xb7\x42\x06\x73\xa9\x25\x82\xad\ +\x6e\x85\x13\x0a\xb7\xea\x0a\xaf\x40\xda\x00\x77\x0b\xa4\xab\x61\ +\xa3\x69\xf1\x3c\x25\xa3\x23\xb5\xd7\xcf\x32\x29\x01\xc6\xfc\x90\ +\x29\x59\x02\x32\x1d\x07\x43\x23\x5b\x1a\x51\x9c\xb3\x4b\x9a\x2c\ +\x0e\xaa\xcb\x90\x0a\x04\x3f\x32\x24\x28\x68\x04\x58\x4c\x26\xe8\ +\x03\x04\x19\xe2\xc3\x4f\x40\x8a\x37\x8f\xb5\x86\x13\x5a\x67\xcd\ +\x05\xdd\x57\xc3\x3f\x25\x81\xbb\xd5\xef\x2b\x12\x0e\x6a\xa2\x71\ +\x4a\x48\xec\xf6\xf6\x61\x6b\xcc\x63\x55\x3c\x64\x19\x71\x7b\x4f\ +\x40\xaa\x9f\xaa\xdb\xd6\x30\x75\x33\xaf\x15\xcc\x27\xb1\x4a\x37\ +\x57\x46\x98\x6f\x11\x51\x30\xe9\xdd\x02\x63\x77\x05\x49\x99\x3b\ +\xf7\x64\x78\xbd\xb5\x57\x3c\xc0\x36\xcf\xae\xeb\xf4\x3b\xd8\x30\ +\xe1\x9c\x26\x2b\xe2\x55\x49\x73\x25\xca\x5c\x1b\x61\x82\x20\xf3\ +\x65\x96\x92\x1f\xc7\x9a\xd7\xd0\xff\x2f\xde\xbc\x4f\xde\xbc\x2e\ +\x17\xaf\xc6\x9c\x17\x79\xb4\xdd\x2f\x7d\xf6\xfa\xdd\x25\xf4\xb9\ +\xbb\xbf\x8c\x3e\xf7\x76\x7f\x10\x7d\xce\xb1\xfa\xff\x72\x68\x55\ +\x58\xd1\x55\x1a\x77\x87\x72\xbb\x88\xe2\x9b\x15\xdc\x67\xa7\x47\ +\x88\x46\x09\x4f\xe5\xba\xab\xec\xf5\xd5\xd8\xdb\xab\xd5\xd8\xdb\ +\x77\x4c\x19\x0f\x98\x3c\xf8\xed\xf8\xf5\xd1\xe5\x5f\xe7\x27\xe8\ +\xc5\xe5\xab\x97\xe8\xfc\xdd\xb3\x97\x67\x47\xe8\xc1\x97\x8c\xcb\ +\x83\x36\xc6\x1f\xb6\x8f\x30\x3e\xbe\x3c\x36\x52\xb8\x11\x63\x7c\ +\xf2\xa7\x91\xda\x41\xa1\x94\xc9\x00\xe3\xc9\x64\xd2\x99\x6c\x77\ +\x78\x3a\xc6\x97\x6f\xf1\xdb\x93\xa3\x76\x28\x23\xb6\xd3\xd5\x90\ +\xfb\xb2\x13\xc8\xc0\x8c\x7f\x30\x96\x07\x1b\xca\xb0\x92\xab\x86\ +\x7e\x26\x5e\x90\x3f\xc3\x85\xd7\x33\x9e\x9b\x09\x5f\x60\x7e\xa8\ +\xd6\x60\xcd\xfa\x00\x1c\x24\x0d\x2b\xed\xd9\x5e\x9c\x4f\x17\x72\ +\xc6\x08\x92\xb3\x24\x9f\xaf\xa6\x42\xcc\x8b\x92\xf9\x64\x13\x31\ +\x8a\xfe\x46\x93\x10\xb0\x6e\x6b\x16\x1e\x20\x38\x4a\xed\x49\xea\ +\x25\x07\xe8\x1f\xed\x1f\xd6\x9a\x72\xb5\xb8\xec\xe2\x90\x07\x33\ +\xa4\xc5\xd6\x06\x90\x60\x2c\xdb\x23\x2f\xa2\x6c\x36\x78\x78\x4c\ +\x3e\x79\xef\x33\x74\xe1\xc5\xe2\xa1\x15\xa9\x84\x30\xd8\x4b\xf2\ +\x91\x13\x9d\x34\x06\x3b\xdd\x6e\x2e\x57\xca\x06\x31\x4f\x23\x8f\ +\x1d\xd4\x80\x4a\xaa\xa6\xcc\x9d\xb6\x2d\x79\x32\xe8\x26\xd3\x79\ +\x7b\xc8\x81\xe2\xa3\x4a\x17\x23\x23\x59\xe9\x48\xb5\x55\xdd\xd3\ +\xfe\x22\xdb\x43\xc6\xfd\xcf\x6d\xb8\xd8\x03\x9c\x03\xf0\x44\x21\ +\x35\x6f\xc2\xa0\xc2\x8f\x53\xe0\x78\xc5\xfc\xea\x2c\xa5\x00\x04\ +\xe4\x7b\xc9\xd1\x28\x8b\x7d\x95\xba\x37\x11\x04\x31\xe4\x00\x12\ +\x20\x2f\xd6\x63\x2e\xfc\x90\x44\x1e\x3a\x99\x02\xa8\x42\xa0\x11\ +\x85\x2d\x79\xd4\x21\xd3\xe4\x31\xf2\xbe\x7a\x14\xa2\x16\x3a\x42\ +\x92\x92\x81\xc6\x36\xf9\x2f\xad\x55\xb9\xe1\xa1\x10\x88\xf5\xb0\ +\x11\xe1\x42\x92\x44\xa5\x49\xd1\xf1\x79\x84\x45\x96\x28\x5a\x81\ +\x40\x09\xc8\xd7\x8f\x01\xf7\x05\x26\x66\xc5\x98\x8e\xfc\xad\xe9\ +\xb6\xfd\xf5\x51\xfa\x3d\xb5\xf8\xaa\x0d\x08\xbb\xb8\xba\x5a\xed\ +\x53\x40\x7c\x9e\xea\x8a\x68\x80\x32\xf0\x2f\x65\x34\x26\x07\x26\ +\xd7\x0e\x7e\xef\x77\xf7\x48\xb0\x57\xf2\x76\x7d\xce\xe9\x90\x07\ +\x9f\xe6\x11\xef\xcd\x9f\x92\xf9\x93\x8a\xfc\xe2\x48\xd8\x13\xbc\ +\xbe\xea\xf2\xfb\x56\xe5\x1f\x77\x56\xa3\xd9\x9d\x3b\xd2\x6c\xe9\ +\x44\xe8\x93\x00\xa1\xa8\x37\xf8\xc7\x55\xe5\xcb\x13\xc6\xaf\xaa\ +\x7c\x2d\x55\xf9\x29\xec\xf5\x51\xc8\xb9\x20\x69\xa3\x2a\x57\x71\ +\xe0\x5b\xd9\x9d\x6b\xf2\xf5\xb1\x72\x07\x29\x5d\x8c\xfa\x24\x16\ +\xa0\x59\x69\x13\x3c\x16\x68\x42\x90\x07\x05\x7d\xcc\x25\x82\x0b\ +\x3f\x9f\x80\x2e\xb0\x20\x42\x9a\x80\x61\x4f\x1a\x15\x13\x2a\x43\ +\x74\x0a\x45\xf6\xd1\xd3\xe3\x4d\x24\xb8\xb6\x1b\x65\x42\xa2\x80\ +\x4f\x62\xc6\xbd\x00\x51\xa9\x3a\x53\x41\xd8\xa8\x83\xce\x19\xe0\ +\x5b\x9a\x4f\x81\x06\x79\x54\x1c\x0b\x04\x3f\x6a\x34\x70\x5e\x94\ +\x64\x92\xa4\x9b\xb0\x80\x00\xc1\x64\xb8\x55\xe8\x05\xeb\x69\x2a\ +\x7d\x74\xee\x7e\xc7\xb8\x45\xb5\x7e\x36\xf2\x0d\x74\xff\xcb\x42\ +\x7d\x75\x5a\xed\xdf\x9c\x56\x8b\x2b\x6b\x48\xfc\xcf\xe5\xea\x7e\ +\x7e\x5f\x55\x82\x61\xf1\x56\xfd\xf6\xc7\xe2\x6c\x04\x41\x62\x6e\ +\xab\x5a\x19\x09\x36\x11\xe4\x3a\x50\x10\x8b\x90\x30\x06\x01\x0b\ +\xff\x0d\x09\xca\x84\x89\x67\x1f\xc2\x5d\x12\x14\x11\x10\xc3\xb4\ +\x18\x12\x29\xc4\x2c\x1f\x99\x77\xf4\x2b\xdf\x66\xaf\x4e\x0c\xef\ +\x04\x1c\xde\x91\xff\x1a\x3c\xbb\x50\x9e\xdd\x4b\x34\xc3\xaa\xab\ +\x36\x7f\xce\x98\xbe\x6d\xca\x5b\x9e\xbc\x7f\xa5\xbc\x55\x52\xde\ +\xa2\x62\xa9\xbf\x14\x6f\x12\xab\x2b\x40\x50\x5b\xfe\x10\x8e\xb5\ +\x3b\xf2\x98\x20\x0e\xd6\xcf\x6b\x3c\x6b\x2a\x50\xd5\x61\xbf\xd3\ +\x79\xbb\x43\x34\xae\x56\x14\x5c\xf3\xaa\xee\xbb\xc1\x77\x0d\xaf\ +\xaa\xcc\x1e\x7a\x5f\x49\x95\x4f\x15\x63\x42\x79\xa0\x78\x56\x24\ +\xc4\xa7\xa3\x99\x4e\xce\x3a\x55\x27\x05\xec\x67\xfa\x25\x4c\x27\ +\x99\xdd\x0b\xcd\x95\x3d\xfc\x59\x39\x6e\xcd\x2f\xd8\x2a\x04\x99\ +\xbf\xca\xaa\xfe\x75\xf3\x26\xbc\x58\x50\xe2\x7b\xab\xa3\x42\x88\ +\xcd\xd7\x6a\xb7\xa0\xc1\x2a\x03\x5a\xf2\xdb\x6a\x90\x5f\xce\x7b\ +\x3b\x0d\xde\xab\x50\x5e\xdd\x95\x0a\xd1\x15\x20\x95\x90\x2c\xc1\ +\x68\x0b\xa1\xfc\x65\xb7\xfd\x1a\xe1\xb0\xb5\xdb\xb2\xaf\x18\x0e\ +\x5b\xbd\x5e\x0b\xab\x91\x09\x9d\x46\x5e\x92\x17\xde\xee\x97\x73\ +\xdd\x3e\x4d\x79\xf4\x8a\x46\xe4\x02\x6a\x59\x1f\x8e\x64\x6d\x94\ +\xfa\xb2\x04\x8a\x64\x1e\x19\x8b\x42\x7b\x52\xee\x31\x5e\x96\xbe\ +\x3e\x29\x71\x47\xf1\xc5\x89\xda\x8f\xa9\x24\x71\x20\x5c\xfb\xb5\ +\x09\xec\x86\xed\xd8\x30\x50\xa9\x9b\x81\xd2\x80\x95\x02\xf3\xf9\ +\x49\x27\x74\xb0\x15\x68\x00\xea\x76\x97\x3b\x52\xfa\x7b\xc3\x62\ +\x47\xce\x33\x11\xe6\xf2\xab\x9c\x31\xce\x8a\xd5\x3c\xa9\x51\xea\ +\x42\x6f\x9a\xd8\x5d\xe5\x92\xd2\xb6\x36\xb7\xae\x03\xa9\x89\xe4\ +\xfd\xb8\x65\x0b\xef\xc5\x1b\x57\x48\x57\x77\xa6\xda\xa1\xbf\x8e\ +\x82\x7b\xa7\x3e\x0c\x42\x1f\x1b\x9f\xc7\x31\xd1\x87\xc1\x06\xff\ +\xbc\x6d\xac\x0a\xa2\xde\x7f\xb9\x8d\xab\x01\x1c\x63\x23\x31\xa3\ +\xe8\x38\xf6\x98\x2b\xf9\x78\x0c\x29\xe8\x91\x4a\x7c\x8f\x15\x0b\ +\xe8\x5e\x3d\x22\x25\x3e\xa1\xc0\x77\xae\xad\x4c\xf4\x37\x4f\xa6\ +\xc7\x68\x60\x5c\xba\x40\x44\x27\x26\xab\xce\x55\xa8\x6e\xb3\x7c\ +\x60\x2b\x61\x29\x44\x3d\x9b\xd7\xcb\x2d\xb3\x96\xca\xdf\x6c\x9d\ +\xa9\xfb\x64\x7f\xfe\x61\x96\xfa\x32\xab\xb7\xdf\x2b\xbe\xcd\xc2\ +\x6a\x76\x53\x51\x40\x84\xa4\xb1\x66\xd9\xba\xb6\xed\x27\xbb\x35\ +\x75\x5b\x8b\xd4\x99\x47\x61\xf7\xa1\x82\xe3\xf7\x87\x75\x71\x01\ +\xf3\x7d\x51\xde\xed\xad\x13\xe5\x9d\xdd\x7e\x45\xdd\x56\x77\xa1\ +\xba\xab\x51\x2e\x37\x41\xee\xe0\x8c\xba\x1b\xff\x02\x13\xcc\x10\ +\x82\ \x00\x00\x07\x4c\ \x00\ \x00\x29\xd1\x78\x9c\xed\x59\x5b\x8f\xe2\x46\x16\x7e\xef\x5f\xe1\ @@ -10081,30 +10099,30 @@ qt_resource_struct = "\ \x00\x00\x00\x86\x00\x00\x00\x00\x00\x01\x00\x00\x3e\x30\ \x00\x00\x01\x70\x00\x00\x00\x00\x00\x01\x00\x01\x08\x08\ \x00\x00\x00\x38\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x2f\xb8\ -\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf1\xe9\ -\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa3\x77\ -\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5b\x4a\ -\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x28\xe6\ -\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb1\xe6\ -\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc5\x6d\ -\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x88\xd7\ -\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0b\xc3\ -\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x7f\xde\ -\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbb\x3e\ -\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x6f\x36\ -\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x78\xde\ -\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1b\x31\ -\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe1\x68\ -\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x20\x81\ -\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x36\x93\ -\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xca\x84\ -\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x52\xd0\ -\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x48\x96\ -\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x05\xab\ -\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x91\x19\ -\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd2\x6c\ -\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x67\xe6\ +\x00\x00\x05\x12\x00\x01\x00\x00\x00\x01\x00\x02\x30\xce\ +\x00\x00\x04\x1e\x00\x00\x00\x00\x00\x01\x00\x01\xf2\xff\ +\x00\x00\x02\xfc\x00\x00\x00\x00\x00\x01\x00\x01\xa4\x8d\ +\x00\x00\x05\xb2\x00\x01\x00\x00\x00\x01\x00\x02\x5c\x60\ +\x00\x00\x04\xe4\x00\x01\x00\x00\x00\x01\x00\x02\x29\xfc\ +\x00\x00\x03\x36\x00\x01\x00\x00\x00\x01\x00\x01\xb2\xfc\ +\x00\x00\x03\x88\x00\x01\x00\x00\x00\x01\x00\x01\xc6\x83\ +\x00\x00\x02\xa0\x00\x01\x00\x00\x00\x01\x00\x01\x89\xed\ +\x00\x00\x04\x5e\x00\x00\x00\x00\x00\x01\x00\x02\x0c\xd9\ +\x00\x00\x02\x7e\x00\x01\x00\x00\x00\x01\x00\x01\x80\xf4\ +\x00\x00\x03\x64\x00\x01\x00\x00\x00\x01\x00\x01\xbc\x54\ +\x00\x00\x02\x34\x00\x01\x00\x00\x00\x01\x00\x01\x70\x4c\ +\x00\x00\x02\x5e\x00\x01\x00\x00\x00\x01\x00\x01\x79\xf4\ +\x00\x00\x04\x8e\x00\x01\x00\x00\x00\x01\x00\x02\x1c\x47\ +\x00\x00\x03\xf4\x00\x00\x00\x00\x00\x01\x00\x01\xe2\x7e\ +\x00\x00\x04\xbc\x00\x01\x00\x00\x00\x01\x00\x02\x21\x97\ +\x00\x00\x05\x3c\x00\x00\x00\x00\x00\x01\x00\x02\x37\xa9\ +\x00\x00\x03\xac\x00\x01\x00\x00\x00\x01\x00\x01\xcb\x9a\ +\x00\x00\x05\x86\x00\x01\x00\x00\x00\x01\x00\x02\x53\xe6\ +\x00\x00\x05\x66\x00\x01\x00\x00\x00\x01\x00\x02\x49\xac\ +\x00\x00\x04\x3e\x00\x01\x00\x00\x00\x01\x00\x02\x06\xc1\ +\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x01\x92\x2f\ +\x00\x00\x03\xd6\x00\x00\x00\x00\x00\x01\x00\x01\xd3\x82\ +\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x01\x68\xfc\ \x00\x00\x01\xd8\x00\x01\x00\x00\x00\x01\x00\x01\x61\x46\ " diff --git a/src/Mod/Arch/Resources/ui/archprefs-base.ui b/src/Mod/Arch/Resources/ui/archprefs-base.ui index cbfe9d49f..4d1ad8bdd 100644 --- a/src/Mod/Arch/Resources/ui/archprefs-base.ui +++ b/src/Mod/Arch/Resources/ui/archprefs-base.ui @@ -164,14 +164,7 @@ p, li { white-space: pre-wrap; } - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For the IFC reader to function, you need an IFC Schema Express file (.exp) </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">available <a href="http://www.steptools.com/support/stdev_docs/express/ifc2x3/ifc2x3_tc1.exp"><span style=" text-decoration: underline; color:#508ed8;">here. </span></a>For licensing reasons we are not allowed to ship that file </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">with FreeCAD, so you must download it yourself. Place that file in some</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">location on your computer, and select the file here.</p></body></html> + For the IFC reader to function, you need an IFC Schema Express file (.exp). For licensing reasons we are not allowed to ship that file with FreeCAD, so you must download it yourself. Place that file in some location on your computer, and select the file here. IfcSchema @@ -186,9 +179,18 @@ p, li { white-space: pre-wrap; } - + + + If this is checked, ifcopenshell will be used to create meshes instead of Arch objects + - Path to IfcOpenShell + Use IfcOpenShell + + + useIfcOpenShell + + + Mod/Arch @@ -205,8 +207,24 @@ p, li { white-space: pre-wrap; } + + + + false + + + Path to IfcOpenShell + + + + + false + + + If you have ifcopenshell installed, specify here the path to IfcImport.py + ifcopenshell @@ -258,7 +276,45 @@ p, li { white-space: pre-wrap; } Gui::ColorButton
Gui/PrefWidgets.h
+ + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
- + + + gui::prefcheckbox + toggled(bool) + label_5 + setEnabled(bool) + + + 79 + 191 + + + 376 + 192 + + + + + gui::prefcheckbox + toggled(bool) + gui::preffilechooser_2 + setEnabled(bool) + + + 61 + 191 + + + 465 + 201 + + + + diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index fd099e79a..bbca0e2b1 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -36,7 +36,12 @@ def open(filename): doc = FreeCAD.newDocument(docname) doc.Label = decode(docname) FreeCAD.ActiveDocument = doc - read(filename) + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch") + p = p.GetBool("useIfcOpenShell") + if p: + readOpenShell(filename) + else: + read(filename) return doc def decode(name): @@ -78,10 +83,39 @@ def getIfcOpenShell(): print "Couldn't import IfcOpenShell" def readOpenShell(filename): + import Mesh getIfcOpenShell() if IfcOpenShell: IfcOpenShell.Init(filename) - return IfcOpenShell.Get() + while True: + obj = IfcOpenShell.Get() + print "parsing ",obj.guid,": ",obj.name," of type ",obj.type + meshdata = [] + n = obj.name + if not n: n = "Unnamed" + f = obj.mesh.faces + v = obj.mesh.verts + m = obj.matrix + print "verts: ",len(v)," faces: ",len(f) + mat = FreeCAD.Matrix(m[0], m[1], m[2], 0, + m[3], m[4], m[5], 0, + m[6], m[7], m[8], 0, + m[9], m[10], m[11], 1) + for i in range(0, len(f), 3): + print "face ",f[i],f[i+1],f[i+2] + face = [] + print "i:",i + for j in range(3): + vi = f[i+j]*3 + print "vi:",vi + face.append([v[vi],v[vi+1],v[vi+2]]) + meshdata.append(face) + newmesh = Mesh.Mesh(meshdata) + mobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n) + mobj.Mesh = newmesh + mobj.Placement = FreeCAD.Placement(mat) + if not IfcOpenShell.Next(): + break return None def read(filename): From 649abff877a4abf6d38fe4786a4d6a9bb7622a8f Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sat, 7 Jan 2012 13:39:50 -0200 Subject: [PATCH 12/12] small fixes to draft SVG import (shoogen) --- src/Mod/Draft/importSVG.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index ae560f138..a45c3b5bf 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -601,8 +601,8 @@ class svgHandler(xml.sax.ContentHandler): else: currentvec = Vector(point[2],-point[3],0) pole2 = Vector(point[0],-point[1],0) - if lastpole: - pole1 = lastvec.sub(lastpole).add(lastvec) + if lastpole is not None and lastpole[0]=='cubic': + pole1 = lastvec.sub(lastpole[1]).add(lastvec) else: pole1 = lastvec else: #not smooth @@ -630,7 +630,7 @@ class svgHandler(xml.sax.ContentHandler): seg = b.toShape() print "connect ",lastvec,currentvec lastvec = currentvec - lastpole = pole2 + lastpole = ('cubic',pole2) path.append(seg) point = [] @@ -640,8 +640,8 @@ class svgHandler(xml.sax.ContentHandler): currentvec = lastvec.add(Vector(point[0],-point[1],0)) else: currentvec = Vector(point[0],-point[1],0) - if lastpole: - pole1 = lastvec.sub(lastpole).add(lastvec) + if lastpole is not None and lastpole[0]=='quadratic': + pole1 = lastvec.sub(lastpole[1]).add(lastvec) else: pole1 = lastvec else: #not smooth @@ -663,7 +663,7 @@ class svgHandler(xml.sax.ContentHandler): seg = b.toShape() print "connect ",lastvec,currentvec lastvec = currentvec - lastpole = pole1 + lastpole = ('quadratic',pole1) path.append(seg) point = []