ENH: CLI: add more logic to support repetitions

1. add identify_id for those clone objects
2. ensure succuss when copy multiple objects

Change-Id: I8a92f485442577ce70b1f5c46449dae1ae07b713
This commit is contained in:
lane.wei 2023-08-03 16:22:00 +08:00 committed by Lane.Wei
parent 468fc828d0
commit db5ed65577
2 changed files with 460 additions and 338 deletions

View file

@ -2146,6 +2146,24 @@ void PartPlate::duplicate_all_instance(unsigned int dup_count, bool need_skip, s
}
}
for (std::set<std::pair<int, int>>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it)
{
int obj_id = it->first;
int instance_id = it->second;
if ((obj_id >= 0) && (obj_id < m_model->objects.size()))
{
ModelObject* object = m_model->objects[obj_id];
ModelInstance* instance = object->instances[instance_id];
if (instance->printable)
{
instance->loaded_id = instance->id().id;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": set obj %1% instance %2%'s loaded_id to its id %3%, name %4%") % obj_id %instance_id %instance->loaded_id % object->name;
}
}
}
return;
}