Patch for Naming improvement.
1). Added persistence.
2). Removed not supported evolution - Replace.
Fix of QADraw commands.
Modified test case: caf named_shape F6
1). Redesigned DNaming commands: SelectShape & SolveSelection
2). Added 2 new scripts: F8 & F9
Adding test cases caf/named_shape/F8 F9
#include <TNaming_Name.hxx>
#include <TNaming.hxx>
#include <TNaming_Naming.hxx>
+#include <TNaming_NamingTool.hxx>
#include <TNaming_MapOfNamedShape.hxx>
#include <TNaming_MapIteratorOfMapOfNamedShape.hxx>
#include <TDF_ChildIterator.hxx>
#include <TopAbs.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_LabelMap.hxx>
+#include <TDF_MapIteratorOfLabelMap.hxx>
#include <DBRep.hxx>
#include <Draw_Appli.hxx>
static Standard_Integer DNaming_Select (Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n > 3) {
- Standard_Boolean geometry = (strcmp(a[0],"SelectGeometry"));
+ Standard_Boolean geometry = !(strcmp(a[0],"SelectGeometry"));
Handle(TDF_Data) DF;
if(!DDF::GetDF(a[1], DF)) return 1;
TDF_Label L;
di << "DNaming_Select : Error" << "\n";
return 1;
}
+// #define DEB_SELN 1
+//=======================================================================
+//function : FillValidMap
+//purpose :
+//=======================================================================
+Standard_Boolean FillValidMap(const TDF_Label& theLabel, TDF_LabelMap& theValidMap)
+{
+ Standard_Boolean extRefFound = Standard_False;
+ TDF_AttributeMap anExtMap;
+#ifdef DEB_SELN
+ TCollection_AsciiString entr1;
+ TDF_Tool::Entry(theLabel, entr1);
+ cout<<"\tNaming Attribute at = "<< entr1 <<endl;
+#endif
+ TDF_ChildIterator itr(theLabel, Standard_True);
+ for ( ;itr.More(); itr.Next()) {
+ const TDF_Label& aLabel = itr.Value();
+ Handle(TNaming_Naming) aNaming;
+ if(!aLabel.IsNull())
+ aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming);
+ if(aNaming.IsNull()) continue;
+#ifdef DEB_SELN
+ TDF_Tool::Entry(aLabel, entr1);
+ cout<<"\tNaming Attribute at = "<< entr1 <<endl;
+#endif
+ TDF_Tool::OutReferences(aLabel,anExtMap);
+ for (TDF_MapIteratorOfAttributeMap attMItr(anExtMap);attMItr.More(); attMItr.Next()) {
+ Handle(TDF_Attribute) att = attMItr.Key();
+#ifdef DEB_SELN
+ TDF_Tool::Entry(att->Label(), entr1);
+ cout<<"## References attribute dynamic type = "<<att->DynamicType()<<" at Label = "<<entr1 <<endl;
+#endif
+ if (att->Label().IsDifferent(aLabel) && !att->Label().IsDescendant(theLabel)) {
+ theValidMap.Add(att->Label());
+ Handle(TNaming_NamedShape) aNS;
+ att->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS);
+ if(!aNS.IsNull())
+ TNaming_NamingTool::BuildDescendants(aNS, theValidMap);
+ extRefFound = Standard_True;
+ }
+ }
+ }
+ return extRefFound;
+}
//=======================================================================
//function : SolveSelection
Handle(TDF_Data) DF;
if(!DDF::GetDF(a[1], DF)) return 1;
TDF_Label L;
- DDF::AddLabel(DF,a[2],L);
- //Handle(TNaming_Naming) naming;
- //if (!L.FindAttribute(TNaming_Naming::GetID(),naming)) {
- // cout <<"DNaming_DumpSelection : not a selection" << endl;
- // return 1;
- //}
- //naming->Solve();
- //Handle(TNaming_NamedShape) NS;
- //if (!L.FindAttribute(TNaming_NamedShape::GetID(),NS)) {
- // cout <<"DNaming_DumpSelection : not done" << endl;
- // return 1;
- //}
+ DDF::AddLabel(DF,a[2],L);
+
+ Handle(TNaming_Naming) naming;
+ if (!L.FindAttribute(TNaming_Naming::GetID(),naming)) {
+ cout <<"DNaming__SolveSelection : not a selection" << endl;
+ return 1;
+ }
+ TDF_LabelMap aValidMap;
+ if(!FillValidMap(L,aValidMap))
+ di << "Valid map is empty" << "\n";
+#ifdef DEB_SELN
+ cout<<"== Valid Label map =="<<endl;
+ for (TDF_MapIteratorOfLabelMap mapItr(aValidMap);mapItr.More(); mapItr.Next()) {
+ const TDF_Label& aLab = mapItr.Key();
+
+ TCollection_AsciiString entr1;
+ TDF_Tool::Entry(aLab, entr1);
+ cout<<" Label = "<<entr1 <<endl;
+ }
+#endif
+
TNaming_Selector SL (L);
- TDF_LabelMap dummy;
- SL.Solve(dummy);
+ Standard_Boolean isSolved = SL.Solve(aValidMap);
+ if(!isSolved)
+ di << "!!! Solver is failed" <<"\n";
TopoDS_Shape Res = TNaming_Tool::CurrentShape(SL.NamedShape());
- //TopoDS_Shape Res = TNaming_Tool::CurrentShape(NS);
sprintf (name,"%s_%s","new",a[2]);
Display (name,Res);
return 0;
i=1;
aNam = "Boundaries";
#endif
+ Standard_Boolean isDone = Standard_False;
if(SCand.Extent() == 1) { // check if a collection is inside
TopTools_MapIteratorOfMapOfShape it(SCand);
const TopoDS_Shape& aS = it.Key();
} //2
if (Keep) {
B.Select (S,S);
+ isDone = Standard_True;
#ifdef MDTV_DEB_FNB
DbgTools_Write(S, "FilterByNbs_Sel.brep") ;
#endif
}
} //1
- return Standard_True;
+ return isDone;
}
//=======================================================================
//DbgTools::DisplayShape(S, F, Quantity_NOC_BLUE1);
Write(Context, "FNBS_Context.brep");
Write(S, "FNBS_S.brep");
+ Write(Neighbourg, "NBS");
#endif
#ifdef OCC273
// mpv : NS and shape must be the same
#ifdef MDTV_DEB_NBS
cout << "FilterByNBS: ";
Print_Entry(NF->Label());
+ cout <<"AppendNS = " ;
+ Print_Entry(NS->Label());
#endif
//---------------------
// Naming des voisins.
const TopoDS_Shape& aS2 = aNS->Get();
if(!aS.IsNull())
cout << "Shape arg type = " << aS.ShapeType() <<" TSH = " << aS.TShape()->This()<<endl;
- if(!aS2.IsNull())
+ if(!aS2.IsNull()) {
cout << "Build shape type = " << aS2.ShapeType() <<" TSH = " << aS2.TShape()->This()<<endl;
+ Write (aS2, "NBS_BuildShape.brep");
+ }
+ if(aNS.IsNull()) {
+ cout <<"AppendNS = " ;
+ Print_Entry(aNS->Label());
+ }
#endif
const TopoDS_Shape aSNS = aNS->Get(); //allow child level
-isos 12
+# ============= OCAF ============================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E1 (ShapeOrientation is not used)
+#
+# 1. Create Box B2
+# 2. Create Cylinder Cyl
+# 3. Cut (B2, Cyl)
+# 4. Make Fillet
+# 5. Make selection for all sub-shapes
+# 6. Modify B2
+# 7. Recompute modeling functions
+# 8. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
NewCommand D
BoxDX D $B2 290
-# recomputation
+#7 recomputation modeling functions
NewCommand D
InitLogBook D; ## to be initialized before any recomputation of impacted functions set (if attachments are presented)
ComputeFun D $F2;
GetShape D $Fill:2 S
don S
+#8 Recompute selections
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E2 (ShapeOrientation is used only for SingleSelection)
+# 1. Create Box B2
+# 2. Translate B2 along XYZ
+# 3. Translate B2 along Line (edge of B2)
+# 4. Rotate B2 around Line (edge of translated B2)
+# 5. Mirror B2 relative face of just rotated B2
+# 6. Make fillet on B2
+# 7. Make selection for all sub-shapes
+# 8. Recompute modeling functions
+# 9. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
#Box|Sph|Cyl|Cut|Fuse|Prism|Revol|PTxyz|PTALine|PRLine|PMirr|Fillet|Attach|XAttach
# order of functions recomputation should be defined out of the tool (by end user)
-#Commands of transformation:
-#PTranslateDXYZ Doc ShapeEntry dx dy dz
-#PTranslateAlongLine Doc ShapeEntry Line off
-#PRotateRoundLine Doc ShapeEntry Line Angle
-#PMirror Doc ShapeEntry PlaneObj
-
## Test of transformation functions
AddDriver D Box Attach PTxyz PTALine PRLine PMirr Sph
+
#1 - create box using more flexible set of commands
NewCommand D
set B2 [AddObject D]; ## add object
ComputeFun D $Fill
GetShape D $Fill:2 SF-new
+#9 Recompute selections
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E3 (ShapeOrientation is used only for SingleSelection)
+# 1. Create box B2
+# 2. Create box B1
+# 3. Translate B2 along XYZ
+# 4. CS = Cut (B2, B1)
+# 5. Make selection for all sub-shapes
+# 6. Modify B2
+# 7. Recompute modeling functions
+# 8. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
NewDocument D MDTV-Standard
+
AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
#1 Box creation
NewCommand D
erase
GetShape D $CS:2 S
don S
+
+#8 Recompute selections
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E4 (ShapeOrientation is not used)
+# 1. Create box B2
+# 2. Create cylinder Cyl
+# 3. Translate Cyl along XYZ
+# 4. CS = Cut (B2, Cyl)
+# 5. Make selection for all sub-shapes
+# 6. Modify B2
+# 7. Recompute modeling functions
+# 8. Recompute selections
+# ===============================================
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
+
erase
Close D
unset D
NewDocument D MDTV-Standard
+
AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
#1 Create Box
erase
GetShape D $CS:2 S
don S
+
+#8 Recompute selections
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E5 (ShapeOrientation is not used)
+# 1. Create box B2
+# 2. Create cylinder Cyl
+# 3. Translate Cyl along XYZ
+# 4. CS = Cut (B2, Cyl)
+# 5. Make single selection for all sub-shapes
+# 6. Modify B2
+# 7. Recompute modeling functions
+# 8. Recompute selections
+# ===============================================
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
+
erase
Close D
unset D
NewDocument D MDTV-Standard
+
AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
#1 Create Box
erase
GetShape D $CS:2 S
don S
+
+#8 Recompute selections
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E6 (ShapeOrientation is not used)
+# 1. Create box B1
+# 2. Create box B2
+# 3. Translate B1 along XYZ
+# 4. FS = B2 (B2, B1)
+# 5. Create cylinder Cyl
+# 6. CS = Cut (B1, Cyl)
+# 7. Make fillet
+# 8. Make selections for all sub-shapes
+# 9. Modify B2
+# 10. Recompute modeling functions
+# 11. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
+
erase
Close D
unset D
GetShape D $Fill:2 S
don S
-#recomputation of entities of the TestSelection commands
+#11 recomputation of entities of the TestSelection commands
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E7 (ShapeOrientation is not used)
+# 1. Create box B2
+# 2. Create prism Pr ($Prism)
+# 3. Create full revolution R1
+# 4. Translate R1 along XYZ
+# 5. FS = Fuse (Pr, R1)
+# 6. Create sectioned revolution R2
+# 7. FS2 = Fuse (B2, R2)
+# 8. FS3 = Fuse (B2, Prism)
+# 9. Make selections for all sub-shapes
+# 10. Modify B2
+# 11. Recompute modeling functions
+# 12. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
#Drivers' nick-names:
#Box|Sph|Cyl|Cut|Fuse|Prism|SecRevol|FulRevol|PTxyz|PTALine|PRLine|PMirr|Fillet|Attach|XAttach
# order of functions recomputation should be defined out of the tool (by end user)
-
-#Commands of transformation:
-#PTranslateDXYZ Doc ShapeEntry dx dy dz
-#PTranslateAlongLine Doc ShapeEntry Line off
-#PRotateRoundLine Doc ShapeEntry Line Angle
-#PMirror Doc ShapeEntry PlaneObj
-
## Test of transformation functions
AddDriver D Box Attach PTxyz PTALine PRLine PMirr Sph Prism FulRevol SecRevol
+
#1 - create box using more flexible set of commands
NewCommand D
isos 12
ComputeFun D $FRev:1
GetShape D $FRev:1:2 R1
-#5
+#4
NewCommand D
set FTr1 [PTranslateDXYZ D $FRev -250 0 0]
ComputeFun D $FTr1; ## function recomputation
GetShape D $FTr1:2 R1; ## get modified result
-#6 => fuse
+#5 => fuse
AddDriver D Fuse
set FS1 [AddFuse D $Prism $FRev]
ComputeFun D $FS1
-#7 Revol Sectioned
+#6 Revol Sectioned
GetShape D $F2:2 Box2;
explode Box2 F
explode Box2_2 E
ComputeFun D $SRev:1
GetShape D $SRev:1:2 R2
-#8
+#7
set FS2 [AddFuse D $B2 $SRev]
ComputeFun D $FS2
GetShape D $FS2:2 Box2
-#9
+#8
set FS3 [AddFuse D $B2 $Prism]
ComputeFun D $FS3
GetShape D $FS3:2 Box2
-#7
+#9
NewCommand D
set SL [TestSingleSelection D $B2 0]
set SL2 [TestMultipleSelection D $B2 0]
# both have failed units!!!
+#10
NewCommand D
BoxDZ D $B2 420
-#8 order of recomputation
+#11 order of recomputation
NewCommand D
InitLogBook D; ## to be initialized before any recomputation of impacted functions set (if attachments are presented)
ComputeFun D $F2;
ComputeFun D $FS3
GetShape D $FS3:2 Box2
-
+#12
SolveFlatFrom D $SL
NewCommand D
-#11 Sphere
-#explode Box2 V
-#set SPnt1 [AttachShape D Box2_1 ${B2} ${B2}]
-#set Sph1 [AddSphere D $SPnt1 30]
-#ComputeFun D $Sph1:1
-#GetShape D $Sph1:1:2 Sph
\ No newline at end of file
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E8 (ShapeOrientation is not used)
+# 1. Create box B2
+# 2. Create sectioned revolution R1 ($SRev1)
+# 3. Create sectioned revolution R2 ($SRev2)
+# 4. Create sectioned revolution R3 ($SRev3)
+# 5. ($FS1)R1 = Fuse (R1, R2)
+# 6. ($FS2)R1 = Fuse (R1, R3)
+# 7. Make selections for all sub-shapes
+# 8. Modify B2
+# 9. Recompute modeling functions
+# 10. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
#Box|Sph|Cyl|Cut|Fuse|Prism|SecRevol|FulRevol|PTxyz|PTALine|PRLine|PMirr|Fillet|Attach|XAttach
# order of functions recomputation should be defined out of the tool (by end user)
-#Commands of transformation:
-#PTranslateDXYZ Doc ShapeEntry dx dy dz
-#PTranslateAlongLine Doc ShapeEntry Line off
-#PRotateRoundLine Doc ShapeEntry Line Angle
-#PMirror Doc ShapeEntry PlaneObj
-
## Test of transformation functions
AddDriver D Box Attach PTxyz PTALine PRLine PMirr Sph Prism FulRevol SecRevol
+
#1 - create box using more flexible set of commands
NewCommand D
isos 12
ComputeFun D $SRev3:1
GetShape D $SRev3:1:2 R2
-#8
+#5
AddDriver D Fuse
set FS1 [AddFuse D $SRev1 $SRev2]
ComputeFun D $FS1
GetShape D $FS1:2 R1
-#9
+#6
set FS2 [AddFuse D $SRev1 $SRev3]
ComputeFun D $FS2
GetShape D $FS2:2 R1
-#10
+#7
NewCommand D
set SL [TestSingleSelection D $B2 0]
set SL2 [TestMultipleSelection D $B2 0]
-
+#8
NewCommand D
BoxDZ D $B2 420
-#8 order of recomputation
+#9 order of recomputation
NewCommand D
InitLogBook D; ## to be initialized before any recomputation of impacted functions set (if attachments are presented)
ComputeFun D $F2;
ComputeFun D $FS2
GetShape D $FS2:2 R1
+#10
SolveFlatFrom D $SL
NewCommand D
+# ============= OCAF ============================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: E9 (ShapeOrientation is not used)
+#
+# 1. Create Box B1
+# 2. Create 4 spheres ($Sph1 - $Sph4)
+# 3. Rotate all spheres around line
+# 4. Fuse all spheres with box B1
+# 5. Make selection for all sub-shapes
+# 6. Modify B1
+# 7. Recompute modeling functions
+# 8. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
NewDocument D MDTV-Standard
isos 12
+
#1 - create Box using short-cut
NewCommand D
AddDriver D Box; ## add box driver to driver table
GetReference D $B1; ## check is reference set
-#2 - create 8 spheres
+#2 - create 4 spheres
AddDriver D Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
NewCommand D
explode Box1 V
GetShape D $FS4:2 Box1
-#recomputation of entities of the TestSelection commands
+#8 recomputation of entities of the TestSelection commands
SolveFlatFrom D $SL
NewCommand D
+# ============= OCAF ============================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: F1 (ShapeOrientation is not used)
+#
+# 1. Create Box B2
+# 2. Create cylinder $Cyl
+# 3. Translate $Cyl along XYZ
+# 4. $CS = Cut ($B2, $Cyl)
+# 5. Create 4 points as attachments of box $B2
+# 6. Create 4 spheres ($Sph1, $Sph2, $Sph9, $Sph11)
+# 7. Rotate spheres $Sph1, $Sph2 around line
+# 8. Fuse all spheres with box B2
+# 9. Make selection for all sub-shapes
+# 10. Modify B2
+# 11. Recompute modeling functions
+# 12. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
explode S V
set SPnt1 [AttachShape D S_1 ${B2} ${B2} 0]; ## set attachment
set SPnt2 [AttachShape D S_2 ${B2} ${B2} 0]; ## set attachment
-#set SPnt5 [AttachShape D S_5 ${B2} ${B2} 0]; ## set attachment
-#set SPnt6 [AttachShape D S_6 ${B2} ${B2} 0]; ## set attachment
-#set SPnt7 [AttachShape D S_7 ${B2} ${B2} 0]; ## set attachment
set SPnt9 [AttachShape D S_9 ${B2} ${B2} 0]; ## set attachment
set SPnt11 [AttachShape D S_11 ${B2} ${B2} 0]; ## set attachment
-#set SPnt12 [AttachShape D S_12 ${B2} ${B2} 0]; ## set attachment
-#6 create 8 Spheres
+
+#6 create 4 Spheres
set Sph1 [AddSphere D $SPnt1 15]
ComputeFun D $Sph1:1
GetShape D $Sph1:1:2 Sp1
ComputeFun D $Sph2:1
GetShape D $Sph2:1:2 Sp2
-#set Sph5 [AddSphere D $SPnt5 15]
-#ComputeFun D $Sph5:1
-#GetShape D $Sph5:1:2 Sp5
-
-#set Sph6 [AddSphere D $SPnt6 15]
-#ComputeFun D $Sph6:1
-#GetShape D $Sph6:1:2 Sp6
-
-#set Sph7 [AddSphere D $SPnt7 15]
-#ComputeFun D $Sph7:1
-#GetShape D $Sph7:1:2 Sp7
-
set Sph9 [AddSphere D $SPnt9 15]
ComputeFun D $Sph9:1
GetShape D $Sph9:1:2 Sp9
ComputeFun D $Sph11:1
GetShape D $Sph11:1:2 Sp11
-#set Sph12 [AddSphere D $SPnt12 15]
-#ComputeFun D $Sph12:1
-#GetShape D $Sph12:1:2 Sp12
-
+#7
explode Box2 E
set Sel61 [AttachShape D Box2_1 ${B2} ${B2} 0];
set FR1 [PRotateRoundLine D $Sph1 $Sel61 120]
ComputeFun D $FR2
GetShape D $FR2:2 Sp2
-#7 Fuse spheres
+#8 Fuse 4 spheres
set FS1 [AddFuse D $B2 $Sph1]
ComputeFun D $FS1
GetShape D $FS1:2 S
ComputeFun D $FS2
GetShape D $FS2:2 S
-#set FS5 [AddFuse D $B2 $Sph5]
-#ComputeFun D $FS5
-## <=== it gives NOT VALID shape
-#GetShape D $FS5:2 S
set FS9 [AddFuse D $B2 $Sph9]
ComputeFun D $FS9
GetShape D $FS11:2 S
-#5 test Naming
+#9 test Naming
set SL [TestSingleSelection D $B2 0]
set SL2 [TestMultipleSelection D $B2 0]
-#6 Modification
+#10 Modification
NewCommand D
BoxDX D $B2 250
BoxDZ D $B2 310
-#7 recompute
+#11 recompute
NewCommand D
InitLogBook D
ComputeFun D $F2
erase
GetShape D $FS11:2 S
+#12
SolveFlatFrom D $SL
NewCommand D
+# ============= OCAF ============================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: F2 (ShapeOrientation is not used)
+#
+# 1. Create Box $B1 (Box1)
+# 2. Create sphere $Sph1
+# 3. Create sphere $Sph2
+# 4. Translate sphere $Sph2 along XYZ
+# 5. Fuse spheres $FS1 = Fuse ($Sph1, $Sph2)
+# 6. Make selection for all sub-shapes
+# 7. Modify B1
+# 8. Recompute modeling functions
+# 9. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
GetReference D $B1; ## check is reference set
-#2 - create 8 spheres
+#2 - create sphere1
AddDriver D Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
NewCommand D
explode Box1 V
GetShape D $FS1:2 Sp1
-#recomputation of entities of the TestSelection commands
+#9 recomputation of entities of the TestSelection commands
SolveFlatFrom D $SL
NewCommand D
+# ============= OCAF ============================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: F3 (ShapeOrientation is not used)
+#
+# 1. Create Box $B1
+# 2. Create sphere $Sph0
+# 3. Create sphere $Sph1 and move it along XYZ
+# 4. Create sphere $Sph2 and move it along XYZ
+# 5. Create sphere $Sph3 and rotate it around line and move after along XYZ
+# 6. Create sphere $Sph4 and move it along XYZ
+# 7. Cut spheres: $Cut1 = Cut($Sph0, $Sph1)
+# $Cut2 = Cut($Sph0, $Sph2)
+# $Cut3 = Cut($Sph0, $Sph3)
+# $Cut4 = Cut($Sph0, $Sph4)
+# 8. Make selection for all sub-shapes
+# 9. Modify B2
+# 10. Recompute modeling functions
+# 11. Recompute selections
+# ===============================================
+
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
GetReference D $B1; ## check is reference set
-#2 - create main sphere
+#2 - create main sphere Sp0
AddDriver D Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
NewCommand D
explode Box1 V
GetShape D $Cut4:2 Sp0
-#5 test selection
+#8 test selection
NewCommand D
set SL [TestSingleSelection D $Sph0 0]
set SL2 [TestMultipleSelection D $Sph0 0]
-#6 modification
+#9 modification
NewCommand D
BoxDZ D $B1 270
-#7 recomputation
+#10 recomputation
NewCommand D
InitLogBook D; ## to be initialized before any recomputation of impacted functions set (if attachments are presented)
ComputeFun D $B1:1
GetShape D $Cut4:2 Sp0
-#recomputation of entities of the TestSelection commands
+#11 recomputation of entities of the TestSelection commands
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: F4 (ShapeOrientation is not used)
+# 1. Create box $B2
+# 2. Create prism Pr1 ($Prism1)
+# 3. Create prism Pr2 ($Prism2)
+# 4. $FS1 = Fuse ($Prism1, $Prism2)
+# 5. Make selections for all sub-shapes
+# 6. Modify B2
+# 7. Recompute modeling functions
+# 8. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
#Drivers' nick-names:
#Box|Sph|Cyl|Cut|Fuse|Prism|SecRevol|FulRevol|PTxyz|PTALine|PRLine|PMirr|Fillet|Attach|XAttach
# order of functions recomputation should be defined out of the tool (by end user)
-
AddDriver D Box Attach PTxyz PTALine PRLine PMirr Sph Prism FulRevol SecRevol
+
#1 - create box using more flexible set of commands
NewCommand D
isos 12
set SL2 [TestMultipleSelection D $Prism1 0]
# both have failed units!!!
+#6
NewCommand D
BoxDZ D $B2 420
-#6 order of recomputation
+#7 order of recomputation
NewCommand D
InitLogBook D; ## to be initialized before any recomputation of impacted functions set (if attachments are presented)
ComputeFun D $F2;
ComputeFun D $Prism2:1
ComputeFun D $FS1
+
+#8
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: F5 (ShapeOrientation is not used)
+# 1. Create 4 points: $Pnt1 - $Pnt4
+# 2. Create closed line $Lin2
+# 3. Create prism Pr ($Prism)
+# 4. Create 2 prisms $Prism1, $Prism2
+# 5. $FS1 = Fuse ($Prism1, $Prism2); $FS2 = Fuse ($Prism1, $Prism3)
+# 6. Create sphere $Sph
+# 7. Cut sphere $Cut1 = Cut ($Prism, $Sph)
+# 8. Make selections for all sub-shapes
+# 9. Modify $Pnt1
+# 10. Recompute modeling functions
+# 11. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
NewDocument D MDTV-Standard
isos 12
+
#1 - create 4 Pnts
NewCommand D
AddDriver D PntXYZ PntRLT Line3D Attach;
GetShape D $Pnt3:1:2 P3;
GetShape D $Pnt4:1:2 P4;
-#2 create open Lin1
-#NewCommand D
-#set Lin1 [ AddLine3D D 0 $Pnt1 $Pnt2 $Pnt3 $Pnt4]
-#ComputeFun D $Lin1:1;
-#GetShape D $Lin1:1:2 L1;
-
-#3 create closed Lin3
+#2 create closed Lin2
NewCommand D
set Lin2 [ AddLine3D D 1 $Pnt1 $Pnt2 $Pnt3 $Pnt4]
ComputeFun D $Lin2:1;
GetShape D $Lin2:1:2 L1;
-#4 Prism (after step #1)
+#3 Prism
NewCommand D
AddDriver D Prism
set Prism [AddPrism D $Lin2 300 0]
GetShape D $Prism:1:2 Pr
GetReference D $Prism; ## check is reference set
-#5 create two prisms
+#4 create two prisms
NewCommand D
explode Pr F
set Bas1 [AttachShape D Pr_1 ${Prism} ${Prism} 1]
ComputeFun D $Prism3:1
GetShape D $Prism3:1:2 Pr3
-#6 => fuse
+#5 => fuse
NewCommand D
AddDriver D Fuse Sph Cut
set FS1 [AddFuse D $Prism $Prism2]
ComputeFun D $FS2
GetShape D $FS2:2 Pr
+#6
set Sph [AddSphere D $Pnt3 150]
NewCommand D
ComputeFun D $Sph:1
#GetShape D $Prism2:1:2 Pr2
#GetShape D $Prism3:1:2 Pr3
-#recomputation of entities of the TestSelection commands
+#11 recomputation of entities of the TestSelection commands
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: F6 (ShapeOrientation is not used)
+# 1. Create 4 points: $Pnt1 - $Pnt4
+# 2. Create closed line $Lin2
+# 3. Create prism Pr ($Prism)
+# 4. Addbox $B1
+# 5. Translate box $B1 along XYZ
+# 6. $Com1 = Common ($Prism, $B1)
+# 7. Add cylinder $Cyl
+# 8. Translate cylinder $Cyl along XYZ
+# 9. Cut $Cut1 = Cut ($Prism, $Cyl)
+# 10. Make selections for all sub-shapes
+# 11. Modify $Pnt1
+# 12. Recompute modeling functions
+# 13. Recompute selections
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
NewDocument D MDTV-Standard
isos 12
+
#1 - create 4 Pnts
NewCommand D
AddDriver D PntXYZ PntRLT Line3D Attach;
GetShape D $Pnt3:1:2 P3;
GetShape D $Pnt4:1:2 P4;
-#2 create open Lin1
-#NewCommand D
-#set Lin1 [ AddLine3D D 0 $Pnt1 $Pnt2 $Pnt3 $Pnt4]
-#ComputeFun D $Lin1:1;
-#GetShape D $Lin1:1:2 L1;
-#3 create closed Lin3
+#2 create closed Lin2
NewCommand D
set Lin2 [ AddLine3D D 1 $Pnt1 $Pnt2 $Pnt3 $Pnt4]
ComputeFun D $Lin2:1;
GetShape D $Lin2:1:2 L1;
-#4 Prism (after step #1)
+#3 Prism
NewCommand D
AddDriver D Prism Box PTxyz
set Prism [AddPrism D $Lin2 300 0]
GetShape D $Prism:1:2 Pr
GetReference D $Prism; ## check is reference set
-#5 Add Box
+#4 Add Box
NewCommand D
set B1 [AddBox D 400 140 600];
ComputeFun D $B1:1;
GetShape D $B1:1:2 Box;
-#6 Translate Box1
+#5 Translate Box1
NewCommand D
set FTr1 [PTranslateDXYZ D $B1 -100 -20 -100]
ComputeFun D $FTr1
GetShape D $B1:2:2 Box
-#7 add Common
+#6 add Common
NewCommand D
AddDriver D Comm Cut Fuse
set Com1 [AddCommon D $Prism $B1]
ComputeFun D $Com1
GetShape D $Com1:2 Pr
-#8 add Cylinder
+#7 add Cylinder
NewCommand D
explode Pr E
AddDriver D Attach Cyl
ComputeFun D $Cyl:1
GetShape D $Cyl:1:2 CylS
-#9 Translate Cylinder
+#8 Translate Cylinder
NewCommand D
set FTr1 [PTranslateDXYZ D $Cyl -100 200 170]
ComputeFun D $FTr1
GetShape D $Cyl:2:2 CylS
-#10 Cut Prism by Cylinder
+#9 Cut Prism by Cylinder
set Cut1 [AddCut D $Prism $Cyl]
ComputeFun D $Cut1
GetShape D $Cut1:2 Pr
don Pr
-#11 test selection
+#10 test selection
NewCommand D
set SL [TestSingleSelection D $Prism 0]
set SL2 [TestMultipleSelection D $Prism 0]
-#12 modify
+#11 modify
NewCommand D
PntOffset D $Pnt1 20 25 skip
-#13 recompute
+#12 recompute
NewCommand D
ComputeFun D $Pnt1:1
ComputeFun D $Lin2:1
GetShape D $Cut1:2 Pr
-#recomputation of entities of the TestSelection commands
+#13 recomputation of entities of the TestSelection commands
SolveFlatFrom D $SL
NewCommand D
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+#
+# Test case: F7 (test special cases of type migration)
+# 1. Create 4 points: $Pnt1 - $Pnt4
+# 2. Create closed line $Lin2
+# 3. Create prism Pr ($Prism)
+# 4. Addbox $B1
+# 5. Translate box $B1 along XYZ
+# 6. $Com1 = Common ($Prism, $B1)
+# 7. Add cylinder $Cyl
+# 8. Translate cylinder $Cyl along XYZ
+# 9. Cut $Cut1 = Cut ($Prism, $Cyl)
+# 10. Make 4 selections (Select edges 8,9, 11+, 11)
+# 11. Modify $Pnt1
+# 12. Recompute
+# ===============================================
+
#pload FULL
-#source dftree.tcl
-#source DDataStd_TreeBrowser.tcl
erase
Close D
unset D
NewDocument D MDTV-Standard
isos 12
+
#1 - create 4 Pnts
NewCommand D
AddDriver D PntXYZ PntRLT Line3D Attach;
GetShape D $Pnt3:1:2 P3;
GetShape D $Pnt4:1:2 P4;
-#2 create open Lin1
-#NewCommand D
-#set Lin1 [ AddLine3D D 0 $Pnt1 $Pnt2 $Pnt3 $Pnt4]
-#ComputeFun D $Lin1:1;
-#GetShape D $Lin1:1:2 L1;
-
-#3 create closed Lin3
+#2 create closed Lin2
NewCommand D
set Lin2 [ AddLine3D D 1 $Pnt1 $Pnt2 $Pnt3 $Pnt4]
ComputeFun D $Lin2:1;
GetShape D $Lin2:1:2 L1;
-#4 Prism (after step #1)
+#3 Prism
NewCommand D
AddDriver D Prism Box PTxyz
set Prism [AddPrism D $Lin2 300 0]
GetShape D $Prism:1:2 Pr
GetReference D $Prism; ## check is reference set
-#5 Add Box
+#4 Add Box
NewCommand D
set B1 [AddBox D 400 140 600];
ComputeFun D $B1:1;
GetShape D $B1:1:2 Box;
-#6 Translate Box1
+#5 Translate Box1
NewCommand D
set FTr1 [PTranslateDXYZ D $B1 -100 -20 -100]
ComputeFun D $FTr1
GetShape D $B1:2:2 Box
-#7 add Common
+#6 add Common
NewCommand D
AddDriver D Comm Cut Fuse
set Com1 [AddCommon D $Prism $B1]
ComputeFun D $Com1
GetShape D $Com1:2 Pr
-#8 Add Cylinder
+#7 Add Cylinder
NewCommand D
explode Pr E
AddDriver D Attach Cyl
ComputeFun D $Cyl:1
GetShape D $Cyl:1:2 CylS
-#9 Translate Cylinder
+#8 Translate Cylinder
NewCommand D
set FTr1 [PTranslateDXYZ D $Cyl -100 200 170]
ComputeFun D $FTr1
GetShape D $Cyl:2:2 CylS
-#10 Cut
+#9 Cut
NewCommand D
set Cut1 [AddCut D $Prism $Cyl]
ComputeFun D $Cut1
GetShape D $Cut1:2 Pr
don Pr
-#11 test special cases of type migration
+#10 Select edges 8,9, 11 (test special cases of type migration)
explode Pr E
erase Pr_1 Pr_2 Pr_3 Pr_4 Pr_5 Pr_6 Pr_7 Pr_8 Pr_9 Pr_10 Pr_11 Pr_12 Pr_13 Pr_14 Pr_15 Pr_16 Pr_17
display Pr_8 Pr_9
-## 8,9
+## ==> 8,9
NewCommand D
set Sel8 [AttachShape D Pr_8 ${Prism} ${Prism} 0]; ## should return Compound of two edges
set Sel9 [AttachShape D Pr_9 ${Prism} ${Prism} 1]; ## should return Compound of two edges
set Sel11 [AttachShape D Pr_11 ${Prism} ${Prism} 1];
set Sel12 [AttachShape D Pr_11 ${Prism} ${Prism} 0];
-#12 modify
+
+#11 modify
PntOffset D $Pnt1 40 25 skip
-#13 recompute
+#12 recompute
ComputeFun D $Pnt1:1
ComputeFun D $Lin2:1
ComputeFun D $Prism:1
--- /dev/null
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+# (name = FILTERBYNEIGHBOURGS)
+# Check type migration
+# ===============================================
+# Test case: F8 (testing using SelectShape & SolveSelection)
+# 1. Create 3 boxes $B1, $B2, $B3
+# 2. $FS1 = Fuse ($B1, $B2)
+# 3. $FS2 = Fuse ($B1, $B3)
+# 4. Make selections of the face 'fuse2_10'
+# 5. Modify B2
+# 6. Recompute
+# ===============================================
+
+pload FULL
+set doc d16
+NewDocument $doc MDTV-Standard
+AddDriver $doc Box Fuse Attach
+
+#1. create 3 boxes
+set B1 [AddBox $doc 100 200 350]
+set B2 [AddBox $doc 330 330 90]
+set B3 [AddBox $doc 60 450 150]
+ComputeFun $doc $B1:1
+ComputeFun $doc $B2:1
+ComputeFun $doc $B3:1
+
+#2. B1 = fuse (B1, B2)
+set FS1 [AddFuse $doc $B1 $B2]
+ComputeFun $doc $FS1
+
+#3. B1 = fuse (B1, B3)
+set FS2 [AddFuse $doc $B1 $B3]
+ComputeFun $doc $FS2
+GetShape $doc $FS2:2 fuse2
+explode fuse2 f
+
+
+#4. select fuse2_10 (using SelectShape)
+set Sel1 0:2:10
+SelectShape $doc $Sel1 fuse2_10 fuse2
+GetShape $doc $Sel1 f10before
+#f10before is face
+set info1 [whatis f10before]
+
+
+#5. Modify
+BoxDZ $doc $B2 120
+
+#6. recompute
+ComputeFun $doc $B2:1
+ComputeFun $doc $FS1
+ComputeFun $doc $FS2
+SolveSelection $doc $Sel1
+GetShape $doc $Sel1 f10after
+#f10after is face
+set info2 [whatis f10after]
+
+if { [regexp "shape" $info1] != 1 } {
+ puts "Error : There is not word shape in f10after"
+}
+if { [regexp "FACE" $info1] != 1 } {
+ puts "Error : There is not word FACE in f10after"
+}
+if { [regexp "REVERSED" $info1] != 1 } {
+ puts "Error : There is not word REVERSED in f10after"
+}
+if { [regexp "Modified" $info1] != 1 } {
+ puts "Error : There is not word Modified in f10after"
+}
+if { [regexp "Orientable" $info1] != 1 } {
+ puts "Error : There is not word Orientable in f10after"
+}
+
+if { [regexp "shape" $info2] != 1 } {
+ puts "Error : There is not word shape in f10before"
+}
+if { [regexp "FACE" $info2] != 1 } {
+ puts "Error : There is not word FACE in f10before"
+}
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error : There is not word REVERSED in f10before"
+}
+if { [regexp "Modified" $info2] != 1 } {
+ puts "Error : There is not word Modified in f10before"
+}
+if { [regexp "Orientable" $info2] != 1 } {
+ puts "Error : There is not word Orientable in f10before"
+}
+
+
+
--- /dev/null
+# =================== OCAF ======================
+# Naming
+#
+# Testing purpose: Naming selection mechanism
+# (name = FILTERBYNEIGHBOURGS)
+# Check type migration
+# ===============================================
+# Test case: F9 (testing using AttachShape & ComputeFun)
+# 1. Create 3 boxes $B1, $B2, $B3
+# 2. $FS1 = Fuse ($B1, $B2)
+# 3. $FS2 = Fuse ($B1, $B3)
+# 4. Make selections of the face 'fuse2_10'
+# 5. Modify B2
+# 6. Recompute
+# ===============================================
+
+pload FULL
+set doc d16
+NewDocument $doc MDTV-Standard
+AddDriver $doc Box Fuse Attach
+#1.create 3 boxes
+set B1 [AddBox $doc 100 200 350]
+set B2 [AddBox $doc 330 330 90]
+set B3 [AddBox $doc 60 450 150]
+ComputeFun $doc $B1:1
+ComputeFun $doc $B2:1
+ComputeFun $doc $B3:1
+
+#2. B1 = fuse (B1 B2)
+set FS1 [AddFuse $doc $B1 $B2]
+ComputeFun $doc $FS1
+
+#3. B1 = fuse (B1 B3)
+set FS2 [AddFuse $doc $B1 $B3]
+ComputeFun $doc $FS2
+GetShape $doc $FS2:2 fuse2
+explode fuse2 f
+
+
+
+#4. Select fuse2_10 using Attach
+set Sel2 [AttachShape $doc fuse2_10 $B1]
+GetShape $doc $Sel2:1:2 nf10before
+#nf10before is face
+set info1 [whatis nf10before]
+
+
+#5. Modify
+BoxDZ $doc $B2 125
+
+#6. Recompute - Alternative way of solving
+InitLogBook $doc
+ComputeFun $doc $B1:1
+ComputeFun $doc $B2:1
+ComputeFun $doc $B3:1
+ComputeFun $doc $FS1
+ComputeFun $doc $FS2
+ComputeFun $doc $Sel2:1
+GetShape $doc $Sel2:1:2 nf10after
+#nf10after is face
+set info2 [whatis nf10after]
+
+if { [regexp "shape" $info1] != 1 } {
+ puts "Error : There is not word shape in nf10after"
+}
+if { [regexp "FACE" $info1] != 1 } {
+ puts "Error : There is not word FACE in nf10after"
+}
+if { [regexp "REVERSED" $info1] != 1 } {
+ puts "Error : There is not word REVERSED in nf10after"
+}
+if { [regexp "Modified" $info1] != 1 } {
+ puts "Error : There is not word Modified in nf10after"
+}
+if { [regexp "Orientable" $info1] != 1 } {
+ puts "Error : There is not word Orientable in nf10after"
+}
+
+if { [regexp "shape" $info2] != 1 } {
+ puts "Error : There is not word shape in nf10before"
+}
+if { [regexp "FACE" $info2] != 1 } {
+ puts "Error : There is not word FACE in nf10before"
+}
+if { [regexp "REVERSED" $info2] != 1 } {
+ puts "Error : There is not word REVERSED in nf10before"
+}
+if { [regexp "Modified" $info2] != 1 } {
+ puts "Error : There is not word Modified in nf10before"
+}
+if { [regexp "Orientable" $info2] != 1 } {
+ puts "Error : There is not word Orientable in nf10before"
+}
\ No newline at end of file