View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0029374 | Community | OCCT:Data Exchange | public | 2017-12-06 18:59 | 2019-07-10 22:01 |
Reporter | ziaulazam | Assigned To | |||
Priority | normal | Severity | minor | ||
Status | new | Resolution | open | ||
Platform | MinGW-w64 | OS | Windows | ||
Target Version | Unscheduled | ||||
Summary | 0029374: Names of underlying geometric entities cannot be set for TopoDS_Compound | ||||
Description | If a TopoDS_Wire and TopoDS_Compound are made from two TopoDS_Edge(s) and we try to set the name of these edges during exporting of entities to a STEP file, then we are only able to set the name for one of the edge in the case of TopoDS_Compound but for TopoDS_Wire the names of both edges can be set. Please note that the STEP file exported through OCCT have to be imported in CATIA. CATIA extracts the names from underlying geometric primitives in order to display it to the user. The example program that exports two different files one having a compound and other a wire is pasted as "Steps to Reproduce". The output STEP files are also attached. | ||||
Steps To Reproduce | #include <TopoDS_Edge.hxx> #include <TopoDS_Wire.hxx> #include <BRepBuilderAPI_MakeEdge.hxx> #include <BRepBuilderAPI_MakeWire.hxx> #include <STEPControl_Reader.hxx> #include <STEPControl_Writer.hxx> #include <GeomAPI_Interpolate.hxx> #include <TColgp_HArray1OfPnt.hxx> #include <STEPConstruct_Styles.hxx> #include <StepRepr_RepresentationItem.hxx> #include <STEPConstruct.hxx> #include <StepShape_GeometricSetSelect.hxx> #include <StepShape_GeometricSet.hxx> #include <StepGeom_Curve.hxx> #include <StepGeom_TrimmedCurve.hxx> #include <Precision.hxx> #include <BRep_Builder.hxx> #include <iostream> void setEntityNames(const Handle(XSControl_WorkSession)& writerWorkSession, const TopoDS_Shape& shape) { STEPConstruct_Styles style(writerWorkSession); Handle(StepRepr_RepresentationItem) representationItem = STEPConstruct::FindEntity(style.FinderProcess(), shape); if((representationItem.IsNull()) || (!representationItem->IsKind(STANDARD_TYPE(StepRepr_RepresentationItem)))) { return; } const Handle(TCollection_HAsciiString)& name = new TCollection_HAsciiString("Example Name"); representationItem->SetName(name); if (representationItem->IsKind(STANDARD_TYPE(StepShape_GeometricSet))) { Handle(StepShape_GeometricSet) geometricSet = Handle(StepShape_GeometricSet)::DownCast(representationItem); for (int index = 1; index <= geometricSet->NbElements(); ++index) { StepShape_GeometricSetSelect entity = geometricSet->ElementsValue(index); Handle(StepGeom_Curve) curve = entity.Curve(); if (!curve.IsNull()) { curve->SetName(name); if (curve->IsKind(STANDARD_TYPE(StepGeom_TrimmedCurve))) { Handle(StepGeom_TrimmedCurve) trimmedCurve = Handle(StepGeom_TrimmedCurve)::DownCast(curve); Handle(StepGeom_Curve) basis = trimmedCurve->BasisCurve(); basis->SetName(name); } } } } } int main(int, char**) { //////////////////// BSpline Construction ///////////////////////////// Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, 3); points->SetValue(1, gp_Pnt(0., 0., 0.)); points->SetValue(2, gp_Pnt(0., 10., 0.)); GeomAPI_Interpolate interpolator(points, false, Precision::Confusion()); interpolator.Perform(); const Handle(Geom_BoundedCurve)& curve1 = interpolator.Curve(); std::cout << "Status of BSpline1: " << interpolator.IsDone() << std::endl; points->SetValue(1, gp_Pnt(0., 10., 0.)); points->SetValue(2, gp_Pnt(10., 10., 0.)); interpolator = GeomAPI_Interpolate(points, false, Precision::Confusion()); interpolator.Perform(); const Handle(Geom_BoundedCurve)& curve2 = interpolator.Curve(); std::cout << "Status of BSpline2: " << interpolator.IsDone() << std::endl; TopoDS_Wire wire; BRep_Builder builder; builder.MakeWire(wire); builder.Add(wire, BRepBuilderAPI_MakeEdge(curve1)); builder.Add(wire, BRepBuilderAPI_MakeEdge(curve2)); TopoDS_Compound compound; builder.MakeCompound(compound); builder.Add(compound, BRepBuilderAPI_MakeEdge(curve1)); builder.Add(compound, BRepBuilderAPI_MakeEdge(curve2)); //////////////////////// Writing to STEP file ////////////////////////////// const std::string filePathWire = "C://Users//zia.ulazam//Desktop//TestWire.stp"; const std::string filePathCompound = "C://Users//zia.ulazam//Desktop//TestCompound.stp"; STEPControl_Writer writer; Handle(XSControl_WorkSession) writerWorkSession = writer.WS(); writer.Transfer(wire, STEPControl_AsIs); setEntityNames(writerWorkSession, wire); writer.Write(filePathWire.c_str()); writer = STEPControl_Writer(); writerWorkSession = writer.WS(); writer.Transfer(compound, STEPControl_AsIs); setEntityNames(writerWorkSession, compound); writer.Write(filePathCompound.c_str()); return 0; } | ||||
Tags | No tags attached. | ||||
Test case number | |||||
Date Modified | Username | Field | Change |
---|---|---|---|
2017-12-06 18:59 | ziaulazam | New Issue | |
2017-12-06 18:59 | ziaulazam | Assigned To | => gka |
2017-12-06 18:59 | ziaulazam | File Added: TestCompound.stp | |
2017-12-06 19:01 | ziaulazam | File Deleted: TestCompound.stp | |
2017-12-06 19:02 | ziaulazam | File Added: STEPfiles.zip | |
2019-07-10 22:01 |
|
Target Version | 7.4.0 => Unscheduled |