now at least you can import
This commit is contained in:
parent
ef92f654c7
commit
3f7d38cdeb
|
@ -30,7 +30,6 @@ class CQContext(object):
|
|||
self.firstPoint = None #a reference to the first point for a set of edges. used to determine how to behave when close() is called
|
||||
self.tolerance = 0.0001 #user specified tolerance
|
||||
|
||||
|
||||
class CQ(object):
|
||||
"""
|
||||
Provides enhanced functionality for a wrapped CAD primitive.
|
||||
|
|
|
@ -16,17 +16,19 @@
|
|||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
#these items are the common implementation
|
||||
from .CQ import CQ
|
||||
from .workplane import Workplane
|
||||
from . import plugins
|
||||
from . import selectors
|
||||
|
||||
|
||||
#these items point to the freecad implementation
|
||||
from .freecad_impl.geom import Plane,BoundBox,Vector
|
||||
from .freecad_impl.shapes import Shape,Vertex,Edge,Wire,Solid,Shell,Compound
|
||||
from .freecad_impl.exporters import SvgExporter, AmfExporter, JsonExporter
|
||||
|
||||
#these items are the common implementation
|
||||
from .CQ import CQ
|
||||
from .workplane import Workplane
|
||||
from . import plugins
|
||||
from . import selectors
|
||||
|
||||
__all__ = [
|
||||
'CQ','Workplane','plugins','selectors','Plane','BoundBox',
|
||||
'Shape','Vertex','Edge','Wire','Solid','Shell','Compound',
|
||||
|
|
|
@ -16,9 +16,3 @@
|
|||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
|
||||
import FreeCAD
|
||||
from FreeCAD import Part
|
||||
from FreeCAD import Base
|
||||
FreeCADVector = Base.Vector
|
||||
DEFAULT_TOLERANCE = 0.0001
|
|
@ -57,12 +57,12 @@ def guessUnitOfMeasure(shape):
|
|||
class Exporter(object):
|
||||
|
||||
def export(self):
|
||||
"""
|
||||
return a string representing the model exported in the specified format
|
||||
"""
|
||||
"""
|
||||
return a string representing the model exported in the specified format
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
class AMFExporter(Exporter):
|
||||
class AmfExporter(Exporter):
|
||||
def __init__(self,tessellation):
|
||||
|
||||
self.units = "mm"
|
||||
|
@ -135,8 +135,10 @@ class JsonExporter(Exporter):
|
|||
'nFaces' : self.nFaces
|
||||
};
|
||||
|
||||
class SVGExporter(Exporter):
|
||||
|
||||
class SvgExporter(Exporter):
|
||||
|
||||
def export(self):
|
||||
pass
|
||||
|
||||
def getPaths(freeCadSVG):
|
||||
"""
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
"""
|
||||
|
||||
import math,sys
|
||||
import FreeCAD
|
||||
import FreeCAD.Part
|
||||
|
||||
def sortWiresByBuildOrder(wireList,plane,result=[]):
|
||||
"""
|
||||
|
@ -95,11 +97,11 @@ class Vector(object):
|
|||
def __init__(self,*args):
|
||||
|
||||
if len(args) == 3:
|
||||
fV = FreeCADVector(args[0],args[1],args[2])
|
||||
fV = FreeCAD.Base.Vector(args[0],args[1],args[2])
|
||||
elif len(args) == 1:
|
||||
if type(args[0]) is tuple:
|
||||
fV = FreeCADVector(args[0][0],args[0][1],args[0][2])
|
||||
elif type(args[0] is FreeCADVector):
|
||||
fV = FreeCAD.Base.Vector(args[0][0],args[0][1],args[0][2])
|
||||
elif type(args[0] is FreeCAD.Base.Vector):
|
||||
fV = args[0]
|
||||
elif type(args[0] is Vector):
|
||||
fV = args[0].wrapped
|
||||
|
@ -137,7 +139,7 @@ class Vector(object):
|
|||
Note: FreeCAD has a bug here, where the
|
||||
base is also modified
|
||||
"""
|
||||
tmp = FreeCADVector(self.wrapped)
|
||||
tmp = FreeCAD.Base.Vector(self.wrapped)
|
||||
return Vector( tmp.multiply(scale))
|
||||
|
||||
def normalize(self):
|
||||
|
@ -147,7 +149,7 @@ class Vector(object):
|
|||
Note: FreeCAD has a bug here, where the
|
||||
base is also modified
|
||||
"""
|
||||
tmp = FreeCADVector(self.wrapped)
|
||||
tmp = FreeCAD.Base.Vector(self.wrapped)
|
||||
tmp.normalize()
|
||||
return Vector( tmp )
|
||||
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
object each one returns, so these are better grouped by the type of object they return.
|
||||
(who would know that Part.makeCircle() returns an Edge, but Part.makePolygon() returns a Wire ?
|
||||
"""
|
||||
|
||||
from cadquery import Vector
|
||||
import FreeCAD
|
||||
import FreeCAD.Part
|
||||
|
||||
class Shape(object):
|
||||
"""
|
||||
|
@ -63,7 +65,7 @@ class Shape(object):
|
|||
def cast(cls,obj,forConstruction = False):
|
||||
"Returns the right type of wrapper, given a FreeCAD object"
|
||||
s = obj.ShapeType
|
||||
if type(obj) == FreeCADVector:
|
||||
if type(obj) == Base.Vector:
|
||||
return Vector(obj)
|
||||
tr = None
|
||||
|
||||
|
|
|
@ -16,8 +16,3 @@
|
|||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
"""
|
||||
|
||||
from .CQ import CQ
|
||||
from .workplane import Workplane
|
||||
|
||||
__version__ = 0.9
|
|
@ -18,8 +18,8 @@
|
|||
"""
|
||||
|
||||
import math
|
||||
|
||||
from . import CQ
|
||||
from cadquery import Vector
|
||||
|
||||
class Workplane(CQ):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user