X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FDDF%2FDDF_BasicCommands.cxx;h=a3994bdedd97eaa09413006bdfca8d80324ba6c7;hb=c99ad5d7600fc399d1ee6fd42eeb12e4fe64b80c;hpb=59e11a2f751f3b7b2e03b20622469dfb087ec87a diff --git a/src/DDF/DDF_BasicCommands.cxx b/src/DDF/DDF_BasicCommands.cxx index de9dbb8607..a3994bdedd 100644 --- a/src/DDF/DDF_BasicCommands.cxx +++ b/src/DDF/DDF_BasicCommands.cxx @@ -54,6 +54,7 @@ #include #include #include +#include //======================================================================= //function : Children @@ -114,6 +115,37 @@ static Standard_Integer DDF_Attributes (Draw_Interpretor& di, return 0; } +//======================================================================= +//function : SetEmptyAttribute +//purpose : Adds an empty attribute to the label by its dynamic type. +//======================================================================= + +static Standard_Integer DDF_SetEmptyAttribute (Draw_Interpretor& di, + Standard_Integer n, + const char** a) +{ + if (n != 4) return 1; + + Handle(TDF_Data) DF; + + if (!DDF::GetDF (a[1], DF)) return 1; + + TDF_Label lab; + TDF_Tool::Label(DF,a[2],lab); + + if (lab.IsNull()) return 1; + + Handle(TDF_Attribute) anAttrByType = TDF_DerivedAttribute::Attribute(a[3]); + if (anAttrByType.IsNull()) { + di<<"DDF: Not registered attribute type '"<ID()); + return 0; + } di<<"DDF: The format of GUID is invalid\n"; return 1; } @@ -297,12 +335,16 @@ void DDF::BasicCommands (Draw_Interpretor& theCommands) " Returns the list of label attributes: Attributes DF label", __FILE__, DDF_Attributes, g); + theCommands.Add ("SetEmptyAttribute", + "Sets an empty attribute by its type (like TDataStd_Tick): SetEmptyAttribute DF label type", + __FILE__, DDF_SetEmptyAttribute, g); + theCommands.Add ("ForgetAll", "Forgets all attributes from the label: ForgetAll DF Label", __FILE__, DDF_ForgetAll, g); theCommands.Add ("ForgetAtt", - "Forgets the specified by guid attribute from the label: ForgetAtt DF Label guid", + "Forgets the specified by guid attribute or type from the label: ForgetAtt DF Label guid_or_type", __FILE__, DDF_ForgetAttribute, g); theCommands.Add ("Label",