We are automating the creation of requirement elements in EA through Add-in. But the problem is we are not able to import the images from the directory to Image manager and add the hyperlink to the Requirement Element Notes. So is there any API provide by Enterprise architect to Import the image from directory to Image manager and add the hyperlink to the Requirement Element Notes.
EA stores images in t_image
where ImageID
is an arbitrary unique ID, Name
is an arbitrary name, Type
is "Bitmap" and Image
contains the base64 encoded raw image data (png and bitmap are supported for sure, likely jpg will, pdf and emf probably and others eventually are supported as well). I once used to import images this way since the import via reference data (which is possible) was (and likely still is) broken. You might try that out:
xmlres = Respository.CustomCommand("Repository", "ImportRefData", sXML)
will read the reference data from an image export. sXML is the XML string of that file. The culprit was that the IDs were not imported correctly. IIRC the export contains those base64 encoded images. So you could create such a file for an import without the need to use Rerpositoy.Execute
for manipulating the database directly.
EA doesn't provide any API calls for importing images into image manager.
Image details will be stored in t_image table and the content will be stored in an encrypted blob data.so its tricky to even insert the data directly in the table.
Additional Info:(off topic)
But you can set alternate images in Style property of DiagramObject class. dobj.Style="DUID=6F937472;NSL=0;ImageID=1287454794;LBL=CX=128:CY=78:OX=0:OY=0:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=1:ALT=0:ROT=0;", String,";
Alternate Solution:
If you want to link an image to the requirement , insert that image in a word document and you can add that document as LinkedDocument for that requirement by using
element.LoadLinkedDocument
For more detrails on LoadLinkedDocument and refer in element class for LoadLinkedDocument
来源:https://stackoverflow.com/questions/49605021/importing-the-image-to-image-manager-from-add-in