Beispiel #1
0
        Gui.SendMsgToActiveView("ViewFit")
        Gui.activeDocument().activeView().viewAxometric()

    return 0


import add_license as Lic

if __name__ == "__main__" or __name__ == "main_generator":

    global docname
    pins = []

    close_doc = False
    if len(sys.argv) < 3:
        say("Nothing specified to build...")
        pins = cq_cad_tools.getListOfNumbers("10")
    else:
        arg = sys.argv[2]
        if arg.lower() == "all":
            close_doc = True
            pins = range(2, 41)
        else:
            pins = cq_cad_tools.getListOfNumbers(sys.argv[2])

    for pin in pins:
        MakeHeader(pin)
        App.setActiveDocument(docname)
        doc = FreeCAD.ActiveDocument
        if close_doc:  #closing doc to avoid memory leak
            expVRML.say("closing doc to save memory")
Beispiel #2
0
    close_CQ_Example(App, Gui)
except:  # catch *all* exceptions
    print "example not present"

# from export_x3d import exportX3D, Mesh
import cadquery as cq
from Helpers import show
# maui end

#check version
cqv = cq.__version__.split(".")
#say2(cqv)
if int(cqv[0]) == 0 and int(cqv[1]) < 3:
    msg = "CadQuery Module needs to be at least 0.3.0!\r\n\r\n"
    reply = QtGui.QMessageBox.information(None, "Info ...", msg)
    say("cq needs to be at least 0.3.0")
    stop

from collections import namedtuple

destination_dir = "./generated_pinheaders/"
if not os.path.exists(destination_dir):
    os.makedirs(destination_dir)

outdir = ""  # handled below


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

    #length of the base block
    exportVRML(doc,name,scale,out_dir)
    
    # Save the doc in Native FC format
    saveFCdoc(App, Gui, doc, name,out_dir)

    Gui.SendMsgToActiveView("ViewFit")
    Gui.activeDocument().activeView().viewAxometric()

    return 0
    
if __name__ == "__main__":
    
    models = []
    
    if len(sys.argv) < 3:
        say("Nothing to build...")
        say("Specify name and pins")
        
    else:
        model = sys.argv[2]
        
        if model == 'all':
            models = [headers[model] for model in headers.keys()]
        else:
            models = [headers[i] for i in model.split(',') if i in headers.keys()]#separate model types with comma
            
    pins = []
    
    if len(sys.argv) < 4:
        say("No pins specifed. Not building")
    else:
    # Save the doc in Native FC format
    saveFCdoc(App, Gui, doc, name, out_dir)

    Gui.SendMsgToActiveView("ViewFit")
    Gui.activeDocument().activeView().viewAxometric()

    return 0


if __name__ == "__main__":

    models = []

    if len(sys.argv) < 3:
        say("Nothing to build...")
        say("Specify name and pins")

    else:
        model = sys.argv[2]

        if model == 'all':
            models = [headers[model] for model in headers.keys()]
        else:
            models = [
                headers[i] for i in model.split(',') if i in headers.keys()
            ]  #separate model types with comma

    pins = []

    if len(sys.argv) < 4:
    exportVRML(doc,name,scale,out_dir)
    
    # Save the doc in Native FC format
    saveFCdoc(App, Gui, doc, name,out_dir)

    Gui.SendMsgToActiveView("ViewFit")
    Gui.activeDocument().activeView().viewAxometric()

    return 0
    
if __name__ == "__main__":
    
    pins = []
    
    if len(sys.argv) < 3:
        say("Nothing to build...")
        say("Specify number of pins")
    else:
        arg = sys.argv[2]
        if arg.lower() == "all":
            pins = range(2,41)
        else:
            pins = cq_cad_tools.getListOfNumbers(sys.argv[2])
    
    for pin in pins:
        MakeHeader(pin)



# when run from freecad-cadquery
if __name__ == "temp.module":
    close_CQ_Example(App, Gui)
except: # catch *all* exceptions
    print "example not present"

# from export_x3d import exportX3D, Mesh
import cadquery as cq
from Helpers import show
# maui end

#check version
cqv=cq.__version__.split(".")
#say2(cqv)
if int(cqv[0])==0 and int(cqv[1])<3:
    msg = "CadQuery Module needs to be at least 0.3.0!\r\n\r\n"
    reply = QtGui.QMessageBox.information(None, "Info ...", msg)
    say("cq needs to be at least 0.3.0")
    stop


from collections import namedtuple

"""
Parameters for creating various pin-headers
"""
Params = namedtuple("Params", [
    'p', # pitch (separaration between pins)
    'rows', #number of rows
    'w', #width of plastic base
    'c', # chamfering of plastic base
    'h', # height of plastic base above board
    'pw', #pin width (square pins only)
    close_CQ_Example(App, Gui)
except: # catch *all* exceptions
    print "example not present"

# from export_x3d import exportX3D, Mesh
import cadquery as cq
from Helpers import show
# maui end

#check version
cqv=cq.__version__.split(".")
#say2(cqv)
if int(cqv[0])==0 and int(cqv[1])<3:
    msg = "CadQuery Module needs to be at least 0.3.0!\r\n\r\n"
    reply = QtGui.QMessageBox.information(None, "Info ...", msg)
    say("cq needs to be at least 0.3.0")
    stop

from collections import namedtuple

destination_dir="./generated_pinheaders/"
if not os.path.exists(destination_dir):
    os.makedirs(destination_dir)

outdir = "" # handled below

#Make a single plastic base block (chamfered if required)
def MakeBase(pins):
    
    #length of the base block
    L = pins * 2.54 + 7.62
Beispiel #8
0
    # Save the doc in Native FC format
    saveFCdoc(App, Gui, doc, name, out_dir)

    Gui.SendMsgToActiveView("ViewFit")
    Gui.activeDocument().activeView().viewAxometric()

    return 0


if __name__ == "__main__":

    pins = []

    if len(sys.argv) < 3:
        say("Nothing to build...")
        say("Specify number of pins")
    else:
        arg = sys.argv[2]
        if arg.lower() == "all":
            pins = range(2, 41)
        else:
            pins = cq_cad_tools.getListOfNumbers(sys.argv[2])

    for pin in pins:
        MakeHeader(pin)

# when run from freecad-cadquery
if __name__ == "temp.module":
    pass
    #ModelName="mypin"