def dumpSat(name, acis, use_dump_folder=True):
    header = acis.header
    history = acis.history
    entities = acis.getEntities()
    dumpFolder = getDumpFolder()
    historyIdx = None

    if (history):
        historyIdx = history.index

    if (dumpFolder):
        if (use_dump_folder):
            satFile = os.path.join(dumpFolder, "%s.sat" % (name))
        else:
            satFile = name
        with io.open(satFile, 'wt', encoding='utf-8') as sat:
            sat.write(header.__str__())
            for record in entities:
                if (record.index == historyIdx):
                    sat.write(u"%r\n" % (history.getRecord()))
                    for ds in history.delta_states:
                        sat.write(u"%s\n" % (ds.getRecord()))
                    sat.write(u"End-of-ACIS-History-Section\n")
                sat.write(u"%s\n" % (record))
            sat.write(u"End-of-ACIS-data\n")
    return
Exemplo n.º 2
0
def resolveNodes(acis):
	init()
	bodies = []
	doAdd  = True
	setReader(acis)
	for entity in acis.getEntities():
		node = createNode(entity)
		if (node):
			if (doAdd and (entity.name == 'body')):
				bodies.append(node)
			if (entity.name in ['Begin-of-ACIS-History-Data', 'End-of-ACIS-data']):
				doAdd = False

	if (getDumpFolder()[-3:].lower() != 'sat'):
		name = _getSatFileName(acis.name)
		dumpSat(name, acis)

	return bodies
def _getSatFileName(name):
    return os.path.join(getDumpFolder(), "%s.sat" % (name))