Solved How to cancel FileLoad error message.

I have a plugin that I need to use c4d.documents.LoadFile(). I get a pop up question if I load a file with a New XRef that is missing a reference, asking a Yes or No question. Can I answer yes or no in code, or cancel the load if I get an error? I tried using c4d.documents.LoadDocument() but this is causing another xref issue. My Legacy XRefs aren't always keeping their options set and often times all display and on/off options (under the XRef O tab) all turn on. The plugin replaces text in an xref path/filename.

Hi @visualride first of all welcome in the plugin cafe community.
Don't worry since it's your first post, but please next time try to follow these rules:

Regarding your issue, no there is no way with CInema 4D API to control popup.
Regarding your issue instead of LoadFile you could use [LoadDocument](https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.documents/index.html?highlight=load#c4d.documents.LoadDocument] with the flag SCENEFILTER_IGNOREXREFS.

like so:

    path = r"C:\Users\username\Desktop\test.c4d"
    doc = c4d.documents.LoadDocument(path, c4d.SCENEFILTER_IGNOREXREFS | c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)
    if doc:
        c4d.documents.InsertBaseDocument(doc)

If you have any question, please let me know.
Cheers,
Maxime.

Thanks for the reply! I'll try that, though I thought that SCENEFILTER_IGNOREXREFS would keep xrefs from being loaded, and since my plugin edits the xref path/name, this would not work. But then again, perhaps I assumed wrong. I appreciate the help! By the way, the idea of classification by tags appears to be a good way to escape the messy folding out tree of classification system that we are all used to. I'll use it next time.