I'm building an app that deals with engineering projects. Part of the app requires uploaded CAD files (.dwg) to be assigned to equipment.
What I would like to do is edit the meta data of each file to contain a reference to the part it has been assigned to.
So if a file was linked to part X1234567 I'd like to add this 'tag' to the meta data of the CAD file.
I have been working with the Forge API and see there is an endpoint for extracting meta data documented here but I see no way to put edited data back in to the file.
Is there any way to use the Forge API, PHP, Java or JS to write a method to extract metadata, edit it then save it back to the file?
I'm open to any suggestions to how I can do this.
Thanks
I should also note Java is my last choice, sorry Java guys, I'd really like to keep this in PHP or JS, but can dust off my Java skills if that's the only way.
I read your question as you want to edit metadata within a DWG (not the data that is attached to the DWG file in A360). Presumably you want to edit Xdata or Xrecords. To do this, you should use the Design Automation API (not the Model Derivative API).
The Design Automation API is essentially a headless version of AutoCAD running on an Autodesk server (the API used to be called AutoCAD I/O). You can use this API to run any script against any DWG as long as you don't require user interaction. You can also run custom actions (commands) that you have defined using the AutoCAD LISP, .NET or ObjectARX APIs (i.e. you can upload your own script or add-in to the service and run it against your DWG.
Documentation for Design Automation API is here - https://developer.autodesk.com/en/docs/design-automation/v2/overview/.
There are some samples on GitHub here - https://github.com/Developer-Autodesk/AutoCAD.io.