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
def output(self): ''' Write output: report + dxf file. ''' blocks = self.getBlocks() outputFileNameBase = self.name xcImportExportData = nmd.XCImportExportData() xcImportExportData.problemName = outputFileNameBase + '_FEPrb' xcImportExportData.outputFileName = outputFileNameBase + '_blocks' xcImportExportData.xcFileName = outputFileNameBase + '.py' xcImportExportData.blockData = blocks # Write XC file. xcImportExportData.writeToXCFile() # Write DXF file. xcImportExportData.writeDxfFile(outputFileNameBase + '.dxf') # Write TXT file. outputFileName = outputFileNameBase + '.txt' outputFile = open(outputFileName, 'w') self.report(outputFile) outputFile.close() return blocks
pth = os.path.dirname(__file__) if (not pth): pth = "." filePath = pth + '/../../aux/freecad' baseName = 'test_ifc_lines' freeCADFileName = baseName + '.FCStd' freeCADImport = freecad_reader.FreeCADImport(filePath + '/' + freeCADFileName, groupsToImport, getRelativeCoo, threshold=0.001) #Block topology blocks = freeCADImport.exportBlockTopology('test') ieData = nmd.XCImportExportData() ieData.outputFileName = '/tmp/' + baseName + '_blocks' ieData.problemName = 'FEcase' ieData.blockData = blocks ieData.writeToXCFile() FEcase = xc.FEProblem() FEcase.title = 'Test IFC lines.' exec(open(ieData.outputFileName + '.py').read()) xcTotalSet = preprocessor.getSets.getSet('total') num_points = len(xcTotalSet.points) ratio1 = abs(num_points - 8)
# -*- coding: utf-8 -*- import xc_base import geom import xc from import_export import neutral_mesh_description as nm prueba = xc.FEProblem() preprocessor = prueba.getPreprocessor xcImportExportData = nm.XCImportExportData() xcImportExportData.problemName = "mainBeams" xcImportExportData.dxfLayers = ['model'] xcImportExportData.readDxfFile('model.dxf', preprocessor) xcImportExportData.xcFileName = 'modele_bielles_tirants_lp.py' xcImportExportData.writeToXCFile()
# -*- coding: utf-8 -*- #!/usr/bin/env python import os import xc_base import geom import xc from import_export import neutral_mesh_description xcImportExportData = neutral_mesh_description.XCImportExportData() xcImportExportData.mainDATFile = "MeshPGE.dat" #xcImportExportData.groupDATFiles= ["AppuiAigleCoteRive.dat", "AppuiAigleCoteTerr.dat", "AppuiAigleLatIntCT.dat", "AppuiAigleLatInt.dat", "AppuiLeysinCoteRive.dat", "AppuiLeysinCT.dat", "AppuiLeysinLatExtCA.dat", "AppuiLeysinLatExtCT.dat", "AppuiLeysinLatInt.dat", "Arc0.dat", "ArcPileAigle.dat", "ArcPileLeysin.dat", "Dalle.dat", "MurAigle.dat", "MurAigleLat.dat", "MurLeysin.dat", "Parapet.dat", "PileAigleCoteTerr.dat", "PileAigleLatIntCT.dat", "PileAigleLatInt.dat", "PileiLeysinLatInt.dat", "PileLeysinCoteTerr.dat", "PileLeysinLatExtCA.dat", "PileLeysinLatExtCT.dat", "PiloAigleCoteRive.dat", "PorteAFaux.dat", "SemelleAigle.dat", "SemelleLeysin.dat", "TympanExt.dat", "TympanInt.dat", "ArcAigle.dat", "ArcLeysin.dat", "DalleAigle.dat", "DalleLeysin.dat", "PileAigleBottom.dat", "PileAigleTop.dat", "PileLeysinBottom.dat", "PileLeysinTop.dat", "PileLeysinCoteRive.dat"] xcImportExportData.groupDATFiles = ["PileLeysinCoteRive.dat"] xcImportExportData.cellConversion[204] = "quad4n" xcImportExportData.cellConversion[203] = "tri31" xcImportExportData.readDATFiles() xcImportExportData.problemName = "MeshPGE" xcImportExportData.xcFileName = "pp.py" xcImportExportData.writeToXCFile()