View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032511 | Community | PRODUCTS:DXF Import | public | 2021-08-03 17:40 | 2021-08-03 18:14 |
Reporter | lucas_morona_164500 | Assigned To | |||
Priority | normal | Severity | major | ||
Status | new | Resolution | open | ||
Platform | Windows | OS | Windows 10 | ||
Product Version | 7.3.0 | ||||
Summary | 0032511: DXF Import - OCC import Autocad dimensions lines as shapes | ||||
Description | Create an Autocad file and set dimensions in your object, OCC imports this dimensions lines as shapes, I need only shapes from model, not arrow and lines from dimensions. | ||||
Steps To Reproduce | Import DXF file using the below, DXF import Autocad dimension lines as shapes. // To extract name of layers is necessary to have a TDocStd_Document Handle(TDocStd_Document) document; Handle(XCAFApp_Application) application = XCAFApp_Application::GetApplication(); // Is necessary create a new document application->NewDocument(m_filePath.toLatin1().constData(), document); DXFCAFControl_Reader dxfReaderLayer; dxfReaderLayer.SetNameMode(true); TCollection_AsciiString filePathUtf8(m_filePath.toUtf8().constData()); dxfReaderLayer.ReadFile(filePathUtf8.ToCString()); // You must transfer your reader to document dxfReaderLayer.Transfer(document); TDF_Label rootLabel = document->Main(); // This object is important to extract layer from DXF Handle(XCAFDoc_LayerTool) layerTool = XCAFDoc_DocumentTool::LayerTool(rootLabel); // This object is important to extract shapes from layers Handle(XCAFDoc_ShapeTool) shapeTool = XCAFDoc_DocumentTool::ShapeTool(rootLabel); TDF_ChildIterator it; Handle(TDataStd_Name) layerName; for (it.Initialize(rootLabel, Standard_True); it.More(); it.Next()) { // Get only the layers attributes TDF_Label labelLayer = it.Value(); layerTool->FindAttribute(TDataStd_Name::GetID(), layerName); if (layerTool->IsLayer(labelLayer)) { if (labelLayer.FindAttribute(TDataStd_Name::GetID(), layerName)) { TDF_LabelSequence labelSequence = TDF_LabelSequence(); layerTool->GetShapesOfLayer(labelLayer, labelSequence); // Is necessary to take the layer of any edge int numbersOfShapes = labelSequence.Size(); if (numbersOfShapes > 0) { QString layer = QString(TCollection_AsciiString(layerName->Get()).ToCString()); for (TDF_LabelSequence::Iterator labelIt(labelSequence); labelIt.More(); labelIt.Next()) { TDF_Label shapeLabel = labelIt.Value(); TopoDS_Shape layerShape = shapeTool->GetShape(shapeLabel); if (layerShape.IsNull()) { continue; } if (TopAbs_VERTEX == layerShape.ShapeType()) { insertLayer(layer); insertVisibilityShape(QString(TCollection_AsciiString(layerName->Get()).ToCString()), layerShape); m_numberOfVertices++; } else if (TopAbs_EDGE == layerShape.ShapeType()) { insertLayer(layer); insertVisibilityShape(QString(TCollection_AsciiString(layerName->Get()).ToCString()), layerShape); m_numberOfLines++; } else if (TopAbs_WIRE == layerShape.ShapeType()) { insertLayer(layer); insertVisibilityShape(QString(TCollection_AsciiString(layerName->Get()).ToCString()), layerShape); m_numberOfWires++; } else if (TopAbs_FACE == layerShape.ShapeType()) { insertLayer(layer); insertVisibilityShape(QString(TCollection_AsciiString(layerName->Get()).ToCString()), layerShape); m_numberOfFaces++; } else if (TopAbs_COMPOUND == layerShape.ShapeType()) { insertLayer(layer); for (TopExp_Explorer explorer(layerShape, TopAbs_ShapeEnum::TopAbs_WIRE); explorer.More(); explorer.Next()) { TopoDS_Wire wire = TopoDS::Wire(explorer.Current()); if (!wire.IsNull()) { insertVisibilityShape(QString(TCollection_AsciiString(layerName->Get()).ToCString()), wire); m_numberOfWires++; } } for (TopExp_Explorer explorer(layerShape, TopAbs_ShapeEnum::TopAbs_FACE); explorer.More(); explorer.Next()) { TopoDS_Face face = TopoDS::Face(explorer.Current()); if (!face.IsNull()) { insertVisibilityShape(QString(TCollection_AsciiString(layerName->Get()).ToCString()), face); m_numberOfFaces++; } } } } } } } } | ||||
Additional information and documentation updates | There is a file in description to do it test. | ||||
Tags | No tags attached. | ||||
Test case number | |||||
Date Modified | Username | Field | Change |
---|---|---|---|
2021-08-03 17:40 | lucas_morona_164500 | New Issue | |
2021-08-03 17:40 | lucas_morona_164500 | Assigned To | => gka |
2021-08-03 17:40 | lucas_morona_164500 | File Added: Dimensions01.dxf | |
2021-08-03 18:12 | kgv | Summary | OCC import Autocad dimensions lines as shapes => DXF Export - OCC import Autocad dimensions lines as shapes |
2021-08-03 18:14 | kgv | Summary | DXF Export - OCC import Autocad dimensions lines as shapes => DXF Import - OCC import Autocad dimensions lines as shapes |