Search code examples
autodesk-forgeautodeskautocad-pluginautodesk-designautomationautocad-scripts

How we can open autocad template from url and read dwg file from cloud storage


We want to create a new drawing using autocad plugin (.net) and using a custom template. We have custom template on cloud storage ( www.filepathtodwg.dwt ) and for now it is a publically accessed URL.

When we are trying to create new drawing using custom command, we are getting this error

command to create new dwg file from custom template

autocad error on creating new drawing

Command works well when we give local file path of custom template.

Also, We are getting the same error on reading dwg file from cloud storage url.

Error on read dwg file from url

Command to read dwg file from cloud storage

command to read dwg file from url

Please let me know how it can be done, as we want to create an autocad plugin that creates new drawing from custom template ( present on cloud ) and load dwg file object ( present on cloud ) to newly created drawing.

UPDATE

I have been able to do it locally, by downloading the file from url to temp folder. Then giving file path of temporary folder.

Let me know if there's better way to do it. Also i want to know will it work on production site ?


Solution

  • In APS DesignAutomation context, all the file url passed to workitem are downloaded to current directory or relative to current directory if the file is zip and a localName is assigned in the activity, from your plugin you can get the path of current directory using Directory.GetCurrentDirectory.

    How parameters in activity are handled is captured in the documentation

    I'm happy to jump on call, I have sent my Calendly schedule to your email.