Adding Metadata to DWF Sheets with AcDMMReactor in AutoCAD

By Madhukar Moogala

When publishing to DWF or DWFx in AutoCAD, embedding metadata into sheets and entities can provide powerful downstream benefits, whether for facility management, digital twins, or simply making the file more intelligent. The AcDMMReactor API gives you fine-grained control over this.

[Keywords]= AcDMMEPlotPropertyVec,AcDMMEPlotProperty,AcDMMSheetReactorInfo,AcDMMEPlotProperties,AcGlobAddDMMReactor 

What Is AcDMMReactor?

AcDMMReactor

is part of the Autodesk DWF Publishing framework that lets you hook into the DWF publishing pipeline. You can inject custom properties into sheets (OnBeginSheet) or even individual drawing entities (OnBeginEntity).

What You Can Do

With this reactor, you can:

  • Add custom properties like Layer Name, Block Name, or Area to entities.
  • Assign unique IDs to each entity for traceability.
  • Attach external resources (e.g., help documents) to sheets.
  • Dynamically associate metadata with drawing nodes for richer DWF output.

Sample Capabilities

Here’s a glimpse of what’s possible inside OnBeginEntity:


AcDMMEPlotProperty prop(L"Layer", layerName);
prop.SetCategory(L"Display");
props.AddProperty(&prop);

Want to include area? Use entity extents:


double area = (ext.maxPoint().x - ext.minPoint().x) *
(ext.maxPoint().y - ext.minPoint().y);
AcDMMEPlotProperty areaProp(L"ApproxArea", std::to_wstring(area).c_str());

And here’s how to add properties to the sheet itself:


AcDMMEPlotProperty prop(_T("LayoutId"), pInfo->UniqueLayoutId());
prop.SetCategory(_T("APS"));
pInfo->AddPageProperties({ prop });

Registering Your Reactor

You’ll need to dynamically load the DWF publishing module and register your reactor:


if (!acrxServiceIsRegistered("AcEPlotX"))
acrxLoadModule("AcEPlotX.crx", false, false);

Then register your custom AcDMMReactor:


ADD_DMM_REACTOR pAdd = (ADD_DMM_REACTOR)GetProcAddress(hDmm, "AcGlobAddDMMReactor");
pAdd(new TstMMReactor());

Here is Github Source inject-dwf-metadata

DWFMetadtaProps


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading