[OpenSCAD] Minor fixes from LGTM analysis
This commit is contained in:
@@ -29,10 +29,6 @@
|
||||
#***************************************************************************/
|
||||
|
||||
import FreeCAD
|
||||
import OpenSCADUtils
|
||||
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
|
||||
openscadfilename = param.GetString('openscadexecutable')
|
||||
|
||||
|
||||
class OpenSCADWorkbench ( Workbench ):
|
||||
"OpenSCAD workbench object"
|
||||
@@ -64,7 +60,6 @@ class OpenSCADWorkbench ( Workbench ):
|
||||
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
|
||||
openscadfilename = param.GetString('openscadexecutable')
|
||||
if not openscadfilename:
|
||||
|
||||
import OpenSCADUtils
|
||||
openscadfilename = OpenSCADUtils.searchforopenscadexe()
|
||||
if openscadfilename: #automatic search was succsessful
|
||||
@@ -93,6 +88,5 @@ class OpenSCADWorkbench ( Workbench ):
|
||||
|
||||
Gui.addWorkbench(OpenSCADWorkbench())
|
||||
|
||||
openscadfilename = OpenSCADUtils.searchforopenscadexe()
|
||||
if openscadfilename: #automatic search was succsessful
|
||||
FreeCAD.__unit_test__ += ["TestOpenSCADGui"]
|
||||
# Not all of the GUI tests will require an OpenSCAD binary (CSG import and export don't)
|
||||
FreeCAD.__unit_test__ += ["TestOpenSCADGui"]
|
||||
|
||||
@@ -235,7 +235,6 @@ class MatrixTransform:
|
||||
setattr(fp, prop, value)
|
||||
|
||||
def execute(self, fp):
|
||||
pass
|
||||
if fp.Matrix and fp.Base:
|
||||
sh=fp.Base.Shape#.copy()
|
||||
m=sh.Placement.toMatrix().multiply(fp.Matrix)
|
||||
|
||||
@@ -131,12 +131,12 @@ def getopenscadversion(osfilename=None):
|
||||
"User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
|
||||
GetString('openscadexecutable')
|
||||
if osfilename and os.path.isfile(osfilename):
|
||||
p=subprocess.Popen([osfilename,'-v'],\
|
||||
stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True)
|
||||
p.wait()
|
||||
stdout=p.stdout.read().strip()
|
||||
stderr=p.stderr.read().strip()
|
||||
return (stdout or stderr)
|
||||
with subprocess.Popen([osfilename,'-v'],\
|
||||
stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True) as p:
|
||||
p.wait()
|
||||
stdout=p.stdout.read().strip()
|
||||
stderr=p.stderr.read().strip()
|
||||
return (stdout or stderr)
|
||||
|
||||
def newtempfilename():
|
||||
import os,time
|
||||
@@ -329,7 +329,6 @@ def angneg(d):
|
||||
return d if (d <= 180.0) else (d-360)
|
||||
|
||||
def shorthexfloat(f):
|
||||
s=f.hex()
|
||||
mantisse, exponent = f.hex().split('p',1)
|
||||
return '%sp%s' % (mantisse.rstrip('0'),exponent)
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ This Script includes python functions to find out the most basic shape type
|
||||
in a compound and to change the color of shapes according to their shape type
|
||||
'''
|
||||
|
||||
import FreeCAD
|
||||
def shapedict(shapelst):
|
||||
return dict([(shape.hashCode(),shape) for shape in shapelst])
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ feature tree to the most basic objects
|
||||
|
||||
import FreeCAD
|
||||
from OpenSCADFeatures import *
|
||||
from OpenSCADUtils import isspecialorthogonalpython,isspecialorthogonal
|
||||
from OpenSCADUtils import isspecialorthogonal
|
||||
import replaceobj
|
||||
|
||||
def likeprimitive(obj,extrusion=False):
|
||||
|
||||
@@ -29,18 +29,15 @@ __title__="FreeCAD OpenSCAD Workbench - CSG exporter Version"
|
||||
__author__ = "Keith Sloan <keith@sloan-home.co.uk>"
|
||||
__url__ = ["http://www.sloan-home.co.uk/Export/Export.html"]
|
||||
|
||||
import FreeCAD, os, Part, math
|
||||
from FreeCAD import Vector
|
||||
import FreeCAD
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
gui = True
|
||||
else:
|
||||
gui = False
|
||||
|
||||
#***************************************************************************
|
||||
# Tailor following to your requirements ( Should all be strings ) *
|
||||
global fafs
|
||||
#fafs = '$fa = 12, $fs = 2'
|
||||
#convexity = 'convexity = 10'
|
||||
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
|
||||
|
||||
@@ -33,13 +33,7 @@ __url__ = ["http://www.sloan-home.co.uk/ImportCSG"]
|
||||
|
||||
printverbose = False
|
||||
|
||||
import FreeCAD, io, os, sys
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
gui = True
|
||||
else:
|
||||
if printverbose: print("FreeCAD Gui not present.")
|
||||
gui = False
|
||||
import FreeCAD, io, os
|
||||
|
||||
import ply.lex as lex
|
||||
import ply.yacc as yacc
|
||||
@@ -50,9 +44,15 @@ from OpenSCADUtils import *
|
||||
|
||||
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD")
|
||||
printverbose = params.GetBool('printVerbose',False)
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
gui = True
|
||||
else:
|
||||
if printverbose: print("FreeCAD Gui not present.")
|
||||
gui = False
|
||||
|
||||
hassetcolor=[]
|
||||
alreadyhidden=[]
|
||||
printverbose = True
|
||||
|
||||
# Get the token map from the lexer. This is required.
|
||||
import tokrules
|
||||
@@ -130,7 +130,7 @@ def insert(filename,docname):
|
||||
"called when freecad imports a file"
|
||||
global doc
|
||||
global pathName
|
||||
groupname = os.path.splitext(os.path.basename(filename))[0]
|
||||
groupname_unused = os.path.splitext(os.path.basename(filename))[0]
|
||||
try:
|
||||
doc=FreeCAD.getDocument(docname)
|
||||
except NameError:
|
||||
@@ -596,7 +596,7 @@ def p_difference_action(p):
|
||||
if printverbose: print(len(p[5]))
|
||||
if printverbose: print(p[5])
|
||||
if (len(p[5]) == 0 ): #nochild
|
||||
mycut = placeholder('group',[],'{}')
|
||||
mycut_unused = placeholder('group',[],'{}')
|
||||
elif (len(p[5]) == 1 ): #single object
|
||||
p[0] = p[5]
|
||||
else:
|
||||
@@ -806,7 +806,6 @@ def process_mesh_file(fname,ext):
|
||||
|
||||
|
||||
def processTextCmd(t):
|
||||
import os
|
||||
from OpenSCADUtils import callopenscadstring
|
||||
tmpfilename = callopenscadstring(t,'dxf')
|
||||
from OpenSCAD2Dgeom import importDXFface
|
||||
|
||||
Reference in New Issue
Block a user