LayoutAPI various calls to AddReference

Noticing in the LayoutAPI calls to *AddReference:
LODocumentAddReference
LOSketchUpModelAddReference
LOTableAddReference
etc…

These appear to be optional calls that are not specifically required when getting/adding an object in a document? Just wondering what the purpose is for these API methods and how they are intended to function?

These methods should be used if you want to hang on to a reference for an extended time, to ensure that the object doesn’t get deleted from under you. In general it may not always be necessary to AddReference/Release. The LayOut Ruby API utilizes these methods when wrapping the C API calls, for example.

Adam

1 Like

Got it Adam, understood. Thank you sir!