diff --git a/src/Mod/AddonManager/Resources/AddonManager.qrc b/src/Mod/AddonManager/Resources/AddonManager.qrc
index 16ecfad3a7..bc096a2de0 100644
--- a/src/Mod/AddonManager/Resources/AddonManager.qrc
+++ b/src/Mod/AddonManager/Resources/AddonManager.qrc
@@ -15,6 +15,7 @@
icons/CurvedShapes_workbench_icon.svg
icons/Curves_workbench_icon.svg
icons/Defeaturing_workbench_icon.svg
+ icons/DesignSPHysics_workbench_icon.svg
icons/dodo_workbench_icon.svg
icons/DynamicData_workbench_icon.svg
icons/EM_workbench_icon.svg
diff --git a/src/Mod/AddonManager/Resources/icons/DesignSPHysics_workbench_icon.svg b/src/Mod/AddonManager/Resources/icons/DesignSPHysics_workbench_icon.svg
new file mode 100644
index 0000000000..de9106a89e
--- /dev/null
+++ b/src/Mod/AddonManager/Resources/icons/DesignSPHysics_workbench_icon.svg
@@ -0,0 +1,197 @@
+
+
diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py
index 830a6328ae..38ea137199 100644
--- a/src/Mod/Arch/ArchSectionPlane.py
+++ b/src/Mod/Arch/ArchSectionPlane.py
@@ -1133,6 +1133,19 @@ class _ViewProviderSectionPlane:
self.setEdit(vobj,None)
+ def setupContextMenu(self,vobj,menu):
+ """CONTEXT MENU setup"""
+ from PySide import QtCore,QtGui
+ action1 = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Edit.svg"),"Toggle Cutview",menu)
+ action1.triggered.connect(lambda f=self.contextCutview, arg=vobj:f(arg))
+ menu.addAction(action1)
+
+ def contextCutview(self,vobj):
+ """CONTEXT MENU command to toggle CutView property on and off"""
+ if vobj.CutView:
+ vobj.CutView = False
+ else: vobj.CutView = True
+
class _ArchDrawingView:
diff --git a/src/Mod/Draft/DraftEdit.py b/src/Mod/Draft/DraftEdit.py
index afb5c7d4b7..53ac0e24af 100644
--- a/src/Mod/Draft/DraftEdit.py
+++ b/src/Mod/Draft/DraftEdit.py
@@ -41,6 +41,20 @@ if FreeCAD.GuiUp:
from PySide import QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
from DraftTools import translate
+
+ COLORS = {
+ "default": FreeCADGui.draftToolBar.getDefaultColor("snap"),
+ "black": (0., 0., 0.),
+ "white": (1., 1., 1.),
+ "grey": (.5, .5, .5),
+ "red": (1., 0., 0.),
+ "green": (0., 1., 0.),
+ "blue": (0., 0., 1.),
+ "yellow": (1., 1., 0.),
+ "cyan": (0., 1., 1.),
+ "magenta":(1., 0., 1.)
+ }
+
class Edit():
@@ -49,6 +63,7 @@ class Edit():
def __init__(self):
self.running = False
self.trackers = {'object':[]}
+ self.overNode = None # preselected node with mouseover
self.obj = None
self.editing = None
@@ -271,8 +286,18 @@ class Edit():
if self.editing != None:
self.updateTrackerAndGhost(event)
else:
- # TODO add preselection color change for trackers
- pass
+ # look for a node in mouse position and highlight it
+ pos = event.getPosition()
+ node = self.getEditNode(pos)
+ ep = self.getEditNodeIndex(node)
+ if ep != None:
+ if self.overNode != None: self.overNode.setColor(COLORS["default"])
+ self.trackers[str(node.objectName.getValue())][ep].setColor(COLORS["red"])
+ self.overNode = self.trackers[str(node.objectName.getValue())][ep]
+ else:
+ if self.overNode != None:
+ self.overNode.setColor(COLORS["default"])
+ self.overNode = None
def startEditing(self, event):
"start editing selected EditNode"
diff --git a/src/Mod/Draft/DraftTrackers.py b/src/Mod/Draft/DraftTrackers.py
index 23495ace6e..e688425773 100644
--- a/src/Mod/Draft/DraftTrackers.py
+++ b/src/Mod/Draft/DraftTrackers.py
@@ -709,11 +709,11 @@ class editTracker(Tracker):
"""A node edit tracker"""
def __init__(self,pos=Vector(0,0,0),name=None,idx=0,objcol=None,\
marker=FreeCADGui.getMarkerIndex("quad", 9),inactive=False):
- color = coin.SoBaseColor()
+ self.color = coin.SoBaseColor()
if objcol:
- color.rgb = objcol[:3]
+ self.color.rgb = objcol[:3]
else:
- color.rgb = FreeCADGui.draftToolBar.getDefaultColor("snap")
+ self.color.rgb = FreeCADGui.draftToolBar.getDefaultColor("snap")
self.marker = coin.SoMarkerSet() # this is the marker symbol
self.marker.markerIndex = marker
self.coords = coin.SoCoordinate3() # this is the coordinate
@@ -729,7 +729,7 @@ class editTracker(Tracker):
selnode.subElementName.setValue("EditNode"+str(idx))
node = coin.SoAnnotation()
selnode.addChild(self.coords)
- selnode.addChild(color)
+ selnode.addChild(self.color)
selnode.addChild(self.marker)
node.addChild(selnode)
ontop = not inactive
@@ -746,6 +746,12 @@ class editTracker(Tracker):
def move(self,delta):
self.set(self.get().add(delta))
+ def setColor(self,color):
+ if color:
+ self.color.rgb = color
+ else:
+ self.color.rgb = FreeCADGui.draftToolBar.getDefaultColor("snap")
+
class PlaneTracker(Tracker):
"""A working plane tracker"""
def __init__(self):
diff --git a/src/Mod/Draft/Resources/icons/Draft_Clone.svg b/src/Mod/Draft/Resources/icons/Draft_Clone.svg
index 5e09edde2d..7e20c43c4a 100644
--- a/src/Mod/Draft/Resources/icons/Draft_Clone.svg
+++ b/src/Mod/Draft/Resources/icons/Draft_Clone.svg
@@ -16,7 +16,7 @@
height="64"
viewBox="0 0 63.999999 64"
sodipodi:docname="Draft_Clone.svg"
- inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="C:\Users\Rafael\bitmap.png"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300">
@@ -28,12 +28,24 @@
image/svg+xml
-
+
+
+
+
+
@@ -137,13 +149,13 @@
y2="31.812008" />
+ x1="21.974438"
+ y1="29.822496"
+ x2="52.530876"
+ y2="35.507179" />
@@ -225,7 +237,7 @@
transform="matrix(1.0609942,0,0,1.0609942,-1.9456602,-1.9888296)">
+
+
+
+
diff --git a/src/Mod/Draft/getSVG.py b/src/Mod/Draft/getSVG.py
index faea430ec7..b872bd6749 100644
--- a/src/Mod/Draft/getSVG.py
+++ b/src/Mod/Draft/getSVG.py
@@ -399,6 +399,11 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
if plane.axis.getAngle(angle.Axis) < 0.001:
angle = angle.Angle
elif abs(plane.axis.getAngle(angle.Axis)-math.pi) < 0.001:
+ if abs(angle.Angle) > 0.1:
+ angle = -angle.Angle
+ else:
+ angle = angle.Angle
+ elif abs(plane.axis.getAngle(angle.Axis)-math.pi/2) < 0.001:
return "" # text is perpendicular to view, so it shouldn't appear
else:
angle = 0 #TODO maybe there is something better to do here?
@@ -501,8 +506,15 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
angle = -DraftVecUtils.angle(getProj(rv, plane))
#angle = -DraftVecUtils.angle(p3.sub(p2))
+ svg = ''
+ nolines = False
+ if hasattr(obj.ViewObject,"ShowLine"):
+ if not obj.ViewObject.ShowLine:
+ nolines = True
+
# drawing lines
- svg = ' math.pi/2:
@@ -515,51 +527,54 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
if abs(tangle+math.radians(rotation)) < 0.0001:
tangle += math.pi
tbase = tbase.add(DraftVecUtils.rotate(Vector(0,2/scale,0),tangle))
- svg += 'd="M '+str(p1.x)+' '+str(p1.y)+' '
- svg += 'L '+str(p2.x)+' '+str(p2.y)+' '
- svg += 'L '+str(p3.x)+' '+str(p3.y)+' '
- svg += 'L '+str(p4.x)+' '+str(p4.y)+'" '
+ if not nolines:
+ svg += 'd="M '+str(p1.x)+' '+str(p1.y)+' '
+ svg += 'L '+str(p2.x)+' '+str(p2.y)+' '
+ svg += 'L '+str(p3.x)+' '+str(p3.y)+' '
+ svg += 'L '+str(p4.x)+' '+str(p4.y)+'" '
else:
tangle = 0
if rotation != 0:
tangle = -math.radians(rotation)
tbase = tbase.add(Vector(0,-2.0/scale,0))
- svg += 'd="M '+str(p1.x)+' '+str(p1.y)+' '
- svg += 'L '+str(p2.x)+' '+str(p2.y)+' '
- svg += 'L '+str(p2a.x)+' '+str(p2a.y)+' '
- svg += 'M '+str(p2b.x)+' '+str(p2b.y)+' '
- svg += 'L '+str(p3.x)+' '+str(p3.y)+' '
- svg += 'L '+str(p4.x)+' '+str(p4.y)+'" '
+ if not nolines:
+ svg += 'd="M '+str(p1.x)+' '+str(p1.y)+' '
+ svg += 'L '+str(p2.x)+' '+str(p2.y)+' '
+ svg += 'L '+str(p2a.x)+' '+str(p2a.y)+' '
+ svg += 'M '+str(p2b.x)+' '+str(p2b.y)+' '
+ svg += 'L '+str(p3.x)+' '+str(p3.y)+' '
+ svg += 'L '+str(p4.x)+' '+str(p4.y)+'" '
- svg += 'fill="none" stroke="'
- svg += stroke + '" '
- svg += 'stroke-width="' + str(linewidth) + ' px" '
- svg += 'style="stroke-width:'+ str(linewidth)
- svg += ';stroke-miterlimit:4;stroke-dasharray:none" '
- svg += 'freecad:basepoint1="'+str(p1.x)+' '+str(p1.y)+'" '
- svg += 'freecad:basepoint2="'+str(p4.x)+' '+str(p4.y)+'" '
- svg += 'freecad:dimpoint="'+str(p2.x)+' '+str(p2.y)+'"'
- svg += '/>\n'
+ if not nolines:
+ svg += 'fill="none" stroke="'
+ svg += stroke + '" '
+ svg += 'stroke-width="' + str(linewidth) + ' px" '
+ svg += 'style="stroke-width:'+ str(linewidth)
+ svg += ';stroke-miterlimit:4;stroke-dasharray:none" '
+ svg += 'freecad:basepoint1="'+str(p1.x)+' '+str(p1.y)+'" '
+ svg += 'freecad:basepoint2="'+str(p4.x)+' '+str(p4.y)+'" '
+ svg += 'freecad:dimpoint="'+str(p2.x)+' '+str(p2.y)+'"'
+ svg += '/>\n'
- # drawing dimension and extension lines overshoots
- if hasattr(obj.ViewObject,"DimOvershoot") and obj.ViewObject.DimOvershoot.Value:
- shootsize = obj.ViewObject.DimOvershoot.Value/pointratio
- svg += getOvershoot(p2,shootsize,stroke,linewidth,angle)
- svg += getOvershoot(p3,shootsize,stroke,linewidth,angle+math.pi)
- if hasattr(obj.ViewObject,"ExtOvershoot") and obj.ViewObject.ExtOvershoot.Value:
- shootsize = obj.ViewObject.ExtOvershoot.Value/pointratio
- shootangle = -DraftVecUtils.angle(p1.sub(p2))
- svg += getOvershoot(p2,shootsize,stroke,linewidth,shootangle)
- svg += getOvershoot(p3,shootsize,stroke,linewidth,shootangle)
+ # drawing dimension and extension lines overshoots
+ if hasattr(obj.ViewObject,"DimOvershoot") and obj.ViewObject.DimOvershoot.Value:
+ shootsize = obj.ViewObject.DimOvershoot.Value/pointratio
+ svg += getOvershoot(p2,shootsize,stroke,linewidth,angle)
+ svg += getOvershoot(p3,shootsize,stroke,linewidth,angle+math.pi)
+ if hasattr(obj.ViewObject,"ExtOvershoot") and obj.ViewObject.ExtOvershoot.Value:
+ shootsize = obj.ViewObject.ExtOvershoot.Value/pointratio
+ shootangle = -DraftVecUtils.angle(p1.sub(p2))
+ svg += getOvershoot(p2,shootsize,stroke,linewidth,shootangle)
+ svg += getOvershoot(p3,shootsize,stroke,linewidth,shootangle)
- # drawing arrows
- if hasattr(obj.ViewObject,"ArrowType"):
- arrowsize = obj.ViewObject.ArrowSize.Value/pointratio
- if hasattr(obj.ViewObject,"FlipArrows"):
- if obj.ViewObject.FlipArrows:
- angle = angle+math.pi
- svg += getArrow(obj.ViewObject.ArrowType,p2,arrowsize,stroke,linewidth,angle)
- svg += getArrow(obj.ViewObject.ArrowType,p3,arrowsize,stroke,linewidth,angle+math.pi)
+ # drawing arrows
+ if hasattr(obj.ViewObject,"ArrowType"):
+ arrowsize = obj.ViewObject.ArrowSize.Value/pointratio
+ if hasattr(obj.ViewObject,"FlipArrows"):
+ if obj.ViewObject.FlipArrows:
+ angle = angle+math.pi
+ svg += getArrow(obj.ViewObject.ArrowType,p2,arrowsize,stroke,linewidth,angle)
+ svg += getArrow(obj.ViewObject.ArrowType,p3,arrowsize,stroke,linewidth,angle+math.pi)
# drawing text
svg += getText(stroke,fontsize,obj.ViewObject.FontName,tangle,tbase,prx.string)
diff --git a/src/Mod/OpenSCAD/InitGui.py b/src/Mod/OpenSCAD/InitGui.py
index 229c403355..16335a0d0e 100644
--- a/src/Mod/OpenSCAD/InitGui.py
+++ b/src/Mod/OpenSCAD/InitGui.py
@@ -29,8 +29,7 @@
#***************************************************************************/
import FreeCAD
-param = FreeCAD.ParamGet(\
- "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
+param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
openscadfilename = param.GetString('openscadexecutable')
@@ -39,26 +38,26 @@ class OpenSCADWorkbench ( Workbench ):
def __init__(self):
self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/OpenSCAD/Resources/icons/OpenSCADWorkbench.svg"
self.__class__.MenuText = "OpenSCAD"
- self.__class__.ToolTip = "OpenSCAD workbench"
+ self.__class__.ToolTip = "OpenSCAD is an application for creating solid 3D CAD." + '\n' +
+ "FreeCAD utizes OpenSCAD's capability as a script-only based modeller that uses its own description language" + '\n' +
+ "Note: the Mesh workbench heavily uses the boolean operations of this workbench because they are quite robust"
def Initialize(self):
def QT_TRANSLATE_NOOP(scope, text):
return text
import OpenSCAD_rc,OpenSCADCommands
- commands=['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',\
- 'OpenSCAD_RefineShapeFeature',\
- 'OpenSCAD_IncreaseToleranceFeature', 'OpenSCAD_Edgestofaces', \
- 'OpenSCAD_ExpandPlacements','OpenSCAD_ExplodeGroup']
- toolbarcommands=['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',\
- 'OpenSCAD_ExplodeGroup','OpenSCAD_RefineShapeFeature']
- #'OpenSCAD_IncreaseToleranceFeature' #icon still missing
+ commands = ['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',
+ 'OpenSCAD_RefineShapeFeature','OpenSCAD_IncreaseToleranceFeature',
+ 'OpenSCAD_Edgestofaces', 'OpenSCAD_ExpandPlacements','OpenSCAD_ExplodeGroup']
+ toolbarcommands = ['OpenSCAD_ReplaceObject','OpenSCAD_RemoveSubtree',
+ 'OpenSCAD_ExplodeGroup','OpenSCAD_RefineShapeFeature',
+ 'OpenSCAD_IncreaseToleranceFeature']
import PartGui
- parttoolbarcommands = ['Part_CheckGeometry',"Part_Primitives",\
- "Part_Builder",'Part_Cut','Part_Fuse','Part_Common',\
- 'Part_Extrude',"Part_Revolve"]
+ parttoolbarcommands = ['Part_CheckGeometry','Part_Primitives',
+ 'Part_Builder','Part_Cut','Part_Fuse','Part_Common',
+ 'Part_Extrude','Part_Revolve']
import FreeCAD
- param = FreeCAD.ParamGet(\
- "User parameter:BaseApp/Preferences/Mod/OpenSCAD")
+ param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
openscadfilename = param.GetString('openscadexecutable')
if not openscadfilename:
@@ -68,10 +67,11 @@ class OpenSCADWorkbench ( Workbench ):
FreeCAD.addImportType("OpenSCAD Format (*.scad)","importCSG")
param.SetString('openscadexecutable',openscadfilename) #save the result
if openscadfilename:
- commands.extend(['OpenSCAD_AddOpenSCADElement',
- 'OpenSCAD_MeshBoolean','OpenSCAD_Hull','OpenSCAD_Minkowski'])
- toolbarcommands.extend(['OpenSCAD_AddOpenSCADElement',
- 'OpenSCAD_MeshBoolean','OpenSCAD_Hull','OpenSCAD_Minkowski'])
+ commands.extend(['OpenSCAD_AddOpenSCADElement', 'OpenSCAD_MeshBoolean',
+ 'OpenSCAD_Hull','OpenSCAD_Minkowski'])
+
+ toolbarcommands.extend(['OpenSCAD_AddOpenSCADElement', 'OpenSCAD_MeshBoolean',
+ 'OpenSCAD_Hull','OpenSCAD_Minkowski'])
else:
FreeCAD.Console.PrintWarning('OpenSCAD executable not found\n')
diff --git a/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py b/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py
index e89e5e5d66..378eea52fb 100644
--- a/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py
+++ b/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py
@@ -22,7 +22,7 @@
__title__="FreeCAD OpenSCAD Workbench - 2D helper functions"
__author__ = "Sebastian Hoogen"
-__url__ = ["http://www.freecadweb.org"]
+__url__ = ["https://www.freecadweb.org"]
'''
This Script includes python functions to convert imported dxf geometry to Faces
diff --git a/src/Mod/OpenSCAD/OpenSCADCommands.py b/src/Mod/OpenSCAD/OpenSCADCommands.py
index 99b8b093e4..30f45add66 100644
--- a/src/Mod/OpenSCAD/OpenSCADCommands.py
+++ b/src/Mod/OpenSCAD/OpenSCADCommands.py
@@ -22,7 +22,7 @@
__title__="FreeCAD OpenSCAD Workbench - GUI Commands"
__author__ = "Sebastian Hoogen"
-__url__ = ["http://www.freecadweb.org"]
+__url__ = ["https://www.freecadweb.org"]
'''
This Script includes the GUI Commands of the OpenSCAD module
@@ -53,11 +53,10 @@ class ExplodeGroup:
return f1 == f2
else:
return abs((f1-f2)/f1) < 2**-24
- scol=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View")\
- .GetUnsigned('DefaultShapeColor',0xccccccff)
- defaultcolor = (((scol >> 24) & 0xff) / 255.0,\
- ((scol >> 16) & 0xff) / 255.0,\
- ((scol >> 8) & 0xff) / 255.0, 0.0)
+ scol=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned('DefaultShapeColor',0xccccccff)
+ defaultcolor = (((scol >> 24) & 0xff) / 255.0,
+ ((scol >> 16) & 0xff) / 255.0,
+ ((scol >> 8) & 0xff) / 255.0, 0.0)
return all(all(comparefloat(fcc,dcc) for fcc,dcc in \
zip(facecolor,defaultcolor)) for facecolor in shapecolor)
@@ -92,19 +91,16 @@ class ExplodeGroup:
else:
oo.ViewObject.DiffuseColor=color
else:
- FreeCAD.Console.PrintError(translate('OpenSCAD',\
- 'Unable to explode %s') % obj.Name +u'\n')
+ FreeCAD.Console.PrintError(translate('OpenSCAD', 'Unable to explode %s') % obj.Name +u'\n')
for obj in FreeCADGui.Selection.getSelection():
if len(obj.InList) == 0: # allowed only for for top level objects
explode(obj)
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_Explode_Group', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ExplodeGroup',\
- 'Explode Group'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ExplodeGroup',\
- 'Remove fusion, apply placement to children, and color randomly')}
+ return {'Pixmap' : 'OpenSCAD_Explode_Group',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ExplodeGroup', 'Explode Group'),
+ 'ToolTip': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ExplodeGroup', 'Remove fusion, apply placement to children, and color randomly')}
class ColorCodeShape:
"Change the Color of selected or all Shapes based on their validity"
@@ -118,11 +114,9 @@ class ColorCodeShape:
objs=FreeCAD.ActiveDocument.Objects
colorcodeshapes.colorcodeshapes(objs)
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_ColorCodeShape', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ColorCodeShape',\
- 'Color Shapes'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ColorCodeShape',\
- 'Color Shapes by validity and type')}
+ return {'Pixmap' : 'OpenSCAD_ColorCodeShape',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ColorCodeShape', 'Color Shapes'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ColorCodeShape', 'Color Shapes by validity and type')}
class Edgestofaces:
def IsActive(self):
@@ -140,10 +134,9 @@ class Edgestofaces:
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap' : 'Python', 'MenuText': QtCore.QT_TRANSLATE_NOOP(\
- 'OpenSCAD_Edgestofaces','Convert Edges To Faces'),
- 'ToolTip': QtCore.QT_TRANSLATE_NOOP('OpenSCAD',\
- 'Convert Edges to Faces')}
+ return {'Pixmap' : 'Python',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Edgestofaces', 'Convert Edges To Faces'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD', 'Convert Edges to Faces')}
class RefineShapeFeature:
def IsActive(self):
@@ -160,11 +153,9 @@ class RefineShapeFeature:
selobj.Object.ViewObject.hide()
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_RefineShapeFeature', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RefineShapeFeature',\
- 'Refine Shape Feature'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RefineShapeFeature',\
- 'Create Refine Shape Feature')}
+ return {'Pixmap' : 'OpenSCAD_RefineShapeFeature',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RefineShapeFeature', 'Refine Shape Feature'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RefineShapeFeature', 'Create Refine Shape Feature')}
class IncreaseToleranceFeature:
def IsActive(self):
@@ -181,12 +172,9 @@ class IncreaseToleranceFeature:
selobj.Object.ViewObject.hide()
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_IncreaseToleranceFeature', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_IncreaseToleranceFeature',\
- 'Increase Tolerance Feature'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_IncreaseToleranceFeature',\
- 'Create Feature that allows to increase the tolerance')}
-
+ return {'Pixmap' : 'OpenSCAD_IncreaseToleranceFeature',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_IncreaseToleranceFeature', 'Increase Tolerance Feature'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_IncreaseToleranceFeature', 'Create Feature that allows to increase the tolerance')}
class ExpandPlacements:
'''This should aid interactive repair in the future
@@ -201,10 +189,9 @@ class ExpandPlacements:
expandplacements.expandplacements(selobj.Object,FreeCAD.Placement())
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap' : 'Python', 'MenuText': QtCore.QT_TRANSLATE_NOOP(\
- 'OpenSCAD_ExpandPlacements','Expand Placements'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ExpandPlacements',\
- 'Expand all placements downwards the FeatureTree')}
+ return {'Pixmap' : 'Python',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ExpandPlacements', 'Expand Placements'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ExpandPlacements', 'Expand all placements downwards the FeatureTree')}
class ReplaceObject:
def IsActive(self):
@@ -221,15 +208,11 @@ class ReplaceObject:
tuple((len(obj.InList)) for obj in objs) in ((0,1),(1,0)):
replaceobj.replaceobjfromselection(objs)
else:
- FreeCAD.Console.PrintError(translate('OpenSCAD',\
- 'Please select 3 objects first')+u'\n')
+ FreeCAD.Console.PrintError(translate('OpenSCAD', 'Please select 3 objects first')+u'\n')
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_ReplaceObject', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ReplaceObject',\
- 'Replace Object'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ReplaceObject',\
- 'Replace an object in the Feature Tree. Please select old, new, and parent object')}
-
+ return {'Pixmap' : 'OpenSCAD_ReplaceObject',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ReplaceObject', 'Replace Object'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_ReplaceObject', 'Replace an object in the Feature Tree. Please select old, new, and parent object')}
class RemoveSubtree:
def IsActive(self):
@@ -239,11 +222,9 @@ class RemoveSubtree:
OpenSCADUtils.removesubtree(FreeCADGui.Selection.getSelection())
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_RemoveSubtree', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RemoveSubtree',\
- 'Remove Objects and their Children'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RemoveSubtree',\
- 'Removes the selected objects and all children that are not referenced from other objects')}
+ return {'Pixmap' : 'OpenSCAD_RemoveSubtree',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RemoveSubtree', 'Remove Objects and their Children'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_RemoveSubtree', 'Removes the selected objects and all children that are not referenced from other objects')}
class AddSCADWidget(QtGui.QWidget):
def __init__(self,*args):
@@ -382,11 +363,10 @@ class AddOpenSCADElement:
panel = AddSCADTask()
FreeCADGui.Control.showDialog(panel)
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_AddOpenSCADElement', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_AddOpenSCADElement',\
- 'Add OpenSCAD Element...'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_AddOpenSCADElement',\
- 'Add an OpenSCAD element by entering OpenSCAD code and executing the OpenSCAD binary')}
+ return {'Pixmap' : 'OpenSCAD_AddOpenSCADElement',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_AddOpenSCADElement', 'Add OpenSCAD Element...'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_AddOpenSCADElement',
+ 'Add an OpenSCAD element by entering OpenSCAD code and executing the OpenSCAD binary')}
class OpenSCADMeshBoolean:
def IsActive(self):
@@ -396,11 +376,10 @@ class OpenSCADMeshBoolean:
panel = OpenSCADMeshBooleanTask()
FreeCADGui.Control.showDialog(panel)
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_MeshBooleans', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_MeshBoolean',\
- 'Mesh Boolean...'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_MeshBoolean',\
- 'Export objects as meshes and use OpenSCAD to perform a boolean operation')}
+ return {'Pixmap' : 'OpenSCAD_MeshBooleans',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_MeshBoolean','Mesh Boolean...'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_MeshBoolean',
+ 'Export objects as meshes and use OpenSCAD to perform a boolean operation')}
class Hull:
def IsActive(self):
@@ -417,11 +396,9 @@ class Hull:
importCSG.process_ObjectsViaOpenSCAD(FreeCAD.activeDocument(),objList,"hull")
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_Hull', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Hull',\
- 'Hull'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Hull',\
- 'Perform Hull')}
+ return {'Pixmap' : 'OpenSCAD_Hull',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Hull', 'Hull'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Hull', 'Perform Hull')}
class Minkowski:
def IsActive(self):
@@ -438,11 +415,9 @@ class Minkowski:
importCSG.process_ObjectsViaOpenSCAD(FreeCAD.activeDocument(),objList,"minkowski")
FreeCAD.ActiveDocument.recompute()
def GetResources(self):
- return {'Pixmap' : 'OpenSCAD_Minkowski', 'MenuText': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Minkowski',\
- 'Minkowski'), 'ToolTip': \
- QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Minkowski',\
- 'Perform Minkowski')}
+ return {'Pixmap' : 'OpenSCAD_Minkowski',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Minkowski', 'Minkowski'),
+ 'ToolTip' : QtCore.QT_TRANSLATE_NOOP('OpenSCAD_Minkowski', 'Perform Minkowski')}
FreeCADGui.addCommand('OpenSCAD_ColorCodeShape',ColorCodeShape())
FreeCADGui.addCommand('OpenSCAD_ExplodeGroup',ExplodeGroup())
diff --git a/src/Mod/OpenSCAD/OpenSCADFeatures.py b/src/Mod/OpenSCAD/OpenSCADFeatures.py
index 16e91c8d44..239ce5a197 100644
--- a/src/Mod/OpenSCAD/OpenSCADFeatures.py
+++ b/src/Mod/OpenSCAD/OpenSCADFeatures.py
@@ -22,7 +22,7 @@
__title__="FreeCAD OpenSCAD Workbench - Parametric Features"
__author__ = "Sebastian Hoogen"
-__url__ = ["http://www.freecadweb.org"]
+__url__ = ["https://www.freecadweb.org"]
try:
long
diff --git a/src/Mod/OpenSCAD/OpenSCADUtils.py b/src/Mod/OpenSCAD/OpenSCADUtils.py
index 50f73ad1b0..5069a2e922 100644
--- a/src/Mod/OpenSCAD/OpenSCADUtils.py
+++ b/src/Mod/OpenSCAD/OpenSCADUtils.py
@@ -22,7 +22,7 @@
__title__="FreeCAD OpenSCAD Workbench - Utility Functions"
__author__ = "Sebastian Hoogen"
-__url__ = ["http://www.freecadweb.org"]
+__url__ = ["https://www.freecadweb.org"]
'''
This Script includes various python helper functions that are shared across
@@ -70,9 +70,9 @@ def searchforopenscadexe():
return testpath
elif sys.platform == 'darwin':
ascript = (b'tell application "Finder"\n'
- b'POSIX path of (application file id "org.openscad.OpenSCAD"'
- b'as alias)\n'
- b'end tell')
+ b'POSIX path of (application file id "org.openscad.OpenSCAD"'
+ b'as alias)\n'
+ b'end tell')
p1=subprocess.Popen(['osascript','-'],stdin=subprocess.PIPE,\
stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout,stderr = p1.communicate(ascript)
@@ -488,7 +488,7 @@ def meshoponobjs(opname,inobjs):
def process2D_ObjectsViaOpenSCADShape(ObjList,Operation,doc):
import FreeCAD,importDXF
import os,tempfile
- # Mantis 3419
+ # https://www.freecadweb.org/tracker/view.php?id=3419
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
fn = params.GetInt('fnForImport',32)
fnStr = ",$fn=" + str(fn)
@@ -499,7 +499,7 @@ def process2D_ObjectsViaOpenSCADShape(ObjList,Operation,doc):
outputfilename=os.path.join(dir1,'%s.dxf' % next(tempfilenamegen))
importDXF.export([item],outputfilename,True,True)
filenames.append(outputfilename)
- # Mantis 3419
+ # https://www.freecadweb.org/tracker/view.php?id=3419
dxfimports = ' '.join("import(file = \"%s\" %s);" % \
#filename \
(os.path.split(filename)[1], fnStr) for filename in filenames)
diff --git a/src/Mod/OpenSCAD/colorcodeshapes.py b/src/Mod/OpenSCAD/colorcodeshapes.py
index 3edc7d9bd5..2aa64529f5 100644
--- a/src/Mod/OpenSCAD/colorcodeshapes.py
+++ b/src/Mod/OpenSCAD/colorcodeshapes.py
@@ -22,7 +22,7 @@
__title__="FreeCAD OpenSCAD Workbench - 2D helper functions"
__author__ = "Sebastian Hoogen"
-__url__ = ["http://www.freecadweb.org"]
+__url__ = ["https://www.freecadweb.org"]
'''
This Script includes python functions to find out the most basic shape type
diff --git a/src/Mod/OpenSCAD/expandplacements.py b/src/Mod/OpenSCAD/expandplacements.py
index b121f7e56a..33134b495b 100644
--- a/src/Mod/OpenSCAD/expandplacements.py
+++ b/src/Mod/OpenSCAD/expandplacements.py
@@ -22,7 +22,7 @@
__title__="FreeCAD OpenSCAD Workbench - expand placements and matrices functions"
__author__ = "Sebastian Hoogen"
-__url__ = ["http://www.freecadweb.org"]
+__url__ = ["https://www.freecadweb.org"]
'''
This Script includes python functions to shift all placements down the
@@ -99,7 +99,7 @@ def expandplacements(obj,placement):
elif obj.isDerivedFrom('Part::Mirroring'):
import OpenSCADUtils
mm = OpenSCADUtils.mirror2mat(obj.Normal,obj.Base)
- #todo: set the base to 0,0,0
+ #TODO: set the base to 0,0,0
innerp=FreeCAD.Placement(mm * ownplacement.toMatrix() *mm)
expandplacements(obj.Source,innerp)
obj.Placement=FreeCAD.Placement()
diff --git a/src/Mod/OpenSCAD/prototype.py b/src/Mod/OpenSCAD/prototype.py
index 6fc69f2b65..2e820cad49 100644
--- a/src/Mod/OpenSCAD/prototype.py
+++ b/src/Mod/OpenSCAD/prototype.py
@@ -40,8 +40,7 @@ def openscadmesh(doc,scadstr,objname):
class Node:
#fnmin=12 # maximal fn for implicit polygon rendering
fnmin= FreeCAD.ParamGet(\
- "User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
- GetInt('useMaxFN')
+ "User parameter:BaseApp/Preferences/Mod/OpenSCAD").GetInt('useMaxFN')
planedim=1e10 #size of the square used as x-y-plane
def __init__(self,name,arguments=None,children=None,):
pass
@@ -58,8 +57,8 @@ class Node:
return str1+')'
def __nonzero__(self):
- '''a Node is not obsolete if doesn't have children. Only if as neither name children or
- arguments'''
+ '''A Node is not obsolete if doesn't have children.
+ Only if as neither name children or arguments'''
return bool(self.name or self.arguments or self.children)
def __len__(self):
@@ -389,8 +388,7 @@ class Node:
try:
f=edgestofaces(edges)
except Part.OCCError:
- FreeCAD.Console.PrintError(\
- 'processing of dxf import failed\nPlease rework \'%s\' manually\n' % layera)
+ FreeCAD.Console.PrintError('processing of dxf import failed\nPlease rework \'%s\' manually\n' % layera)
f=Part.Shape() #empty Shape
obj=doc.addObject("Part::FeaturePython",'import_dxf_%s_%s'%(objname,layera))
#obj=doc.addObject('Part::Feature',)
@@ -399,8 +397,7 @@ class Node:
obj.Shape=f
else:
- FreeCAD.Console.ErrorMessage(\
- 'Filetype of %s not supported\n' % (filename))
+ FreeCAD.Console.ErrorMessage('Filetype of %s not supported\n' % (filename))
raise(NotImplementedError)
if obj: #handle origin and scale
if scale is not None and scale !=1:
@@ -530,10 +527,10 @@ class Node:
def flattengroups(self,name='group'):
"""removes group node with only one child and no arguments and empty groups"""
- node=self
- while (node.name==name and len(node.children)==1 and len(node.arguments)==0):
- node=node.children[0]
- node.children=[child for child in node.children if not (len(child.children)==0 and child.name==name)]
+ node = self
+ while (node.name == name and len(node.children) == 1 and len(node.arguments) == 0):
+ node = node.children[0]
+ node.children = [child for child in node.children if not (len(child.children) == 0 and child.name == name)]
if node.children:
node.children = [child.flattengroups() for child in node.children]
return node
@@ -688,5 +685,3 @@ def insert(filename,docname):
global dxfcache
dxfcache = {}
-
-
diff --git a/src/Mod/OpenSCAD/replaceobj.py b/src/Mod/OpenSCAD/replaceobj.py
index 310203c819..fb6b6f73a8 100644
--- a/src/Mod/OpenSCAD/replaceobj.py
+++ b/src/Mod/OpenSCAD/replaceobj.py
@@ -22,7 +22,7 @@
__title__="FreeCAD OpenSCAD Workbench - replace object function"
__author__ = "Sebastian Hoogen"
-__url__ = ["http://www.freecadweb.org"]
+__url__ = ["https://www.freecadweb.org"]
'''
This functions allows to replace an object in the feature hierarchy