I am hoping people can give me an outline to design a REST web service that when called, generates a dwg file and returns the file. I am pretty new to AutoCAD and automation so don't know the AutoCAD capabilities and searches are not bearing fruit. Can Autocad handle more than one request at a time or would I have to do them serially? Would it be better to do the automation in process or out of process? Do I need to create a new instance of autocad for each request or just create a new drawing? Better to create drawing in the model, or just create in the database components and skip the drawing since no one will be looking at it being generated?
The drawings won't be too complex. Control closet layout. Rectangular room with components on the walls represented by rectangles and some notations.
I'd be using C#.NET, .NET 4.7 framework if in process, .NET 5 if out of process. AutoCAD Mechanical 2020. Probably web API hosted in a windows service.
REST service is not supported.
You can connect to ArcGIS online as a client using the free downloadable plug-in called ArcGIS for AutoCAD
Go to https://www.esri.com/en-us/arcgis/products/arcgis-for-autocad
You may also connect other services such as WMS, WFS and depending on your version, (2021 or newer) WMTS too.
I actually do this type of retrieval from the web with LISP and run a local routine like WGET or CURL, either of these works by downloading the file locally and then you can do whatever you need to after that with the file for automation purposes.
It can use a REST service to retrieve from if needed as well, but it sounded like you were looking to selectively download a DWG on demand.
bobb
To clarify a little bit. I am not looking for existing web services with mapping information. The files that will be returned by the service do not exist yet exist when the call is made. The REST service will not be web based. It will be over the internal company network. Data will be passed to the service as probably json or xml. That data will be used to create a drawing from scratch through .NET managed automation. Then the drawing that results will be returned by the REST service. I know the REST service could handle more than 1 request at a time, but can you generate a drawing from scratch with AutoCAD concurrently or have to queue the drawings. This is also why I was asking about things like in process vs. out of process automation, automating through the model space or directly adding entities to the block table, if it's possible to automate the generation of 2 or more drawings concurrently through automation or if I have to queue the requests and do them 1 by 1, etc.
Your desired approach would still be doable as I've described, the rest service I think is in herently a web service, at least those are the only ones I've had experience with accessing from automation.
if you are good with simply pulling the JSON/AML from the rest sservice then my plan would work. You could then manipulate the downloaded file any way you choose with the .net processes.
I would typically handle this via Web services myself, where a client routine would set up the call, run the .net process, then return the finished DWG to the calling routine (from AutoCAD) directly. This provides a lot of flexibility over the long term with mixing and matching calls with processors, etc, but it more complicated than what you say you want/need.
Using the websservice as a calling proxy allows you to store the retieved data somewhere else for later use, or to build a historical record, or, well you get the idea. . . .
bobb
You should look into Autodesk's Forge cloud services, namely the Design Automation service. It is not technically sound/acceptable to incorporate a heavy desktop app (AutoCAD) with an unattended backend application (web/REST services).
Or you can host AutoCAD's core console with your backend services, which is basically what the Forge's Design Automation does. So, using the Forge services would be much better than hosting AutoCAD core console on your own, unless the Acad functionality only play rare/minor role in your backend services.
Even with Forge services, you still need to know how to do AutoCAD programming, mainly, with AutoCAD .NET API. If you are new to AutoCAD, it is a lot to learn. Or you can split the AutoCAD plugin part from your services development to someone who knows how to do it.
Can't find what you're looking for? Ask the community or share your knowledge.