SetAttachment
set the attachment (text, Maple structures, files) to the linked MapleSim model
Calling Sequence
Parameters
Returns
Options
Description
Examples
A := MapleSim:-LinkModel();
A:-SetAttachment(name, content, options)
name
-
string ; name of the attachment
content
anything ; content of the attachment
options
(optional) equation(s) of the form name = value
none
category : one of the following: "custom", "datasets", "cad", "other", "documents"
Specifies the category where the attachment should be placed. Default is "documents".
filecopy : true or false
If set to true, the content parameter is assumed to be a name of the file to be attached to the active model. Default is false.
A:-SetAttachment sets the attachment to a linked model A.
The A := MapleSim:-LinkModel() statement needs to be run prior to successfully using any of the ModelObject A's export functions.
Linking to a MapleSim model (located in .msim file):
A≔MapleSim:-LinkModel⁡filename=cat⁡kernelopts⁡toolboxdir=MapleSim,/data/examples/RLCcircuit.msim:
Setting the attachment (text) to the linked MapleSim Model:
data≔this will be the ship
A:-SetAttachment⁡data.txt,data,category=other
Setting the attachment (a list) to the linked MapleSim Model:
L≔1,2,3,4:
A:-SetAttachment⁡data.csv,L,category=datasets
Getting the data from the attachment:
A:-GetAttachment⁡data.csv
1.2.3.4.
Listing the attachments of the linked MapleSim Model:
A:-ListAttachments⁡
data.txt,data.csv
A:-ListAttachments⁡showcategories=true
data.txt,other,data.csv,datasets
Setting the attachment (a file) to the linked MapleSim Model:
fd≔FileTools:-Text:-Open⁡samplefile.txt,create=true,overwrite=true:
FileTools:-Text:-WriteString⁡fd,This is a test file.\n:
FileTools:-Text:-Close⁡fd:
A:-SetAttachment⁡sampleAttachedFile.txt,cat⁡currentdir⁡,/samplefile.txt,filecopy=true:
data.txt,data.csv,sampleAttachedFile.txt
See Also
MapleSim
MapleSim[LinkModel]
MapleSim[LinkModel][ListAttachments]
Download Help Document