Skip to content

Commit

Permalink
Merge pull request #6 from AliHaider93/G_devel_k-g
Browse files Browse the repository at this point in the history
G devel k g
  • Loading branch information
AliHaider93 authored Aug 12, 2024
2 parents 649705e + ee32e31 commit 5d25e3d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/conv/k-g/region_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,31 @@ void RegionList::create
wmember all_head;
BU_LIST_INIT(&all_head.l);

int region_id = 0;

for (std::map<std::string, Region>::iterator it = m_list.begin(); it != m_list.end(); ++it) {
const std::string& region_name = it->first;
Region& region = it->second;
Geometry& geometry = region.geometry;
const std::map<std::string, std::string>& region_attributes = region.attributes;


std::vector<std::string> names = geometry.write(wdbp);

wmember geometry_head;
BU_LIST_INIT(&geometry_head.l);

bu_color regionColor = BU_COLOR_INIT_ZERO;
bu_color_rand(&regionColor, BU_COLOR_RANDOM);

unsigned char rgb[3];
bu_color_to_rgb_chars(&regionColor, rgb);

for (size_t i = 0; i < names.size(); i++) {
mk_addmember(names[i].c_str(), &(geometry_head.l), NULL, WMOP_UNION);
mk_addmember(names[i].c_str(), &(all_head.l), NULL, WMOP_UNION);
}
mk_lfcomb(wdbp, geometry.getBaseName(), &geometry_head, 0);

mk_lcomb(wdbp, geometry.getBaseName(), &geometry_head, 1, NULL, NULL, rgb, ++region_id);

if (region_attributes.size() > 0) {
writeAttributes(wdbp, region_name.c_str(), region_attributes);
Expand Down

0 comments on commit 5d25e3d

Please sign in to comment.