MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / createBindingVarSet

Method createBindingVarSet

src/Gui/Dialogs/DlgExpressionInput.cpp:624–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622}
623
624void DlgExpressionInput::createBindingVarSet(App::Property* propVarSet, App::DocumentObject* varSet)
625{
626 ObjectIdentifier varSetId(*propVarSet);
627
628 // rewrite the identifiers of the expression to be relative to the VarSet
629 std::map<App::ObjectIdentifier, bool> identifiers = expression->getIdentifiers();
630
631 std::map<ObjectIdentifier, ObjectIdentifier> idsFromObjToVarSet;
632 for (const auto& idPair : identifiers) {
633 ObjectIdentifier exprId = idPair.first;
634 ObjectIdentifier relativeId = exprId.relativeTo(varSetId);
635 idsFromObjToVarSet[exprId] = relativeId;
636 }
637
638 Binding binding;
639 binding.bind(*propVarSet);
640 binding.setExpression(expression);
641 binding.apply();
642
643 varSet->renameObjectIdentifiers(idsFromObjToVarSet);
644}
645
646void DlgExpressionInput::acceptWithVarSet()
647{

Callers

nothing calls this directly

Calls 6

getIdentifiersMethod · 0.80
relativeToMethod · 0.80
bindMethod · 0.45
setExpressionMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected