# SketchUp 2017 M2 SUModelCreateFromBuffer()

#1

The release notes for SketchUp 2017 M2 mention this SDK function:

Added SUModelCreateFromBuffer() to allow for the creation of models from the bytes buffer.


What’s the bytes buffer?

#2

I reply because I am curious too. Could it be the ability to create a model that is currently open in the Sketchup app…? Would be very useful if so.

I am also curious about what SUModelFromExisting() means too:

/**
@brief  Returns a model reference for a given internal model representation.
This model object must NOT be released with \ref SUModelRelease.
@param[in] data Internal model representation.
@return The created model reference.
*/
SU_EXPORT SUModelRef SUModelFromExisting(uintptr_t data);

#3

The function is mentioned in the release notes but you are right it isn’t in the currently available SDK download which is 17.0.18899

#4

That’s another interesting function made more interesting becaus it would seem it is intentionally undocumented.

#5

I too, would like to export the current model. Not sure what should be passed as the “uintptr_t data”

#6

The bytes buffer is an array of unsigned char - it was added to match parity with the old C++ SDK’s OpenFromStream. It simply let you read a SKP file from a char byte buffer.

#7

This is for SketchUp internal consumption. All public API is documented in the documentations.

To create exporters we have an interface for this: http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/modelexporterplugin_8h.html

#8

Hi thomthom, I tried building the skp2xml sdk sample, so that I could see the exporter code in action (built with VS2015 for SketchUp 2017). I put the skp2xml.dll in the C:\Program Files\SketchUp\SketchUp 2017\Exporters folder.

If I launch SketchUp directly, and go to File>Export>3d Models, SketchUp crashes.

If run skp2xml under debug (launching SketchUp) with lots of breakpoints, I can walk past the errors, and get to the file export dialog, but the .xml option does not appear.

Are there other code samples available showing the exporter functions in proper use?

#9

What kind of errors are you seeing? It’d be worth looking into what these are - as the examples should work.

This is the release build? Do you get a BugSplat dialog?

#10

Running under debug:
I set a break point in GetIdentifier().When I go to File > Export . 3D Model, it reaches this break point without a problem. I tell the debugger to “Continue” and it throws this error

If I say “Continue” in the dialog, the next break point I reach is in void CXmlExporterPluginWin::DestroyInstance(), which when I step out, I can see is called from CXmlExporterPluginWin : public CXmlExporterPlugin,