KeyShot Forum

Technical discussions => Extending KeyShot => Scripting => Topic started by: jbeau on July 29, 2019, 12:49:48 AM

Title: example: reading bip into memory
Post by: jbeau on July 29, 2019, 12:49:48 AM
Looks like you can loop through the current bip file and evaluate all the lines. You have to save your file first to load everything in memory.
Here's a quick setup to find if a single camera is orthographic. One could potentially write back to the file and change values using this method.

nfo = lux.getSceneInfo()
scenepath = nfo.get('file')
print(scenepath)
camera = lux.getCamera()
print(camera)
bipFile = open(scenepath, encoding='utf8', errors='ignore').readlines()
for num, line in enumerate(bipFile):
    if camera in line:
        if num >1000:
            #print('Camera Found:',num,line)
            #print(bipFile[num+1])
            if 'ortho' in bipFile[num+1]:
                print('I found an Orthographic Camera')