Archived issue #0033765
Data Exchange, IGES Export - Missing Model Curves in transfer cache
Description
IGESControl_Writer with mode=1 missing Model Curves in Transfer_FinderProcess
I'm trying to set name and color attributes for Curves when exporting to BRep IGES files, but the Curve IGES entities are missing the Curve entities in the Transfer_FinderProcess. The attached example produces the following output:
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
With the proposed fix below I get:
Line DNum should !=0: DNum=19
Line DNum should !=0: DNum=23
Line DNum should !=0: DNum=25
Line DNum should !=0: DNum=27
Line DNum should !=0: DNum=29
Line DNum should !=0: DNum=31
Line DNum should !=0: DNum=33
Line DNum should !=0: DNum=35
Line DNum should !=0: DNum=37
Line DNum should !=0: DNum=39
Line DNum should !=0: DNum=41
Line DNum should !=0: DNum=43
I'm trying to set name and color attributes for Curves when exporting to BRep IGES files, but the Curve IGES entities are missing the Curve entities in the Transfer_FinderProcess. The attached example produces the following output:
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
Line DNum should !=0: DNum=0
With the proposed fix below I get:
Line DNum should !=0: DNum=19
Line DNum should !=0: DNum=23
Line DNum should !=0: DNum=25
Line DNum should !=0: DNum=27
Line DNum should !=0: DNum=29
Line DNum should !=0: DNum=31
Line DNum should !=0: DNum=33
Line DNum should !=0: DNum=35
Line DNum should !=0: DNum=37
Line DNum should !=0: DNum=39
Line DNum should !=0: DNum=41
Line DNum should !=0: DNum=43
Steps to reproduce
Compile and execute the attached code snippet.
Additional information
This change to BRepToIGESBRep_Entity seems to resolve the issue:
Standard_Integer BRepToIGESBRep_Entity::AddEdge(const TopoDS_Edge& myedge,
const Handle(IGESData_IGESEntity)& mycurve3d)
{
if ( myedge.IsNull()) return 0;
const TopoDS_Shape& E = myedge;
Handle(IGESData_IGESEntity) C = mycurve3d;
Standard_Integer index = myEdges.FindIndex(E);
if (index == 0) {
index = myEdges.Add(E);
myCurves.Add(C);
} else {
myCurves.Substitute(index,C); // Fix: The most recent curve must be stored
}
return index;
}
Public activity
14 archived notes
Participants are labeled by their role within this record.
Dear Commenter 3 thank you for your. It is very helpful.
I will process your bug in the next week. But at least I will try to do that.
In case, if there will be no any notes or news, please send a new note to remind.
I found a possible more clear fix, let me check and process it :)
If you would like to became a contributor, please check https://dev.opencascade.org/content/occt-github-new-way-collaborate
I will process your bug in the next week. But at least I will try to do that.
In case, if there will be no any notes or news, please send a new note to remind.
I found a possible more clear fix, let me check and process it :)
If you would like to became a contributor, please check https://dev.opencascade.org/content/occt-github-new-way-collaborate
Commenter 3 but to prepare more correct fix, could you please share file sample?
And prepared test case :)
And prepared test case :)
Thank you for the prompt response!
Unfortunately getting the CLA signed by my employer is too much of a hassle for me to become a contributor.
I'm not sure what sample file you would like me to share? The problem is with the export (I believe the import is ok). I provided the attached Attachment 2 (CPP) file that reproduces the problem. Could you be more specific about what you would like? I also, unfortunately, am not familiar with the testing framework used by OCC to provide a test case... I regularly use other unit testing frameworks.
I'd be glad to test out your clearer fix.
Unfortunately getting the CLA signed by my employer is too much of a hassle for me to become a contributor.
I'm not sure what sample file you would like me to share? The problem is with the export (I believe the import is ok). I provided the attached Attachment 2 (CPP) file that reproduces the problem. Could you be more specific about what you would like? I also, unfortunately, am not familiar with the testing framework used by OCC to provide a test case... I regularly use other unit testing frameworks.
I'd be glad to test out your clearer fix.
Thank you, sorry, i didn't check the cpp file.
I thought that that filed contained fix. But it is a sample to reproduce. That even more helpful.
I thought that that filed contained fix. But it is a sample to reproduce. That even more helpful.
I should point out that what I put together was minimal to demonstrate this specific problem. I think a more rigorous test would be to loop over all the sub-shapes and make sure they are found in the cache.
Please let me know if I can help in any other way.
Please let me know if I can help in any other way.
Commenter 4 I was curious if you had an update on the cleaner fix for this bug? I believe your first message asked me to ping you around this time.
@galbrams thank you.
Yes, I was asking to ping me. My apologies, there is no update for now. I will try to prepare changes in ongoing days.
Yes, I was asking to ping me. My apologies, there is no update for now. I will try to prepare changes in ongoing days.
Branch [archived branch] has been created by Commenter 2.
[revision removed]
Detailed log of new commits:
Author: Commenter 2
Date: Tue Sep 10 18:15:18 2024 +0000
0033765: Data Exchange, IGES Export - Missing Model Curves in transfer cache
Curve list should be not unique, list is recommended.
One curve can be used by multiple edges.
[revision removed]
Detailed log of new commits:
Author: Commenter 2
Date: Tue Sep 10 18:15:18 2024 +0000
0033765: Data Exchange, IGES Export - Missing Model Curves in transfer cache
Curve list should be not unique, list is recommended.
One curve can be used by multiple edges.
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
This bug has reappeared with the latest OCCT 7.9.0 release. The bug seems to be resolved by simply changing:
```
Standard_Integer BRepToIGESBRep_Entity::AddEdge(const TopoDS_Edge& myedge,
const Handle(IGESData_IGESEntity)& mycurve3d)
{
if (myedge.IsNull())
return 0;
const TopoDS_Shape& E = myedge;
Handle(IGESData_IGESEntity) C = mycurve3d;
Standard_Integer index = myEdges.FindIndex(E);
if (index == 0)
{
index = myEdges.Add(E);
myCurves.Append(C);
}
return index;
}
```
to the version below that fixes the problem:
```
Standard_Integer BRepToIGESBRep_Entity::AddEdge(const TopoDS_Edge& myedge,
const Handle(IGESData_IGESEntity)& mycurve3d)
{
if (myedge.IsNull())
return 0;
const TopoDS_Shape& E = myedge;
Handle(IGESData_IGESEntity) C = mycurve3d;
Standard_Integer index = myEdges.FindIndex(E);
if (index == 0)
{
index = myEdges.Add(E);
myCurves.Append(C);
} else {
myCurves.ChangeValue(index) = C;
}
return index;
}
```
```
Standard_Integer BRepToIGESBRep_Entity::AddEdge(const TopoDS_Edge& myedge,
const Handle(IGESData_IGESEntity)& mycurve3d)
{
if (myedge.IsNull())
return 0;
const TopoDS_Shape& E = myedge;
Handle(IGESData_IGESEntity) C = mycurve3d;
Standard_Integer index = myEdges.FindIndex(E);
if (index == 0)
{
index = myEdges.Add(E);
myCurves.Append(C);
}
return index;
}
```
to the version below that fixes the problem:
```
Standard_Integer BRepToIGESBRep_Entity::AddEdge(const TopoDS_Edge& myedge,
const Handle(IGESData_IGESEntity)& mycurve3d)
{
if (myedge.IsNull())
return 0;
const TopoDS_Shape& E = myedge;
Handle(IGESData_IGESEntity) C = mycurve3d;
Standard_Integer index = myEdges.FindIndex(E);
if (index == 0)
{
index = myEdges.Add(E);
myCurves.Append(C);
} else {
myCurves.ChangeValue(index) = C;
}
return index;
}
```
Dear Author.
Thank you for your research. I need to validate the problem logic, replacing is not safe operation. Needs to check what happened.
Migrated bug: https://github.com/Open-Cascade-SAS/OCCT/issues/428
Thank you for your research. I need to validate the problem logic, replacing is not safe operation. Needs to check what happened.
Migrated bug: https://github.com/Open-Cascade-SAS/OCCT/issues/428
You should be able to compile and run the attached Attachment 2 (CPP) to check if the fix.