gmggroup / omf-rust

Rust library for working with OMF files
MIT License
4 stars 3 forks source link

Add more examples #10

Open Tim-Evans-Seequent opened 4 months ago

Tim-Evans-Seequent commented 4 months ago

It would be useful to have a few different examples of real mining data in OMF2 files. Code to write and read the files can be included as well, but isn't necessary.

Example files on their own can be placed into examples/example1.omf for example. If they come with Rust code then put them into a subfolder with examples/example2/main.rs and examples/example2/example2.omf along with any input data.

Update the examples/README.md to provide a brief description of each example.

m-sb commented 1 week ago

Hi, I am working with blockmodels. So can I get reading writing examples for basic type of blockodels in c/cpp language?

Actually, I stuck to iterate loop on subblock. If anyone can add that code. That will be helpful.

Thanks in advance

Tim-Evans-Seequent commented 1 week ago

For right now, there is a small example of writing block models, with both regular and free-form sub-blocks, in geometries.c. For reading you would need to translate from the Rust example in bunny_blocks.

m-sb commented 6 days ago

Thanks, @Tim-Evans-Seequent
that is what I am saying. Actually I went through this example, but my bad. I am not able to convert that rust code to cpp code. specially for iterator. Could you please share the cpp subblock iterator code.

Does following code OK:

  OmfArrayInfo info = omf_reader_array_info(reader, omfArr);
  assert(info.array_type == OMF_ARRAY_TYPE_REGULAR_SUBBLOCKS);
  OmfRegularSubblocks* iter = omf_reader_array_regular_subblocks_iter(reader, omfArr);
  while (omf_regular_subblocks_next(iter, parent, corner)) {
  //business logic
  }

Thanks in advance.