Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool TopoNamingHelper::AppendTopoHistory(const std::string& BaseRoot, const TopoNamingHelper& InputData, const std::string& InputTargetNode){
- TDF_Label BaseNode = this->LabelFromTag(BaseRoot);
- TDF_Label BaseInput = InputData.LabelFromTag(InputTargetNode);
- if (BaseInput.NbChildren() - BaseNode.NbChildren() <= 0){
- // Note, should NOT be less than 0
- return false;
- }
- else{
- // Loop over every node in the InputData that is not in the BaseRoot
- for (int i = (BaseNode.NbChildren() + 1); i <= BaseInput.NbChildren(); i++){
- // This is the new node to add
- TDF_Label NewNode = BaseInput.FindChild(i, false);
- // This method should recursiviely append all children from NewNode into
- // BaseNode...
- this->AppendNode(BaseNode, NewNode);
- }
- }
- return true;
- }
- void TopoNamingHelper::AppendNode(const TDF_Label& Parent, const TDF_Label& Target){
- TDF_Label NewNode = TDF_TagSource::NewChild(Parent);
- TNaming_Builder Builder(NewNode);
- if (Target.IsAttribute(TNaming_NamedShape::GetID())){
- Handle(TNaming_NamedShape) TargetNS;
- Target.FindAttribute(TNaming_NamedShape::GetID(), TargetNS);
- switch (TargetNS->Evolution()){
- case TNaming_PRIMITIVE:{
- TopoDS_Shape NewShape = TNaming_Tool::GetShape(TargetNS);
- Builder.Generated(NewShape);
- break;}
- case TNaming_GENERATED:{
- TopoDS_Shape OldShape = TNaming_Tool::OriginalShape(TargetNS);
- TopoDS_Shape NewShape = TNaming_Tool::GetShape(TargetNS);
- Builder.Generated(OldShape, NewShape);
- break;}
- case TNaming_MODIFY :{
- TopoDS_Shape OldShape = TNaming_Tool::OriginalShape(TargetNS);
- TopoDS_Shape NewShape = TNaming_Tool::GetShape(TargetNS);
- Builder.Modify(OldShape, NewShape);
- break;}
- case TNaming_DELETE :{
- TopoDS_Shape OldShape = TNaming_Tool::OriginalShape(TargetNS);
- Builder.Delete(OldShape);
- break;}
- default:{
- std::runtime_error("Do not recognize this TNaming Evolution..."); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement