コード例 #1
0
def readBinary(fileName):
	global _fileName
	_fileName = fileName

	result = False
	setDumpFolder(fileName)
	with open(fileName, 'rb') as file:
		reader = AcisReader(file)
		reader.name, trash = os.path.splitext(os.path.basename(fileName))
		result = reader.readBinary()
	return result
コード例 #2
0
    def Read_F645595C(self, node):
        # Spatial's (A)CIS (S)olid (M)odeling
        i = node.Read_Header0('ASM')
        i = node.ReadUInt32(i, 'u32_0')
        i = self.skipBlockSize(i)
        i = node.ReadUInt32(i, 'schema')
        if (getFileVersion() > 2010):
            if (i == len(node.data)): return i
        else:
            if (i + 4 == len(node.data)): return i + 4
        txt, ignore = getText8(
            node.data, i,
            15)  # 'ACIS BinaryFile' or from 20214 on 'ASM BinaryFile4'
        node.content += " fmt='%s'" % (txt)
        node.set('fmt', txt)
        e = len(node.data) - 17
        vers = getFileVersion()
        if (vers > 2018): e -= 1
        if (vers < 2011): e -= 8

        stream = io.BytesIO(node.data[i:e])
        reader = AcisReader(stream)
        reader.name = "%04X" % (node.index)
        if (reader.readBinary()):
            i = e
            node.set('SAT', reader)
            resolveEntityReferences(node)
            node.set('nameMatches', getNameMatchAttributes())
            node.set('dcAttributes', getDcAttributes())
            self.segment.AcisList.append(node)
            i = self.skipBlockSize(i)
            i = node.ReadUInt32(i, 'selectedKey')
            i += 1  # skip 00
            i = node.ReadSInt32(i, 'delta_state')  # active delta-state
            i = self.skipBlockSize(i)
            if (getFileVersion() > 2018): i += 1  # skip 00
            i = node.ReadChildRef(i, 'history')
            i += 4  # skip FF FF FF FF
            if (self.segment.acis is None):
                self.segment.acis = node
        return i
コード例 #3
0
def _dump_SMB(f3d, path):
    global smb_files
    result = False
    name = path.split('/')[-1]
    if (name):
        logAlways('    ... parsing \'%s\'' % (path))
        with f3d.open(path) as stream:
            dumpFolder = getDumpFolder()
            if (not (dumpFolder is None)):
                with open('%s/%s' % (dumpFolder, name), 'wb') as sab:
                    data = stream.read()
                    sab.write(data)
        with f3d.open(path) as stream:
            reader = AcisReader(stream)
            reader.name = name
            result = reader.readBinary()
            if (result):
                dumpSat(name[0:name.rfind('.')], reader)
                if (name[-3:].lower() != 'smb'):
                    smb_files.append(reader)
    return result
コード例 #4
0
def read(filename):
    global _3dSolids

    _3dSolids = []

    setDumpFolder(filename)
    doc = readfile(filename)
    for entry in doc.entities:
        if (entry.is_sab):
            stream = io.BytesIO(entry.acis)
            reader = AcisReader(stream)
            reader.name = entry.handle
            if (reader.readBinary()):
                _3dSolids.append(reader)
        elif (entry.is_sat):
            sat = u"\n".join(entry.acis)
            stream = io.StringIO(sat)
            reader = AcisReader(stream)
            reader.name = entry.handle
            if (reader.readText()):
                _3dSolids.append(reader)
    return True