How to get object property during importing a dwf file?
Sample Components/Dwfdb/Examples/OdDwfLoad does dumping of properties if you executes it with key -D .
How to add a hyperlink to an MTEXT entity?
OdWriteEx sample contains creating a circle with hyperlink. Search DbFiller.cpp for "hyperlink".
Here is sample code for creating MTEXT with hyperlink in field. Code:
OdDbMTextPtr pMText = OdDbMText::createObject();
pMText->setDatabaseDefaults(pRecord->database());
pRecord->appendOdDbEntity(pMText);
/**********************************************************************/
/* Set some properties */
/**********************************************************************/
pMText->setLocation(point);
pMText->setTextHeight(0.2);
pMText->setAttachment(OdDbMText::kTopLeft);
pMText->setContents(OD_T("Sample Hyperlink"));
pMText->setWidth(w * 7.0 / 8.0);
pMText->setTextStyle(styleId);
OdDbFieldPtr pTextField3 = OdDbField::createObject();
OdDbFieldPtr pField3_1 = OdDbField::createObject();
OdDbObjectId textFldId3 = pMText->setField(OD_T("TEXT"), pTextField3);
OdDbObjectId fldId3_1 = pTextField3->setField(OD_T(""), pField3_1);
pField3_1->setEvaluationOption(OdDbField::kAutomatic);
OdString fc6(OD_T("\\AcVar \\href \"http://forum.opendesign.com/showthread.php?14172-How-do-I-add-a-hyperlink-to-an-MTEXT-entity##Open Design Alliance Forum > Teigha, C++ version#0\""));
pField3_1->setFieldCode(fc6);
OdDbEntityHyperlinkPEPtr hpe = pField3_1;
OdDbHyperlinkCollectionPtr urls = hpe->getHyperlinkCollection(pField3_1);
urls->addTail(L"http://forum.opendesign.com/showthread.php?14172-How-do-I-add-a-hyperlink-to-an-MTEXT-entity##ForumLink#0\"",
L"Open Design Alliance Forum > Teigha, C++ version");
hpe->setHyperlinkCollection(pField3_1, urls);
pTextField3->setEvaluationOption(OdDbField::kAutomatic);
OdString fc7(OD_T("HyperLink sample %<\\_FldIdx 0>%"));
pTextField3->setFieldCode(fc7, OdDbField::FieldCodeFlag(OdDbField::kTextField | OdDbField::kPreserveFields));
pField3_1->evaluate(OdDbField::kAutomatic);
How to debug ODA .NET application?
Currently we provide examples as release build config, if you need debug config you need create Debug Config manually. Please note, that in order to create Drawings.NET debug configuration you need Kernel and Drawings release archives (i.e. "amd64dll" for example).
- Create new configuration "Debug" from Release config. You need change build configuration and rebuild the solution:
- Project Properties -> Select Tab "Build" -> Unselect "Optimize code".
- Project Properties -> Select Tab "Build" -> Click button "Advanced" -> Change field "Debug Info" from "none" to "full".
- Project Properties -> Select Tab "Build" -> Field "Output path" -> Copy from release configuration (for e.x:....\exe\vc15_amd64dll)

Which filetypes are supported for DGN reference files?
At the moment we support reference attachments to DXF/DWG and to DGN files. And also we support raster attachments to image files and pdf files.
Do you have any sectioning samples ?
Yes. In Drawings, cutting planes are applied through the graphics system rather than the database — see OdGsView::setViewport3dClipping() and the section-related registered commands in Drawing/Examples/ExCommands (ExClipBoundary.cpp, ExConvToMeshCommand.cpp). OdaMfcApp exposes them under Edit → Registered Commands.
For sectioning in Visualize, see cutting planes in OdTvGsView and the Visualize features documentation, plus the section controls in the Visualize Qt viewer.
How to compute extents for model space?
See AbstractViewPE.h. This protocol extension can be applied to OdDbViewport, OdDbViewportTableRecord and OdDbViewTableRecord.
You can find sample code in Kernel/Exports/RasterExport. AbstractViewPE in its zoomExtents() and viewExtents() takes into account only visible geometry, honoring layer state (if a layer is off or frozen).
Do you have any library support to generate 2d .dwg floor plans from ifc files?
There is no single "IFC to 2D floor plan" call, but using Visualize SDK you can: import the .ifc file into a Visualize database and then write it out as .dwg.
- IFC → Visualize: Visualize/Examples/Ifc2Visualize
- Visualize → .dwg: Visualize/Extensions/Visualize2Dwg
Be aware of what this gives you: the result is the geometry of the model, not a drafted floor plan. Producing an actual plan view means adding a section/clip plane at the storey level and flattening the result; the IFC property data does not survive into .dwg entities.
Where I can find information about plot drawings?
For plotting options you can refer to the example in Drawings SDK archive in Drawing\Examples\Qt\OdaQtPlotSettingsValidator.
When using OdCopyEx.cpp to convert the CAD file version, the out of memory dialog box pops up, and the code throws an exception when readFile.
Dwg file format is highly compressed and drawing occupied much more memory than file size.
Memory limit for 32-bit application is 2G. 64-bit application has no such limitation.
In some scenarios partial loading and paging can reduce memory usage but saving drawing to file require that all data is loaded into memory.
How do I read in OBJ file data?
The main module project is placed in the Components/OBJToolkit folder. The header with all the needed method declarations is OBJToolkit.h. To import an .obj file, create an OdObjImport object, call importFile() and you will have access to the groups and geometrical objects of OdObjDb:
OdObjImportPtr pObjImporter = OBJToolkit::createObjImporter();
pObjImporter->importFile(filePath, &importOptions);
OdObjDbPtr pObjDb = pObjImporter->getObjDb();The import sample is the Obj2Visualize project at Visualize/Examples/Obj2Visualize, and it can be tested in the Visualize Qt viewer (Visualize/Examples/qt-viewer) via File→Open→Obj.
An example of exporting .dwg to .obj is located in the Drawing/Examples/ExCustObjs project (in the function called _OBJExport_func). This is the OBJExport command of the OdaMfcApp sample application. Another example of exporting to OBJ from Visualize is the Visualize2Obj project, also reachable from the viewer's File→Export→Obj menu.
Can we get direct polylines like startPoint and EndPoint of dimension/leader/extension lines?
A dimension entity has the method OdDbObjectId dimBlockId(). A block contains all dimension geometry. If any dimension property is changed, this block is recomputed.
You can get simple entities such as lines, multiline text, etc. by iterating through the dimension block.
We need the text string in the form of polylines matching the exact font type used in a .dwg file. Is there a way to get such polylines?
See the implementation of the TxtExp command in Drawing/Examples/ExCommands/ExTxtExp.cpp. It converts text to polylines and arcs, using the same font that the vectorizer resolves for the entity — so the outlines match the font actually used to draw the .dwg, which is what you are asking for.
You can try it in OdaMfcApp by typing TxtExp and selecting the text entities.
Is the source code for ODA File Converter available?
You can find this example source code in the Drawings archive: Drawings_XX\Drawing\Examples\Qt\OdaFileConverter.
Can you provide ODA sample code of how to work with DWG in C# (how to create circles, arcs, etc.)?
See Swig\SwigODAExamples\Drawings\CSharp\OdWriteExSwig for creating entities (circles, arcs, text, dimensions, ...) and Swig\SwigODAExamples\Drawings\CSharp\OdReadExSwig for reading and dumping a database.
Are there command line examples that support Windows and Linux operating systems (.deb) for converting .dwg/.dxf files into .dwg/.dxf/.svg/.png files?
ODA SDKs support numerous formats. Drawings SDK provides native support for .dwg/.dxf file formats and a set of various exports and imports. The Drawings SDK archive includes a set of samples that work at the command line. Here are a few examples related to converting files:
- OdCopyEx — Loads a .dwg/.dxf file of any version and saves it to a .dwg/.dxf file of any version.
- OdDwfExport — Loads a .dwg/.dxf file and exports its content to a .dwf file.
- OdColladaExport — The same, but the output is a Collada file.
- OdPdfExport — Also the same, but the output is a .pdf file.
- OdSvgExport — Also the same, but the output is an .svg file.
- And more.
How do I regen in WPF?
The implementation is:
m_pDevice->invalidate();
if(m_pDevice->gsModel())
m_pDevice->gsModel()->invalidate(OdGsModel::kInvalidateAll);
where m_pDevice is a derivative of the OdGsDevice class.
How do I get geometry from an entity?
See the OdGetGeomEx sample project: \Drawing\Examples\OdGetGeomEx.
What are the differences between OdaMfcApp and ODA Viewer?
They are built on different SDKs, which is what all the other differences follow from.
OdaMfcApp is a Drawings SDK sample. It works directly on the OdDbDatabase, can switch between vectorization devices at run time (WinGDI, WinBitmap, WinOpenGL, Microsoft® DirectX®, WinGLES2, and WinDirectX12 or WinMetal where the platform provides them), and can turn the graphics cache on and off (Tools → Options → Use GS model). It also exposes the registered commands, which is why most FAQ answers use it to demonstrate an API.
ODA Viewer is a Visualize SDK sample. It renders from a Visualize database, so the graphics cache is intrinsic and cannot be disabled, and it opens every format Visualize can import rather than just .dwg/.dxf. In exchange it does not edit the source database.