Skip to content
New issue

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

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

Already on GitHub? # to your account

Decode or encode for various DWG version testing,am i right? #1067

Open
lhbose opened this issue Dec 30, 2024 · 2 comments
Open

Decode or encode for various DWG version testing,am i right? #1067

lhbose opened this issue Dec 30, 2024 · 2 comments

Comments

@lhbose
Copy link

lhbose commented Dec 30, 2024

I have tested the latest release v0.13.3.7426, and found some features,am i right? I created and saved dwg file versions as 2000/2007/2018 with autocad 2000/autocad 2007/autocad 2018.

  1. All versions decoding works well using dwg_read_file, except some objs can not be resolved.
  2. All versions encoding can not work normal using dwg_new_Document and dwg_write_file. That mens i created(using dwg_new_Document) and saved(dwg_write_file) to local dwg file, and then open this file with autocad, the cad application reports dwg error that can't be opend with formation not compatible.
  3. During the first two tests, i found that while i can get my dwg file with an empty dwg2000 as template using dwg_read_file and save as dwg2000 using dwg_write_file,but other dwg versions can't work.
    I want to know if my testing was right?
    Here is my testing code:

void
test_read ()
{
int error;
const char *file_path = "C:/Users/Administrator/Desktop/dwg/2000.dwg";
// created and saved by autocad2007
//const char *file_path = "C:/Users/Administrator/Desktop/dwg/2007.dwg";
// created and saved by autocad2018
//const char *file_path = "C:/Users/Administrator/Desktop/dwg/2018.dwg";

Dwg_Data dwg_data;
memset (&dwg_data, 0, sizeof (Dwg_Data));

error = dwg_read_file (file_path, &dwg_data);
}

void
test_write ()
{
int error = 0;
const char *out_file_path = "C:/Users/Administrator/Desktop/dwg/r_2000_write.dwg";
Dwg_Data *dwg_data = dwg_new_Document (R_2000, 0, 2);
//const char *out_file_path = "C:/Users/Administrator/Desktop/dwg/r_2007_write.dwg";
//Dwg_Data *dwg_data = dwg_new_Document (R_2007, 0, 2);
//const char *out_file_path = "C:/Users/Administrator/Desktop/dwg/r_2018_write.dwg";
//Dwg_Data *dwg_data = dwg_new_Document (R_2018, 0, 2);

error = dwg_write_file (out_file_path, dwg_data);

free (dwg_data);
}

void
test_rewrite ()
{
int error;
const char *in_file_path = "C:/Users/Administrator/Desktop/dwg/2000.dwg";
const char *out_file_path = "C:/Users/Administrator/Desktop/dwg/r_2000_rewrite.dwg";
//const char *in_file_path = "C:/Users/Administrator/Desktop/dwg/2007.dwg";
//const char *out_file_path = "C:/Users/Administrator/Desktop/dwg/r_2007_rewrite.dwg";
//const char *in_file_path = "C:/Users/Administrator/Desktop/dwg/2018.dwg";
//const char *out_file_path = "C:/Users/Administrator/Desktop/dwg/r_2018_rewrite.dwg";

Dwg_Data dwg_data;
memset (&dwg_data, 0, sizeof (Dwg_Data));

error = dwg_read_file (in_file_path, &dwg_data);

error = dwg_write_file (out_file_path, &dwg_data);
}

int
main ()
{
// read test
test_read ();

// write test
// any version here has problems
test_write ();

// rewrite test
// only R_2000 can works well
test_rewrite ();

return 0;
}

@rurban
Copy link
Contributor

rurban commented Dec 30, 2024

Read the docs. Encoding only works for versions <= r2000

@lhbose
Copy link
Author

lhbose commented Dec 30, 2024

Read the docs. Encoding only works for versions <= r2000

Yes, you're right. But i can't create dwg file using dwg_new document and dwg_write_file from empty,if i did this, dwg file can't be opened by autocad with errors,can you give me an tips? Testing code above "test_write" function,thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants