Author Topic: Center and fit part/object  (Read 671 times)

0 Members and 1 Guest are viewing this topic.

Offline rembem

  • Full Member
  • ***
  • Posts: 130
  • render freak
Center and fit part/object
« on: August 17, 2018, 02:37:18 am »
I'm starting to use scripts. I can use the standard one in KeyShot with creating all the camera angle, but I also want to centre and fit the product per camera. Can someone help !!!?
(I will import a product in KeyShot and then create all the angles/cameras)

This is the script from KeyShot:

views = {lux.VIEW_FRONT: "Front",
   lux.VIEW_BACK: "Back",
         lux.VIEW_LEFT: "Left",
         lux.VIEW_RIGHT: "Right",
         lux.VIEW_TOP: "Top",
         lux.VIEW_BOTTOM: "Bottom",
         lux.VIEW_ISOMETRIC: "Isometric"}

for view in views:
    name = "_" + views[view]
    has = False
    if name in lux.getCameras():
        has = True
        lux.setCamera(name)
    else:
        lux.newCamera(name)
    lux.setStandardView(view)
    lux.saveCamera()
    print("{} camera: {}".format("Updated" if has else "Created", name))

... all I need is that it also will center and fit the objects.
« Last Edit: August 17, 2018, 05:24:44 am by rembem »

Offline Morten Kristensen

  • root
  • Administrator
  • Full Member
  • *****
  • Posts: 128
  • Software Engineer, Luxion
Re: Center and fit part/object
« Reply #1 on: August 23, 2018, 07:32:21 am »
Hi Remko,

To center-and-fit a node, you can get the root node via lux.getSceneTree() then you find the node you want to center-and-fit via find() on the root, which returns a list of nodes.