The function downloads the specified attachment file from a specified feature of a supported web feature layer.
Syntax
(esri_webfeaturelayer_downloadAttachment flname ename attachmentName filepath [overwrite])
Arguments
- flname | string | required | An existing web feature layer name in the drawing.
- ename | entity name | required | The AutoCAD entity name of the feature to download the attachment.
- attachmentName | string | required | File name of attachment to download.
- filepath | string | required | Destination file path for the downloaded file.
- overwrite | true / false | optional | Specifies whether an existing file will be overwritten at the specified file path. True T will overwrite the file. False nil will not overwrite an existing file of the same name.
Example usage 1
Prompts the user to select an entity from a web feature layer named "Damage_to_Residential_Buildings" and attempts to download the attachment file named "AutoCAD_drawingFiles.zip" to a file named "C:\\CADWork\\Attachments\\Updated_Drawings.zip". (setq ename (car (entsel)))
(esri_webfeaturelayer_downloadAttachment
"Damage_to_Residential_Buildings"
ename
"AutoCAD_drawingFiles.zip"
"C:\\CADwork\\Attachments\\Updated_Drawings.zip"
)
Result example usage 1
The AutoCAD_drawings.zip file is downloaded to the specified path. The C:\\CADWork\\Attachments\\Updated_Drawings.zip and the function returns:
(T)
Example usage 2
Prompts the user to select an entity from a web feature layer named "shelters" and attempts to download the attachment file named "LandSurface.xml" to a file named "C:\\CADWork\\Attachments\\LandSurface.xml" (where the layer does not support attachments).(setq ename (car (entsel)))
(esri_webfeaturelayer_downloadAttachment
"shelters"
ename
"LandSurface.xml"
"C:\\CADwork\\Attachments\\LandSurface.xml"
)
Result example usage 2
The LandSurface.xml file is not downloaded and the function returns:
(nil ("Error" . "Layer does not support attachments"))
Return values
- If successful, returns a list with the value of true: (T)
- If failed, returns a list with the first value of nil and then an associated list containing the key value "Error" and an associated error message as a string: (nil ( "Error" . "<message>"))
A failed return value can occur for any of the following reasons:
- (nil ("Error" . "Missing required
argument."))
One of the four required arguments is not supplied.
- (nil ("Error" . "No features found."))
The specified entity was not a feature in the specified web feature layer.
- (nil ("Error" . "Web feature layer not
found."))
The web feature layer value specified is not a valid web feature layer in the drawing.
- (nil ("Error" . "No attachments found on the selected feature."))
The selected feature has no attachments.
- (nil ("Error" . "No connected web feature
layers found."))
The network connection to the web feature layer was lost.
- (nil ("Error" . "'TargetAttachmentName'
does not exist on the selected feature."))
The specified attachmentName does not exist as an attachment on the specified feature.
- (nil ("Error" . "Layer does not support
attachments"))
The specified web feature layer does not support attachments.
- (nil ("Error" . "Enable overwrite to
remove existing file"))
The file name exists in the specified directory. Use the overwrite option to allow the existing file to be overwritten.
- (nil ("Error" . "Could not find a part of
the path 'C:\\CADwork\\AttachmentsFiles'."))
Check the argument given for the specified downloadPath.
- (nil ("Error" . "Access to the path
<downloadPath> is denied."))
If specifying a path such as the root of C:\, ..\\AutoCAD\\.. or the CAD user may not have folder access permissions.