How to construct marker from stream containing 3D model

496
2
09-30-2020 02:25 AM
deleted-user-JTyWy9b20ETO
New Contributor II

Using the ArcGIS Pro SDK, I can construct a 3d symbol from a model file, such as DAE or STL using  

ConstructMarkerFromFile() 

CIMMarker cimMarker = await QueuedTask.Run(() => 
    SymbolFactory.Instance.ConstructMarkerFromFile(filepath)
);

I want to achieve the same result except using a file that has been first read into a MemoryStream, using ConstructMarkerFromStream(Stream stream).

However, I get an exception "parameter is not valid". This suggests that ConstructMarkerFromStream is expecting a PNG image in the stream, not an XML 3D model.

In the only usage example I can find, an ImageFormat is being specifically identified as PNG to the stream.

Image newImage = Image.FromFile(@"C:\\downloads\\mymodel.dae");
 var stream = new System.IO.MemoryStream();
 newImage.Save(stream, ImageFormat.Png);
 stream.Position = 0;
 CIMMarker markerFromStream = SymbolFactory.Instance.ConstructMarkerFromStream(stream);

How can I get ConstructMarkerFromStream() to understand the stream is a DAE object and not an image? Or is there another way to import DAE from a stream?

0 Kudos
2 Replies
CharlesMacleod
Esri Regular Contributor

Chris, you can only read collada from a file.  Note from: SymbolFactory ConstructMarkerFromStream(...)

Remarks: "Marker can be created from the following stream data type: JPG, BMP, PNG, GIF".

(I realize that the code example on the API reference page is a little misleading because it is actually using "ConstructMarkerFromFile".)

0 Kudos
deleted-user-JTyWy9b20ETO
New Contributor II

Hi Charles,

Thanks for the confirmation.

The document link you sent

https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic14926.html

states it clearly, but I was using this link which is identical except it

doesn't mention that limitation.

https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic16203.html

I am not sure what the difference is. I seem to have found an index page?

0 Kudos