Пример #1
0
def importMultiBlockTopology(dxfFileName, outputFileName, layerNamesToImport,
                             getRelativeCoo):
    ''' Loads DXF entities and writes XC multi-block topology entities
        in a Python file.

       :param dxfFileName: Drawing exchange format file name.
       :param ouputFileName: 
    '''
    logger = logging.getLogger('ezdxf')
    logger.setLevel(level=logging.WARNING)  #Avoid logging info messages.
    dxfImport = dxf_reader.DXFImport(dxfFileName,
                                     layerNamesToImport,
                                     getRelativeCoo,
                                     importLines=True,
                                     polylinesAsSurfaces=False,
                                     threshold=0.001,
                                     tolerance=.001)

    #Block topology
    blocks = dxfImport.exportBlockTopology('test')

    ieData = nmd.XCImportExportData()
    ieData.outputFileName = outputFileName
    ieData.problemName = 'FEcase'
    ieData.blockData = blocks

    ieData.writeToXCFile()
    return ieData
Пример #2
0

def getRelativeCoo(pt):
    return [pt[0], pt[1], pt[2]]  #No modification.


pth = os.path.dirname(__file__)
if (not pth):
    pth = "."
dxfFilePath = pth + '/../../aux/dxf/dxf_group_test.dxf'
logger = logging.getLogger('ezdxf')
logger.setLevel(level=logging.WARNING)  #Avoid logging info messages.
dxfImport = dxf_reader.DXFImport(dxfFilePath,
                                 layerNamesToImport,
                                 getRelativeCoo,
                                 importLines=True,
                                 polylinesAsSurfaces=False,
                                 threshold=0.001,
                                 tolerance=.001)

ok = True
referenceEntities = [u'7E', u'7D', u'7C', u'7B', u'7A', u'77', u'79', u'78']
entitiesWithGroup = (dxfImport.entitiesGroups.keys())
for label in referenceEntities:
    if not label in entitiesWithGroup:
        ok = False
        break

# #Block topology
# blocks= dxfImport.exportBlockTopology('test')
# fileName= 'xc_model_blocks'
Пример #3
0
#layerNamesToImport= ['3rd_floor_truss_II.*']
layerNamesToImport = ['2nd_floor']
#layerNamesToImport= ['facade_wall.*']


def getRelativeCoo(pt):
    return [pt[0], pt[1], pt[2]]  #No modification.


fileName = 'dxf_model_rev01.dxf'
#fileName= '2nd_floor_ramp_area.dxf'
#fileName= 'pp.dxf'
dxfImport = dxf_reader.DXFImport(fileName,
                                 layerNamesToImport,
                                 getRelativeCoo,
                                 threshold=0.1,
                                 importLines=False,
                                 polylinesAsSurfaces=True,
                                 tolerance=.25)

#Block topology
blocks = dxfImport.exportBlockTopology('test')

fileName = 'xc_model_blocks'
ieData = nmd.XCImportExportData()
ieData.outputFileName = fileName
ieData.problemName = 'test'
ieData.blockData = blocks

ieData.writeToXCFile()