Ejemplo n.º 1
0
def buildWire(root, wire, transform):
	name = "Wire-%d" %(wire.index)
	logInfo(u"    building wire '%s'...", name)

	buildWires(wire.getCoEdges(), root, name, transform)

	return True
Ejemplo n.º 2
0
def buildWire(root, wire, transform):
    global wires
    wires += 1
    name = "Wire%02d" % wires
    logInfo(u"    building wire '%s'...", name)

    buildWires(wire.getCoEdges(), root, name, transform)

    return True
Ejemplo n.º 3
0
def buildLump(root, lump, transform):
	name = "Lump-%d" %(lump.index)
	logInfo(u"    building lump '%s'...", name)

	setCurrentColor(lump)

	buildFaces(lump.getShells(), root, name, transform)

	return True
Ejemplo n.º 4
0
def open(filename, skip = [], only = [], root = None):
	'''
	opens an Autodesk Inventor file in a new document
	In addition to insert (import), the iProperties are as well added to the document.
	'''
	if (isFileValid(filename)):
		logAlways(u"Reading: %s", os.path.abspath(filename))
		_open(filename, skip, only, root)
		logInfo(u"DONE!")
	return
Ejemplo n.º 5
0
def buildLump(root, lump, transform):
    global lumps
    lumps += 1
    name = "Lump%02d" % lumps
    logInfo(u"    building lump '%s'...", name)

    setCurrentColor(lump)

    buildFaces(lump.getShells(), root, name, transform)

    return True
Ejemplo n.º 6
0
def buildWires(coedges, root, name, transform):
	edges = []

	for index in coedges:
		coedge = coedges[index]
		edge = coedge.build()
		if (edge is not None):
			edges.append(edge)

	if (len(edges) > 0):
		logInfo(u"        ... %d edges!", len(edges))
		createBody(root, name, edges[0].fuse(edges[1:]) if (len(edges) > 1) else edges[0], transform)
	return
Ejemplo n.º 7
0
def open(filename, skip=[], only=[], root=None):
    '''
	opens an Autodesk Inventor file in a new document
	In addition to insert (import), the iProperties are as well added to the document.
	'''
    if (isFileValid(filename)):
        logAlways(u"Reading: %s", os.path.abspath(filename))
        name = os.path.splitext(os.path.basename(filename))[0]
        doc = FreeCAD.newDocument(decode(name))
        doc.Label = name
        reader = read(doc, filename, True)
        if (reader is not None):
            # Create 3D-Model in root (None) of document
            reader.create3dModel(None, doc)
            adjustView(doc)
        releaseMemory()
        logInfo(u"DONE!")
    return
Ejemplo n.º 8
0
def insert(filename, docname, skip = [], only = [], root = None):
	'''
	opens an Autodesk Inventor file in the current document
	'''
	doc = FreeCAD.listDocuments().get(docname)
	if (doc):
		if (isFileValid(filename)):
			logAlways(u"Importing: %s", filename)
			reader = read(filename)
			if (reader is not None):
				name = os.path.splitext(os.path.basename(filename))[0]
				name = decode(name)
				group = insertGroup(name)
				reader.create3dModel(group, doc)
			releaseMemory()
			FreeCADGui.SendMsgToActiveView("ViewFit")
	else:
		_open(filename, skip, only, root)
	logInfo(u"DONE!")
	return