Hello @InterfaceGuy,
thank you for reaching out to us. You can just use the existing loading and merging functions in c4d.documents
. The snippet below will open a file dialog where you must select a SVG file, and it will then load that SVG file into a new scene. The example will also suppress the options dialog of the importer. There are many options with c4d.documents.LoadDocument
and c4d.documents.MergeDocument
; to not suppress these options dialogs, to merge with specific documents, etc. If necessary, you could also get hold of the SVG importer plugin first to set the import settings. See our documentation for details on c4d.documents.LoadDocument
. And in our GitHub Python SDK repository, in the Files & Media section, you can find examples for manipulating the im- and exporter plugins.
Cheers,
Ferdinand
The result:

The script:
import c4d
import os
def main():
"""Loads an svg file from a file dialog.
You can just replace `file` with any path you would like.
"""
file = c4d.storage.LoadDialog(title='Select a file')
if not file or os.path.splitext(file)[1].lower() != ".svg":
raise RuntimeError("Please select a svg file.")
doc = c4d.documents.LoadDocument(file, c4d.SCENEFILTER_NONE)
if doc is None:
raise RuntimeError("Failed to load svg file.")
c4d.documents.InsertBaseDocument(doc)
c4d.documents.SetActiveDocument(doc)
if __name__=='__main__':
main()