def TestPartFromTable(partNumber, outputType):
    document = FreeCAD.activeDocument()
    table = Piping.CsvTable(DIMENSIONS_USED)
    table.load(CSV_TABLE_PATH)
    builder = CouplingFromTable(document, table)
    print("Creating part %s" % partNumber)
    builder.create(partNumber, outputType)
    document.recompute()
示例#2
0
def TestTable():
    document = FreeCAD.activeDocument()
    table = Piping.CsvTable(DIMENSIONS_USED)
    table.load(CSV_TABLE_PATH)
    pipe = PipeFromTable(document, table)
    for i in range(0, len(table.data)):
        print("Selecting row %d" % i)
        partName = table.getPartName(i)
        print("Creating part %s" % partName)
        pipe.create(partName, parseQuantity("1m"), False)
        document.recompute()
def TestTable():
    document = FreeCAD.activeDocument()
    table = Piping.CsvTable(DIMENSIONS_USED)
    table.load(CSV_TABLE_PATH)
    builder = CouplingFromTable(document, table)
    for i in range(0, len(table.data)):
        print("Selecting row %d" % i)
        partNumber = table.getPartKey(i)
        print("Creating part %s" % partNumber)
        builder.create(partNumber, Piping.OUTPUT_TYPE_SOLID)
        document.recompute()
示例#4
0
def GuiCheckTable(tablePath, dimensionsUsed):
    # Check if the CSV file exists.
    if os.path.isfile(tablePath) is False:
        text = "This tablePath requires %s  but this file does not exist." % (
            tablePath)
        msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Warning,
                                   "Creating of the part failed.", text)
        msgBox.exec_()
        exit(1)  # Error

    # FreeCAD.Console.PrintMessage("Trying to load CSV file with dimensions: %s\n"%tablePath)
    table = Piping.CsvTable(dimensionsUsed)
    table.load(tablePath)

    if table.hasValidData is False:
        text = 'Invalid %s.\n'\
            'It must contain columns %s.' % (
                tablePath, ", ".join(dimensionsUsed))
        msgBox = QtGui.QMessageBox(
            QtGui.QMessageBox.Warning, "Creating of the part failed.", text)
        msgBox.exec_()
        exit(1)  # Error

    return table