Merge branch 'master' into HEAD
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5389 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
f3b9ee8e9a
commit
ef4ce7f407
0
src/Mod/Arch/ArchWall.py
Executable file → Normal file
0
src/Mod/Arch/ArchWall.py
Executable file → Normal file
0
src/Mod/Arch/Init.py
Executable file → Normal file
0
src/Mod/Arch/Init.py
Executable file → Normal file
148
src/Mod/Arch/InitGui.py
Executable file → Normal file
148
src/Mod/Arch/InitGui.py
Executable file → Normal file
|
@ -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)
|
||||
|
||||
|
|
0
src/Mod/Arch/ifcReader.py
Executable file → Normal file
0
src/Mod/Arch/ifcReader.py
Executable file → Normal file
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
@ -796,11 +795,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)
|
||||
_ViewProviderDraft(obj.ViewObject)
|
||||
_Clone(obj)
|
||||
_ViewProviderDraftPart(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()
|
||||
|
@ -1318,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
|
||||
|
@ -1371,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:
|
||||
|
@ -2263,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"
|
||||
|
||||
|
@ -2310,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",
|
||||
|
@ -2333,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)
|
||||
|
@ -2348,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
|
||||
|
@ -2371,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)
|
||||
|
||||
|
@ -2422,25 +2438,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,19 +2463,23 @@ 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)
|
||||
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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
0
src/Mod/Draft/DraftTools.py
Executable file → Normal file
0
src/Mod/Draft/DraftTools.py
Executable file → Normal file
|
@ -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"
|
||||
|
|
0
src/Mod/Draft/importAirfoilDAT.py
Executable file → Normal file
0
src/Mod/Draft/importAirfoilDAT.py
Executable file → Normal file
|
@ -242,6 +242,7 @@ class svgHandler(xml.sax.ContentHandler):
|
|||
self.grouptransform = []
|
||||
self.lastdim = None
|
||||
|
||||
global Part
|
||||
import Part
|
||||
|
||||
if gui and draftui:
|
||||
|
@ -561,15 +562,15 @@ 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)
|
||||
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:
|
||||
|
|
0
src/Mod/Draft/macros.py
Executable file → Normal file
0
src/Mod/Draft/macros.py
Executable file → Normal file
Loading…
Reference in New Issue
Block a user