View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0026987 | Community | OCCT:Application Framework | public | 2015-12-13 10:36 | 2016-03-23 12:49 |
| Reporter | id_wangyue | Assigned To | bugmaster | ||
| Priority | normal | Severity | minor | ||
| Status | closed | Resolution | fixed | ||
| Platform | ubuntu | OS | linux | ||
| Product Version | 6.9.1 | ||||
| Summary | 0026987: Sometimes, TNaming_Selector can not give a correct TNaming_NamedShape | ||||
| Description | in the condition of uisng OCAF: condition 1: step1, build two cylinder, one: height=100, radius=100; the other: height=100, radius=200. step 2, boolean operation, by using the second cylinder to cut the first, a resultShape can be got. step 3, to open local context(TopoDS_Face) and select a local face of the resultShape; result: a wrong result will be found: ////////////////////////////// condition2: step1: import the exported resultShape(which can be get in the condition1) step2: to open local context(TopoDS_Face) and select a local face of the resultShape; result: right the following is the codes for testing: Standard_Boolean OCAF_ISelection::Select(const TopoDS_Shape& theShape, const TopoDS_Shape& theContext) { TDF_Label aResultLabel = GetEntry().FindChild(RESULTS_TAG); TDF_Label aContexLabel = GetEntry().FindChild(ARGUMENTS_TAG).FindChild(SELECTION_CONTEXT_TAG); // 1. Find the TNaming_NamedShape according TopoDS_Shape "theShape" Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(theContext, myTreeNode->Label()); // 2. check whether "aNS" is Null and check whether "aNS" is created by a Function if(aNS.IsNull() || !aNS->Label().Father().IsAttribute(TFunction_Function::GetID())) return Standard_False; // 3.1 construct a TNaming_Selector "aSelector" at aResultlabel TNaming_Selector aSelector(aResultLabel); // 3.2 Using "aSelector" to select "theShape" from "theContext" Standard_Boolean aStatus = aSelector.Select(theShape, theContext); //Standard_Boolean aStatus = aSelector.Select(theShape, theShape); //* Handle(TNaming_NamedShape) aNamedShape = aSelector.NamedShape (); // for test ----------------2015.12.09 TopoDS_Shape tmpShape = aNamedShape->Get(); // for test ----------------2015.12.09 BRepTools::Write(theContext,"theContextShape.brep"); // for test ----------------2015.12.09 BRepTools::Write(theShape,"theSelectedShape.brep"); // for test ----------------2015.12.09 BRepTools::Write(tmpShape,"tmpShape.brep"); // for test ----------------2015.12.09 //*/ // 4.0 set a reference from "aContextLabel" to the father label(the TFunction_Function) of "aNS" TDF_Reference::Set( aContexLabel, aNS->Label().Father() ); //Set a argument of function (theContext) return aStatus; } | ||||
| Tags | No tags attached. | ||||
| Test case number | |||||
|
|
Dear Reporter, The provided information doesn't allow to identify a mistake. There is a great probability that the problem is in initial steps (not documented in the provided scenario). I would suggested you to add a description (or source code) concerning Naming structure after each initial modeling operation: 1.Create cylinder1 2.Create cylinder2 3.Make Boolean. Without this information the problem can't be reproduced. szy |
|
|
|
|
|
|
|
|
Dear szy sorry, so late to answer you. I have attached some codes... |
|
|
Dear reporter, I would like to put several comments to you request. 1.First of all your condition_1 is incorrect from the very beginning. Which result do you expect for your case? The result (according your input parameters) will be empty shape. The first (small) cylinder will be inside the second one (big). If you will cut the first one by the second one ==> empty shape. aCy1 = Cylinder(100,100) // R, H aCyl2 = Cylinder(200, 100) // R = 200, H = 100 result = CUT (aCyl1, aCyl2) // empty result. It means that there is nothing to do with this result. 2. Try to change parameters to make the operation having sense. For example you can move the cylinder aCyl2 to some distance to have intersection of cylinders or you may change order of arguments result = CUT (aCyl2, aCyl1) // the resulting shape will look like a cylinder with hole inside. 3. After getting result of operation you should check it for Null first. After check is it empty (in Draw you can use command 'nbshapes': > nbshapes s - shows the number of sub-shapes in <s>; And third you should check it for validity (in Draw - 'checkshape'). If all is OK then you can move to Naming Selector using. Just don't forget that result of Selector depends on your previous steps: a) modeling operation result registration in Data framework b) your own recalculation algorithm (if you are using it) c) TNaming algorithm I have checked the script analogical to your own, but building valid shape. TNaming_Selector gives correct and stable result. szy |
|
|
Not a bug. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2015-12-13 10:36 | id_wangyue | New Issue | |
| 2015-12-13 10:36 | id_wangyue | Assigned To | => szy |
| 2015-12-29 17:37 |
|
Note Added: 0049670 | |
| 2015-12-29 17:37 |
|
Assigned To | szy => id_wangyue |
| 2015-12-29 17:37 |
|
Status | new => feedback |
| 2016-01-22 18:16 | id_wangyue | File Added: sample.tar.gz | |
| 2016-01-22 18:17 | id_wangyue | File Added: Selection.tar.gz | |
| 2016-01-22 18:18 | id_wangyue | Note Added: 0050074 | |
| 2016-02-09 09:24 | id_wangyue | Assigned To | id_wangyue => szy |
| 2016-03-23 12:48 |
|
Note Added: 0051879 | |
| 2016-03-23 12:48 |
|
Assigned To | szy => id_wangyue |
| 2016-03-23 12:48 |
|
Status | feedback => acknowledged |
| 2016-03-23 12:49 |
|
Note Added: 0051880 | |
| 2016-03-23 12:49 |
|
Status | acknowledged => closed |
| 2016-03-23 12:49 |
|
Assigned To | id_wangyue => bugmaster |
| 2016-03-23 12:49 |
|
Resolution | open => fixed |