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

decode or encode error,Can anyone help me? Thanks #1058

Open
lhbose opened this issue Dec 19, 2024 · 0 comments
Open

decode or encode error,Can anyone help me? Thanks #1058

lhbose opened this issue Dec 19, 2024 · 0 comments

Comments

@lhbose
Copy link

lhbose commented Dec 19, 2024

Hello, I have a question to ask. Thank you!
I have found several issues with DWG encoding and decoding, and I would like to know if it is due to my incorrect use?
Q 1: I am reporting a memory error using the dwg_write_file function, which occurred when I created versions of dwg for R_2007 and R_2004 using the dwg_new_Document function.
error
Q 2: When I use the dwg_new_Document function to create the R2000 version of dwg, there are no errors. However, when I use AutoCAD to open this file failed and report version incompatibility.
Remarks:
The versions of R2000, R2004, R2007, and others versions saved using the dwg_write_file function cannot be opened in AutoCAD and will report version incompatibility errors.
and i opened dwg file created with libredwg using qcad can works well,but while i save as an another dwg file,qcad reports an error: error while writing dimention style,requires an integer between 1 and 6.

// here is my testing-code
int
main ()
{
int error;
const char *out_file = "C:\Users\Administrator\Desktop\dwg\tmp.dwg";

// create an empty dwg file
Dwg_Data *p_out_dwg = dwg_new_Document (R_2000, 0, 3);

dwg_point_3d pt1 = { 1.5, 2.5, 0.2 };
dwg_point_3d pt2 = { 2.5, 1.5, 0.0 };
Dwg_Object_BLOCK_HEADER *hdr;
Dwg_Object *mspace = dwg_model_space_object (p_out_dwg);
hdr = mspace->tio.object->tio.BLOCK_HEADER;

// add a block to dwg
Dwg_Object_BLOCK_HEADER *blk;
blk = dwg_add_BLOCK_HEADER (p_out_dwg, "bloko");
dwg_add_BLOCK (blk, "bloko");
dwg_add_LINE (blk, &pt1, &pt2);
dwg_add_ENDBLK (blk);
dwg_add_INSERT (hdr, &pt1, "bloko", 1.0, 1.0, 1.0, 0.0);

// add a entity to dwg
dwg_add_CIRCLE (hdr, &pt1, 0.5);

// save dwg
error = dwg_write_file (out_file, p_out_dwg);

Dwg_Data in_dwg;
memset (&in_dwg, 0, sizeof (Dwg_Data));
error = dwg_read_file (out_file,&in_dwg);

printf ("DWG file read successfully.\n");

// free mem
dwg_free (p_out_dwg);

return 0;
}

@lhbose lhbose changed the title decode or encode error decode or encode error,Can anyone help me? Thanks Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant