예제 #1
0
    from Gui.Command import *
    Gui.activateWorkbench("CadQueryWorkbench")
    import cadquery as cq
    from Helpers import show
    # CadQuery Gui
except:  # catch *all* exceptions
    msg = "missing CadQuery 0.3.0 or later Module!\r\n\r\n"
    msg += "https://github.com/jmwright/cadquery-freecad-module/wiki\n"
    reply = QtGui.QMessageBox.information(None, "Info ...", msg)
    # maui end

#checking requirements
checkRequirements(cq)

try:
    close_CQ_Example(App, Gui)
except:  # catch *all* exceptions
    print "CQ 030 doesn't open example file"

# import cq_parameters  # modules parameters
# from cq_parameters import *


#Make a single plastic base block (chamfered if required)
def MakeBase(pins):

    #length of the base block
    L = pins * 2.54 + 7.62
    #Width of base block
    W1 = 8.9
    #internal width
    Gui.activateWorkbench("CadQueryWorkbench")
    import cadquery
    cq = cadquery
    from Helpers import show
    # CadQuery Gui
except:  # catch *all* exceptions
    msg = "missing CadQuery 0.3.0 or later Module!\r\n\r\n"
    msg += "https://github.com/jmwright/cadquery-freecad-module/wiki\n"
    if QtGui is not None:
        reply = QtGui.QMessageBox.information(None, "Info ...", msg)
    # maui end

#checking requirements

try:
    close_CQ_Example(FreeCAD, Gui)
except:  # catch *all* exceptions
    print "CQ 030 doesn't open example file"


class cq_parameters_help():
    def __init__(self):
        x = 0

    def create_pins(self, origo_x, origo_y, A1, pin_number, pin_type,
                    center_pin, h, alpha_delta, rotation):

        alpha = alpha_delta
        if pin_type[0] == 'round':
            x1 = (h * math.sin(alpha)) + origo_x
            y1 = (h * math.cos(alpha)) - origo_y
#######################################################################
from Gui.Command import *

# Import cad_tools
#sys.path.append("../")
from cqToolsExceptions import *
import cq_cad_tools
# Reload tools
reload(cq_cad_tools)
# Explicitly load all needed functions
from cq_cad_tools import GetListOfObjects, restore_Main_Tools,\
 exportSTEP, close_CQ_Example, saveFCdoc, z_RotateObject, multiFuseObjs_wColors,\
 runGeometryCheck

try:
    close_CQ_Example(App, Gui)
except:
    FreeCAD.Console.PrintMessage("can't close example.")

from math import sqrt
from collections import namedtuple
#import FreeCAD, Draft, FreeCADGui
import ImportGui

sys.path.append("cq_models")
import conn_phoenix_mstb as MSTB
import conn_phoenix_mc as MC

import add_license as L

if LIST_license[0]=="":
    Gui.activateWorkbench("CadQueryWorkbench")
    import cadquery
    cq = cadquery
    from Helpers import show
    # CadQuery Gui
except: # catch *all* exceptions
    msg = "missing CadQuery 0.3.0 or later Module!\r\n\r\n"
    msg += "https://github.com/jmwright/cadquery-freecad-module/wiki\n"
    if QtGui is not None:
        reply = QtGui.QMessageBox.information(None,"Info ...",msg)
    # maui end

#checking requirements

try:
    close_CQ_Example(FreeCAD, Gui)
except: # catch *all* exceptions
    print "CQ 030 doesn't open example file"

class Polyline:
    r"""A class for creating a polyline wire (including arcs) using **relative** moves (turtle graphics style)

    :param  plane: the workplane to add the polyline (as a wire)
    :type   plane: ``workplane``
    :param origin: point
    :type  origin: ``point``

    Most of the methods returns a reference to the class instance (self) which allows method chaining
    """

    def __init__(self, plane, origin=(0.0, 0.0)):