commit
2ac3d2db98
|
@ -110,4 +110,4 @@ class FCADLogger:
|
||||||
|
|
||||||
import PySide
|
import PySide
|
||||||
PySide.QtGui.QMessageBox.critical(
|
PySide.QtGui.QMessageBox.critical(
|
||||||
FreeCADGui.getMainWindow(),'Assembly',e.message)
|
FreeCADGui.getMainWindow(),'Assembly',str(e))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from six import with_metaclass
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import FreeCAD, FreeCADGui, Part
|
import FreeCAD, FreeCADGui, Part
|
||||||
from . import utils, gui
|
from . import utils, gui
|
||||||
|
@ -583,8 +584,7 @@ def cstrName(obj):
|
||||||
return '{}<{}>'.format(objName(obj),Constraint.getTypeName(obj))
|
return '{}<{}>'.format(objName(obj),Constraint.getTypeName(obj))
|
||||||
|
|
||||||
|
|
||||||
class Base(object):
|
class Base(with_metaclass(Constraint, object)):
|
||||||
__metaclass__ = Constraint
|
|
||||||
_id = -1
|
_id = -1
|
||||||
_entityDef = ()
|
_entityDef = ()
|
||||||
_workplane = False
|
_workplane = False
|
||||||
|
|
4
gui.py
4
gui.py
|
@ -1,3 +1,4 @@
|
||||||
|
from six import with_metaclass
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import FreeCAD, FreeCADGui
|
import FreeCAD, FreeCADGui
|
||||||
from .utils import getElementPos,objName,addIconToFCAD,guilogger as logger
|
from .utils import getElementPos,objName,addIconToFCAD,guilogger as logger
|
||||||
|
@ -177,8 +178,7 @@ class AsmCmdManager(ProxyType):
|
||||||
def onClearSelection(cls):
|
def onClearSelection(cls):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class AsmCmdBase(object):
|
class AsmCmdBase(with_metaclass(AsmCmdManager, object)):
|
||||||
__metaclass__ = AsmCmdManager
|
|
||||||
_id = -1
|
_id = -1
|
||||||
_active = None
|
_active = None
|
||||||
_toolbarName = 'Assembly3'
|
_toolbarName = 'Assembly3'
|
||||||
|
|
2
proxy.py
2
proxy.py
|
@ -61,7 +61,7 @@ class ProxyType(type):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getType(mcs,tp):
|
def getType(mcs,tp):
|
||||||
if isinstance(tp,basestring):
|
if isinstance(tp,str):
|
||||||
return mcs.getInfo().TypeNameMap[tp]
|
return mcs.getInfo().TypeNameMap[tp]
|
||||||
if not isinstance(tp,int):
|
if not isinstance(tp,int):
|
||||||
tp = mcs.getTypeID(tp)
|
tp = mcs.getTypeID(tp)
|
||||||
|
|
|
@ -110,7 +110,7 @@ class Solver(object):
|
||||||
msg += '\n{}, handle: {}'.format(cstrName(cstr),h)
|
msg += '\n{}, handle: {}'.format(cstrName(cstr),h)
|
||||||
logger.error(msg)
|
logger.error(msg)
|
||||||
raise RuntimeError('Failed to solve {}: {}'.format(
|
raise RuntimeError('Failed to solve {}: {}'.format(
|
||||||
objName(assembly),e.message))
|
objName(assembly),str(e)))
|
||||||
self.system.log('done solving')
|
self.system.log('done solving')
|
||||||
|
|
||||||
touched = False
|
touched = False
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from six import with_metaclass
|
||||||
from .system import System, SystemBase, SystemExtension
|
from .system import System, SystemBase, SystemExtension
|
||||||
from .utils import syslogger as logger, objName
|
from .utils import syslogger as logger, objName
|
||||||
import platform
|
import platform
|
||||||
|
@ -5,10 +6,12 @@ import platform
|
||||||
if platform.system() == 'Darwin':
|
if platform.system() == 'Darwin':
|
||||||
from .py_slvs_mac import slvs
|
from .py_slvs_mac import slvs
|
||||||
else:
|
else:
|
||||||
from .py_slvs import slvs
|
try:
|
||||||
|
from py_slvs import slvs
|
||||||
|
except ImportError:
|
||||||
|
from .py_slvs import slvs
|
||||||
|
|
||||||
class SystemSlvs(SystemBase):
|
class SystemSlvs(with_metaclass(System, SystemBase)):
|
||||||
__metaclass__ = System
|
|
||||||
_id = 1
|
_id = 1
|
||||||
|
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
|
|
10
sys_sympy.py
10
sys_sympy.py
|
@ -1,3 +1,4 @@
|
||||||
|
from six import with_metaclass
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import pprint
|
import pprint
|
||||||
from .proxy import ProxyType, PropertyInfo
|
from .proxy import ProxyType, PropertyInfo
|
||||||
|
@ -30,8 +31,7 @@ def _makeProp(name,doc='',tp='App::PropertyFloat',group=None):
|
||||||
|
|
||||||
_makeProp('Tolerance','','App::PropertyPrecision','Solver')
|
_makeProp('Tolerance','','App::PropertyPrecision','Solver')
|
||||||
|
|
||||||
class _AlgoBase(object):
|
class _AlgoBase(with_metaclass(_AlgoType, object)):
|
||||||
__metaclass__ = _AlgoType
|
|
||||||
_id = -2
|
_id = -2
|
||||||
_common_options = [_makeProp('maxiter',
|
_common_options = [_makeProp('maxiter',
|
||||||
'Maximum number of function evaluations','App::PropertyInteger')]
|
'Maximum number of function evaluations','App::PropertyInteger')]
|
||||||
|
@ -207,8 +207,7 @@ class _Algodogleg(_AlgoNeedHessian):
|
||||||
class _Algotrust_ncg(_Algodogleg):
|
class _Algotrust_ncg(_Algodogleg):
|
||||||
_id = 10
|
_id = 10
|
||||||
|
|
||||||
class SystemSymPy(SystemBase):
|
class SystemSymPy(with_metaclass(System, SystemBase)):
|
||||||
__metaclass__ = System
|
|
||||||
_id = 2
|
_id = 2
|
||||||
|
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
|
@ -319,8 +318,7 @@ class _MetaType(type):
|
||||||
return issubclass(cls,_Constraint)
|
return issubclass(cls,_Constraint)
|
||||||
|
|
||||||
|
|
||||||
class _MetaBase(_Base):
|
class _MetaBase(with_metaclass(_MetaType, _Base)):
|
||||||
__metaclass__ = _MetaType
|
|
||||||
_args = ()
|
_args = ()
|
||||||
_opts = ()
|
_opts = ()
|
||||||
_vargs = ()
|
_vargs = ()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from six import with_metaclass
|
||||||
import os
|
import os
|
||||||
import FreeCAD
|
import FreeCAD
|
||||||
from .constraint import cstrName, PlaneInfo, NormalInfo
|
from .constraint import cstrName, PlaneInfo, NormalInfo
|
||||||
|
@ -76,8 +77,7 @@ def _makePropInfo(name,tp,doc='',default=None):
|
||||||
_makePropInfo('Verbose','App::PropertyBool')
|
_makePropInfo('Verbose','App::PropertyBool')
|
||||||
_makePropInfo('AutoRelax','App::PropertyBool')
|
_makePropInfo('AutoRelax','App::PropertyBool')
|
||||||
|
|
||||||
class SystemBase(object):
|
class SystemBase(with_metaclass(System, object)):
|
||||||
__metaclass__ = System
|
|
||||||
_id = 0
|
_id = 0
|
||||||
_props = ['Verbose','AutoRelax']
|
_props = ['Verbose','AutoRelax']
|
||||||
|
|
||||||
|
|
1
utils.py
1
utils.py
|
@ -590,4 +590,3 @@ def project2D(rot,*vectors):
|
||||||
vx = rot.multVec(FreeCAD.Vector(1,0,0))
|
vx = rot.multVec(FreeCAD.Vector(1,0,0))
|
||||||
vy = rot.multVec(FreeCAD.Vector(0,1,0))
|
vy = rot.multVec(FreeCAD.Vector(0,1,0))
|
||||||
return [FreeCAD.Vector(v.dot(vx),v.dot(vy),0) for v in vectors]
|
return [FreeCAD.Vector(v.dot(vx),v.dot(vy),0) for v in vectors]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user