1 // Created on: 2002-04-25
2 // Created by: Michael PONIKAROV
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #include <QADNaming.hxx>
23 #include <TDF_Label.hxx>
24 #include <Draw_Interpretor.hxx>
25 #include <TNaming_Builder.hxx>
26 #include <TopoDS_Shape.hxx>
29 static Standard_Integer BuildNamedShape (Draw_Interpretor& di,
34 if (!QADNaming::Entry(arg, aLabel)) return 1;
35 char anEvolution = arg[3][0];
36 Standard_Integer a,anInc = (anEvolution == 'P' || anEvolution == 'D') ? 1 : 2;
37 // if (anEvolution == 'G')
38 // for(a=1;arg[3][a]!=0 && arg[3][a]!='\n';a++) if (arg[3][a]=='2') anEvolution = '2';
39 TNaming_Builder aBuilder(aLabel);
40 TopoDS_Shape aShape1,aShape2;
42 for(a = 4;a < nb;a += anInc) {
43 aShape1 = DBRep::Get (arg[a]);
46 di<<"For this type of evolution number of shapes must be even"<<"\n";
49 aShape2 = DBRep::Get(arg[a+1]);
52 switch (anEvolution) {
54 aBuilder.Generated(aShape1);
57 aBuilder.Generated(aShape1,aShape2);
60 aBuilder.Modify(aShape1,aShape2);
63 aBuilder.Delete(aShape1);
66 aBuilder.Replace(aShape1,aShape2);
69 aBuilder.Select(aShape1,aShape2);
72 di<<"Unknown evolution type"<<"\n";
78 // OnlyModif = atoi(arg[3]);
81 di<<"Usage: BuildName df entry evolution(P[RIMITIVE] G[ENERATED] M[ODIFY] D[ELETE] R[EPLACE] S[ELECTED]) shape1 [shape2 ...]"<<"\n";
88 void QADNaming::BuilderCommands(Draw_Interpretor& theCommands)
90 static Standard_Boolean done = Standard_False;
94 const char* g = "Naming builder commands";
96 theCommands.Add("BuildNamedShape",
97 "BuildNamedShape df entry evolution(P[RIMITIVE] G[ENERATED] M[ODIFY] D[ELETE] R[EPLACE] S[ELECTED]) shape1 [shape2 ...]",
98 __FILE__,BuildNamedShape,g);