1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <IGESSelect_AddGroup.ixx>
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <IGESBasic_Group.hxx>
18 #include <IGESData_HArray1OfIGESEntity.hxx>
19 #include <IGESData_IGESEntity.hxx>
20 #include <Interface_Macros.hxx>
24 IGESSelect_AddGroup::IGESSelect_AddGroup ()
25 : IGESSelect_ModelModifier (Standard_True) { }
27 void IGESSelect_AddGroup::Performing (IFSelect_ContextModif& ctx,
28 const Handle(IGESData_IGESModel)& target,
29 Interface_CopyTool& /*TC*/) const
32 ctx.CCheck(0)->AddFail ("Add Group : Selection required not defined");
35 Interface_EntityIterator list = ctx.SelectedResult();
36 Standard_Integer i = 0 , nb = list.NbEntities();
38 ctx.CCheck(0)->AddWarning ("Add Group : No entity selected");
42 ctx.CCheck(0)->AddWarning ("Add Group : ONE entity selected");
45 Handle(IGESData_HArray1OfIGESEntity) arr =
46 new IGESData_HArray1OfIGESEntity(1,nb);
47 for (ctx.Start(); ctx.More(); ctx.Next()) {
48 DeclareAndCast(IGESData_IGESEntity,ent,ctx.ValueResult());
52 Handle(IGESBasic_Group) gr = new IGESBasic_Group;
54 target->AddEntity(gr);
58 TCollection_AsciiString IGESSelect_AddGroup::Label () const
59 { return TCollection_AsciiString ("Add Group"); }