Comments (9)
我的英语不太好,请尽量仔细的看懂我的话,
我的意思是你的dwg的文件版本太高,
你试试读取r2000版本的文件看看问题是否存在
from libredwg.
You are confused. >+ R2007 all text values are Windows unicode (i.e UCS-2),
With the rest you are also apparently confused. internal Dwg_Object * addresses are not offsets into the file.
from libredwg.
Thanks for answering rurban.
trying to get the text as 16 bit chars works now, I'm happy it's not a bug.
Is there a place in the documentation taking about the text format?
As I said in the post I'm on version 0.12.5 and I see the member's type has changed but the comment is the same.
quoting: "byte offset in the file".
Line 8958 in 76d2f0d
Can you please briefly explain to what this address is pointing.
from libredwg.
Dwg_Object *obj->address is indeed the byte offset. But you were talking about the obj ptr, not obj->address.
The docs at https://www.gnu.org/software/libredwg/manual/LibreDWG.html#Types mentions
BITCODE_TU wchar*
length + windows 2-byte wchar string (UCS-2). The default text type since r2007.
I.e. all T types are TU since r2007, else TV,
from libredwg.
From the start I meant the obj.address, probably language barrier (I'm not a native English speaker).
I printed the address like this (looping over all dwg_objects):
printf("size: %d, address: %d\n", object.size, object.address);
and got: 193, 275739
and later ran
int test(void) {
unsigned int size = 193;
unsigned int address = 275739;
char buf[size];
int fd = open("my_file.dwg", O_RDONLY);
printf("fd: %d\n", fd);
int err = pread(fd, (void *)buf, size, address);
close(fd);
if (err < 0) {
printf("failed to read mtext raw data, what: %s\n", strerror(err));
return err;
}
printf("bytes read: %d\n", err);
printf("size: %d, address: %d, raw data: %s\n\n\n", size, address, buf);
return 0;
}
pread returns 0 for all mtexts byte offset in the file (by pread docs it means EOF).
can you see any problem with the way I tried to get out data?
from libredwg.
od --skip-bytes=275739 --read-bytes 193 my_file.dwg
would be easier.
dwgread -v5 my_file.dwg
would also be useful, as it converts your mtext value to utf-8
from libredwg.
It's easier (thanks), but as I expected od gives:
od: cannot skip past end of combined input
from libredwg.
Try changing your dwg version to r2000,
Too high version to work properly
from libredwg.
Try changing your dwg version to r2000,
Too high version to work properly
I'm guessing you are talking about the object byte offset.
The thing is it looks like the file is parsed correctly, so I don't think it's a version problem.
After @rurban explained that the text isn't utf-8 (and it was a rookie mistake on my part) I'm extracting the text and all the other values just fine.
The only problem I see is with the byte offset, though this problem doesn't affect my work, I would like to help make sure there's not a bug here.
from libredwg.
Related Issues (20)
- Issue with HANDLE > 32b HOT 1
- hatch entity miss data HOT 3
- Cannot open an autocad2022 version dwg file. HOT 4
- _LibreDWG.so missing from python bindings HOT 2
- BUILD ERROR: No rule to make target 'all'. HOT 1
- Problem creating geojson HOT 1
- The necessary files are missing when installing HOT 3
- dwggrep option handling HOT 1
- Use dwgrewrite.c code,autoCAD open conver dwg file have Error pop-up message HOT 1
- add dwgwrite flag to help avoid recovery mode but with data-loss
- Bugs in text splitting for DXF output HOT 1
- centos system: make errors: template.spec:22:1: error: format not a string literal, argument HOT 1
- C:\Users\Liu\Desktop\libredwg-master\src\decode.c(3799,22): error C2065: “ref”: 未声明的标识符 [Desktop\libredwg-master\build2\libredwg.vcxproj] HOT 3
- heap-buffer-overflow exists in the function bit_read_fixed in /src/bits.c
- INSERT encoding errors (was: dwgrewrite error) HOT 7
- the python binds with output params is difficulty to use HOT 2
- writing dxf files using the API? HOT 1
- Reading The dxf file is too slow HOT 1
- 高版本DWG转换为DXF文件失败 HOT 1
- Getting rid of "Recovery Mode" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libredwg.