.dwg support

  1. FAQ

How does DWG comparison function work?

'COMPARE' command essentially inserts other drawing as an xref in the model space, then walks through the entities in the model and xref comparing them one by one. Resulting differences are grouped by extents and a polyline ("revision cloud") is generated around them (in the host model). 

How to change a code page (character encoding) of a .dwg file before importing it?

/** \details

Sets the DWGCODEPAGE value in the specified OdDbDatabase instance.

\param db [in] Database.
\param val [in] Value for DWGCODEPAGE.


This function provides write access to "Read-Only" system variables. It may be used to bypass non-implemented Drawings functionality or to repair drawings.

OdDbDatabase& db,
OdCodePageId val);

What is the correct behaviour for a block reference with its linetype set to ByBlock?

Block Reference is like any other entity: if it has ByBlock properties, than values from another stack level are used in case of nested blocks.

How to add tag attribute?

See Drawings/Examples/OdWriteEx/DbFiller.cpp Search for OdDbAttributeDefinition.

Is there any dimension feature available in ODA for DWG files?

Please find OdDbDimension class and classes derived from it in our documentation. https://docs.opendesign.com/td/db_dimensions.html

How to exclude custom OdDbEntity from selection?

You can use selection filter in OdDbSelectionSet query to exclude unnecessary entities from result selection set:


/** \details
    Filter selection only.  

    \param vpId [in]  id of OdDbViewportTableRecord  record or OdDbViewport entity in which to select.
    \param nPoints [in]  Number of points into selection shape.
    \param wcsPts [in]  Selection shape as set of World Coordinate Space points.
    \param mode [in]  Selection mode.
    \param sm [in]  Subentities selection mode.
    \param pFilter [in] object of type OdDbSelectionFilter or pointer to a OdResBuf chain defining the filter.
  static OdDbSelectionSetPtr select(
    const OdDbObjectId& vpId,
    int nPoints,
    const OdGePoint3d* wcsPts,
    OdDbVisualSelection::Mode mode = OdDbVisualSelection::kCrossing,
    OdUInt32 sm = OdDbVisualSelection::kDisableSubents,
    const OdRxObject* pFilter = 0);

I tried to open the DWG in AutoCad 2020. A message showed up warning 'It made by unauthorized application'.

This message indicates that the file was created with a non-Autodesk(c) software. As we are independent from Autodesk(c) this message must appear (with both regular and trial archives) as otherwise it will be a violation of the legal terms.

It it possible to select an entity within a block or a sub block (block within a block)?

Yes, it is possible, but for this action you need to set specific option in the device called blocks cache.

How to explode a .dwg file, so we could select an individual entity?

Model Space of the drawing contains single entity - Block Reference. Use explode() or explodeGeometry() fo it. See ODA Documentation for details.


Where can I find the list of prohibited characters?

Please see the Developer's Guide.

Note that ODA login required.

Does Drawings SDK provide a component that can be embedded into existing applications (specifically C# WPF)?

Our SDK is written in cross-platform C++. But we have .NET wrappers that can be used for a C# application. We also have a set of C# examples including one for WPF.