一个人如何分析和AutoCAD多行文字实体转换为原始的文本? [英] How does one parse and convert AutoCAD MText entity to raw text?

查看:409
本文介绍了一个人如何分析和AutoCAD多行文字实体转换为原始的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解析AutoCAD的多行文字实体并提取原始文本。我看到在文本格式的方式的模式。如果这已经解决了,那么我就不需要推倒重来。我曾经在网上搜索,但没有发现足够的信息。

我在寻找关于这个问题的任何链接或引用。

编辑:

要进一步明确,我们使用的是官方发展援助(开放式设计Aliance)库来访问DWG文件。我不熟悉这个库。另一名开发者所使用的库和提取的文件,包括多行文字实体的信息。我则提供了包含多行文字文本,这是我在看什么文件。我在看的多行文字格式的文本,我有机会获得和我在C#中的工作方式。

问题:

  1. 我问其他开发者,如果官方发展援助库提供提取原始文本格式化的方法。他的回答是,它可以,但是,它也将导致实体越来越写回DWG文件。我是在不影响原有的DWG文件感兴趣的原始文本。是否提供ODA提取原始文本的方式不改变文件?
  2. 在我感兴趣的多行文字的格式规则的任何文件,这样我就可以考虑写一个解析器自己,如果有必要的。
  3. 有什么在那里为多行文本转换为RTF?我认识到,RTF不能完全满足所有格式的规则,但这可能提供显示在WinForms应用程序格式化文本的一种高效的手段。鉴于RTF我也能获得原始文本。
解决方案

本的论坛线程包括VB程序,从多行文字剥离控制字符。在code表示应该怎样做脱衣每个控制字符,所以它应该直接写在C#中类似的东西。

此外,格式为$ C $的文件CS是在<一个可用href="http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a9193826455f5ffa23ce210c4a30acaf-63b9.htm,topicNumber=d0e123454"相对=nofollow> AutoCAD的文档。

I would like to parse AutoCAD's MText entity and extract the raw text. I see a pattern in the way the text is formatted. If this has already been solved, then I would not need to reinvent the wheel. I have searched online, but have not found sufficient information.

I am searching for any links or references on this subject.

Edit:

To further clarify, we are using the ODA (Open Design Aliance) libraries to access the DWG files. I am not familiar with this library. Another developer is using the library and extracting information from the files including MText entities. I am then provided with a file containing the MText text, which is what I am looking at. I am looking at the MText formatted text, which I have access to and am working with in C#.

Questions:

  1. I asked the other developer if the ODA library provided a means to extract the raw text unformatted. His response was that it could, however that it would also result in the entity getting written back to the DWG file. I am interested in the raw text without affecting the original DWG file. Does ODA provide a way of extracting the raw text without altering the file?
  2. I am interested in any documentation on the formatting rules of MText, so that I can consider writing a parser myself if necessary.
  3. Is there anything out there to convert MText to RTF? I realize that RTF would not completely satisfy all formatting rules, but this could provide a satisfactory means of displaying the formatted text in a WinForms app. Given RTF I could also obtain the raw text.

解决方案

This Forum thread includes a VB program to strip the control characters from the MText. The code indicates what should be done to strip each control character, so it should be straightforward to write something similar in C#.

Additionally, the documentation of the format codes is available in the AutoCAD documentation.

这篇关于一个人如何分析和AutoCAD多行文字实体转换为原始的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆