Jump to content

Can't Get Any Objects


Eric Badros
Go to solution Solved by Cairyn,

Recommended Posts

I'm having difficulty accessing any objects within my document. I've tried SearchObject, GetFirstObject, GetObjects and none of them have worked. I've got the BaseDocument...any advice anyone could provide?

 

Here's some abbreviated code:

import json
import c4d
import os
from os.path import basename, splitext


def main():
    print("Running main")
    projectFilePath = "L:\\RnD\\dynamic_product_placement\\C4D\\CanTrack_v02_Cineware.c4d"
    try:
        doc = c4d.documents.LoadDocument(projectFilePath, c4d.SCENEFILTER_0)
        print(doc.GetDocumentName())

    except:
        print("Failed to Open Project Path")
    print("where are you ", doc.GetFirstObject())

if __name__=="__main__":
    main()

 

And then I get the following response:

 

Running main
CanTrack_v02_Cineware.c4d
where are you  None

 

Thank you!

 

Eric

Link to comment
  • Solution
19 hours ago, Eric Badros said:

I'm having difficulty accessing any objects within my document. I've tried SearchObject, GetFirstObject, GetObjects and none of them have worked. I've got the BaseDocument...any advice anyone could provide?

Without trying the code, I suspect you should use some other filter than c4d.SCENEFILTER_0, maybe SCENEFILTER_OBJECTS to actually get objects loaded?

Link to comment
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community