使用Java读取Dxf文件 [英] Reading a Dxf file with Java
问题描述
我正在尝试用Java编写/查找一些代码来读取dxf文件,并将几何体从实体部分存储到数组中,以便稍后我可以根据表格将这些信息导入Oracle 11g。
I am trying to write/find some code in Java which reads dxf files and stores geometry from the "Entities" section into arrays so that I can later import that information into Oracle 11g in terms of tables.
提前谢谢!
推荐答案
我用过<最近我没有遇到任何问题,尽管我做了很简单的任务。如果你只是想把这些几何形状带到一个数组中,它就能完成这项任务(在其他情况下我无法分辨)。
如果你已经知道DXF格式,那么入门就没有问题了。它可以像下面这样简单(例如,提取一些圆形实体):
I've used kabeja recently and haven´t had any problems, though I did quite simple tasks. If you just want to bring those geometries into an array it will do the job (in other cases I can't tell). If you already know the DXF format you will have no problems to get started. It can get as easy as follows (e.g. to extract some circle entities):
Parser parser = ParserBuilder.createDefaultParser();
parser.parse("path/file.dxf", DXFParser.DEFAULT_ENCODING);
DXFDocument doc = parser.getDocument();
DXFlayer layer = doc.getDXFLayer("layer_name");
List<DXFCircle> arcs = layer.getDXFEntities(DXFConstants.ENTITY_TYPE_CIRCLE);
文档有点不完整,但它有不错的javadoc和干净的api。
The documentation is a bit incomplete, but it has decent javadocs and clean api.
这篇关于使用Java读取Dxf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!