Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How read dwg Entity through handles like in taigha? #443

Closed
Sring65 opened this issue Sep 10, 2024 · 3 comments
Closed

How read dwg Entity through handles like in taigha? #443

Sring65 opened this issue Sep 10, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@Sring65
Copy link

Sring65 commented Sep 10, 2024

How read dwg Entity through handles like in taigha?
怎么通过句柄读取数据
taigha code
Database db = new Database(false, true);
db.ReadDwgFile(dwgFilePath, FileOpenMode.OpenTryForReadShare, false, DwgPassword, true);
Handle handle = new Handle((long)reader["Handle"]); //创建索引sqlite.db存储句柄数据范围等数据
db.TryGetObjectId(handle, out oid);
if (oid == null || oid == ObjectId.Null)
continue;
using (DBObject dbObj = oid.GetObject(OpenMode.ForRead))
{
if (dbObj is Entity)
{
using (Entity entity = dbObj as Entity)``

@DomCR DomCR added the help wanted Extra attention is needed label Sep 10, 2024
@DomCR
Copy link
Owner

DomCR commented Sep 10, 2024

Hi @Sring65,

I'm not familiar with taigha, but maybe what you are looking for is this method:

CadDocument.GetCadObject(ulong handle)

Returns any CadObject in the document by it's handle.

Let me know if it helps.

@Sring65
Copy link
Author

Sring65 commented Sep 14, 2024

hi @DomCR
taigha的ReadDwgFile方法, 打开dwg文件并没有解析数据打开文件比较快,通过句柄访问才解析对应数据,这样对只处理dwg文件内部分数据有优势,节省了加载所有数据时间,ACadSharp打开数据只读取句柄的设置吗?
The ReadDwgFile method of Taigha opens DWG files without parsing the data, which makes the file opening process faster. The data is only parsed when accessed through the handle, offering an advantage for processing only specific data within the DWG file, as it saves time on loading all the data. Does ACadSharp also have a setting to read data by only accessing the handles?

@DomCR
Copy link
Owner

DomCR commented Sep 18, 2024

I'll open a branch to take a look.

The problem that I see is that the reading of the file is sequential and some information may be lost in the process.

@Sring65 Sring65 closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants