.dwg support

  1. FAQ
  2. »
  3. Products Overview
  4. »
  5. .dwg support

How to compare two DWG drawings in OdaMfcApp?

To perform visual comparison of two DWG drawings you can use command DwgCompare.
Open the first (original) DWG file in OdaMfcApp and vectorize it. Execute DwgCompare command by simply typing it or selecting "Edit" -> "Registered Commands" -> "Dwg Compare" -> "DwgCompare". Following that, the dialog window will open. Choose a DWG file that you want to compare with your first one and click "Open". Now the comparison will be performed and you will be able to see the results in the same view window you had open.
Entities that have been changed, removed or simply don't exist in the file you are comparing with the original will be colored in red. Entities that have been added or changed relative to the original file will be colored in green.
Now you can visually compare the two drawings. Once you entered the DwgCompare command, you will be staying in the context of this command. To go back to viewing the original file you need to execute command DwgCompareExit by typing it or selecting "Edit" -> "Registered Commands" -> "Dwg Compare" -> "DwgCompareExit". After that you can continue with your work on the drawing.

Is it possible to test Drawings Qt examples on non-Windows platform?

Qt examples build from archives are supported on Windows only at this moment.
You'll need to get full source code access via git in order to build them (for this you need founding or corporation membership).
If you just want to inspect Qt examples code, download corresponding DrawingsQt archive (note it targtes Windows),
and take Qt folder from there. However, there are no configurations to build it under Linux.
The reason for not having build confgiurations for Linux is that there is no standart Linux setup for Qt, it is usually built locally or for specific distributive.

How do I determine the drawing units (millimeters, inches, feet, or kilometers) of a drawing?

Please find the article in our wiki. INSUNITS variable stores drawing units starting with AutoCAD 2000. Some vertical applications like Land Desktop Development store units in another way - in dictionaries probably because INSUNITS was not introduced yet by the moment. DWGUNITS command still exists for backward compatibility and note that it has an option to synchronize INSUNITS.

How to import polygonal mesh entities from DWG?

See OdDbPolygonMesh class. You can get MxN array of vertices.

See OdReadEx sample for details.

How to get polyface mesh entities from DWG?

See OdDbPolyfaceMesh class. You can get a set of vertices and faces.

How to import the mesh data from 3D DWG?

You can use oddbGetObjectMesh from DbSubDMesh.h. Alternative way is decomposeForSave (see CDwgView::OnEditAcisConversion from OdaMfcApp example application).

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.

\remarks

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

*/
TOOLKIT_EXPORT void odDbSetDWGCODEPAGE(
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:

Code:

/** \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.