Instance reference serialization

Hello,

I want to serialize instance references which consists of curves and hatches.
Is it possible to serialize instance reference?

Thanks

1 Like

Hi @serdem,

We’ll probably need more details on what you are trying to do.

Thanks,

– Dale

Sorry Dale,

I am trying to write instance references (made from curves and hatches) to sqlite database, as blob. I can do it for curves as below code, but i dont know how to do it when it is a instance reference (if go.objects are instance reference)?

            Dim curveData As New List(Of NurbsCurve)
            For Each cv As Object In go.Objects()
                curveData.Add(cv.Curve().ToNurbsCurve())
            Next
            Dim cmd As SQLiteCommand = New SQLiteCommand()
            cmd.CommandType = CommandType.Text
            Dim curveStream As New MemoryStream
            Dim formatter1 As BinaryFormatter = New BinaryFormatter()
            formatter1.Serialize(curveStream, curveData.ToArray())
            cmd.CommandText = str
            cmd.Connection = con
            cmd.Parameters.AddWithValue("@block", curveStream.ToArray())
            cmd.ExecuteNonQuery()

Thanks,

Hi @serdem,

An InstanceObject doesn’t really have any data, other than a reference to it’s InstanceDefinition and a transformation. If you want the instance object’s geometry, then you can use Explode method.

Does this help?

– Dale