Hello Speckle Team!
I’ve encountered two issues with model processing while using ArchiCAD Connector V3, and I’d like to share them with you:
- For model uploads, this version doesn’t have the incremental upload functionality that Revit offers;
- During model comparison, even when I make no changes to the model, the viewer shows that all models have been modified. This doesn’t match the actual situation.
To find the cause, I debugged the code and noticed that the “applicationId” of data with the type speckleType="Objects.Geometry.Mesh" keeps changing. So I modified the TraverseBase function in the BaseObjectSerializer.cpp file by adding the following code:
std::pair<std::string, nlohmann::json> BaseObjectSerializer::TraverseBase(const nlohmann::json& base)
{
auto lineageId = Base64GuidGenerator::NewGuid();
lineage.push_back(lineageId);
bool isDetached = false;
if (!detachLineage.empty())
{
isDetached = detachLineage.top();
detachLineage.pop();
}
auto traversedBase = nlohmann::json::object();
if (!base.contains("speckle_type") || !base["speckle_type"].is_string())
{
throw "speckle tpye not found or was not a string";
}
traversedBase["speckle_type"] = base["speckle_type"];
TraverseBaseProps(base, traversedBase);
auto closure = nlohmann::json::object();
auto parent = lineage.back();
lineage.pop_back();
auto it = familyTree.find(parent);
if (it == familyTree.end())
{
// Initialize if parent is not found
familyTree[parent] = nlohmann::json::object();
}
else
{
// Access the existing parent's items
for (const auto& [ref, depth] : it->second.items())
{
closure[ref] = depth - detachLineage.size();
}
}
nlohmann::json tempForId = traversedBase;
if (tempForId.contains("applicationId"))
{
tempForId.erase("applicationId");
}
std::string id = MD5::hash(tempForId.dump());
traversedBase["id"] = id;
if (!closure.empty())
{
traversedBase["__closure"] = closure;
}
if (isDetached)
{
objects[id] = traversedBase;
}
return {id, traversedBase};
}
This code eliminates the impact of applicationId on the MD5 hash, which fixes the issue of false model modification alerts. However, in subsequent tests, I found that ArchiCAD Connector V3 still lacks incremental upload functionality when sending models.
Looking forward to your reply. Thank you for your support!