Commit d01bc0c9 authored by Thomas Karl Pietrowski's avatar Thomas Karl Pietrowski
Browse files

PEP8: Codestyle checks


Signed-off-by: Thomas Karl Pietrowski's avatarThomas Karl Pietrowski <thopiekar@googlemail.com>
parent 676f1f84
Pipeline #726 failed with stages
in 7 seconds
......@@ -10,13 +10,13 @@ from UM.Logger import Logger # @UnresolvedImport
from UM.i18n import i18nCatalog # @UnresolvedImport
from UM.Version import Version # @UnresolvedImport
# CIU
from .CadIntegrationUtils.CommonCLIReader import CommonCLIReader # @UnresolvedImport
# Since 3.4: Register Mimetypes:
if Version("3.4") <= Version(Application.getInstance().getVersion()):
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType
# CIU
from .CadIntegrationUtils.CommonCLIReader import CommonCLIReader # @UnresolvedImport
i18n_catalog = i18nCatalog("FreeCADPlugin")
......
......@@ -7,11 +7,12 @@ __plugin_id__ = "CuraFreeCADPlugin"
from UM.Platform import Platform # @UnresolvedImport
from UM.Logger import Logger # @UnresolvedImport
from UM.i18n import i18nCatalog # @UnresolvedImport
i18n_catalog = i18nCatalog(__plugin_id__)
# This plugins
from . import FreeCADReader
i18n_catalog = i18nCatalog(__plugin_id__)
def getMetaData():
return {
......
......@@ -28,15 +28,15 @@ native_file = FreeCAD.open(in_fn)
active_object = native_file.ActiveObject
active_shape = active_object.Shape.copy()
active_mesh = native_file.addObject("Mesh::Feature","Mesh")
active_mesh.Mesh = MeshPart.meshFromShape(Shape = active_shape,
#MaxLength=1, # Mefisto
LinearDeflection = int(1.0 * 10), # Standard
AngularDeflection = math.radians(5), # Standard
Relative = False
active_mesh = native_file.addObject("Mesh::Feature", "Mesh")
active_mesh.Mesh = MeshPart.meshFromShape(Shape=active_shape,
# MaxLength=1, # Mefisto
LinearDeflection=int(1.0 * 10), # Standard
AngularDeflection=math.radians(5), # Standard
Relative=False
)
Mesh.export([active_mesh,], out_fn)
Mesh.export([active_mesh, ], out_fn)
App.getDocument(App.ActiveDocument.Label).removeObject(active_mesh.Label)
......
......@@ -7,25 +7,27 @@ import subprocess
if sys.platform == "win32":
import winreg
class Test():
def __init__(self):
self._supported_extensions = [".FCStd".lower(),
]
self._additional_paths = None
self.scanForAllPaths()
def executeCommand(self, command, cwd = os.path.curdir):
def executeCommand(self, command, cwd=os.path.curdir):
environment_with_additional_path = os.environ.copy()
if self._additional_paths:
environment_with_additional_path["PATH"] = os.pathsep.join(self._additional_paths) + os.pathsep + environment_with_additional_path["PATH"]
environment_with_additional_path["PATH"] = os.pathsep.join(
self._additional_paths) + os.pathsep + environment_with_additional_path["PATH"]
print("i", "Executing command: {}".format(command))
p = subprocess.Popen(command,
cwd = cwd,
env = environment_with_additional_path,
shell = True,
cwd=cwd,
env=environment_with_additional_path,
shell=True,
)
p.wait()
def scanForAllPaths(self):
self._additional_paths = []
if sys.platform == "win32":
......@@ -34,7 +36,7 @@ class Test():
print("d", "Found path for {}: {}".format(file_extension, path))
if path:
self._additional_paths.append(path)
def _findPathFromExtension(self, extension):
file_class = winreg.QueryValue(winreg.HKEY_CLASSES_ROOT, extension)
file_class = winreg.QueryValue(winreg.HKEY_CLASSES_ROOT, os.path.join(file_class,
......@@ -51,22 +53,23 @@ class Test():
if os.path.isdir(path):
return path
return
def exportFileAs(self, foreign, stl):
print("d", "Exporting file: {}".format(stl))
cmd = r'FreeCADCmd'
cmd = [cmd,
#os.path.join(os.curdir,
cmd = [cmd,
# os.path.join(os.curdir,
# "scripts",
# "convertIntoSTL.py"
# ),
#'--',
#foreign,
#stl,
# '--',
# foreign,
# stl,
]
self.executeCommand(cmd, cwd = os.path.split(foreign)[0])
self.executeCommand(cmd, cwd=os.path.split(foreign)[0])
t = Test()
t.exportFileAs("test.FCStd", "test.stl")
\ No newline at end of file
t.exportFileAs("test.FCStd", "test.stl")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment