Skip to content

Python example code error -- no attribute #168

@1bigpig

Description

@1bigpig

So, I am learning Python to create a plugin for Cloud Compare. I am trying to convert a lidar trajectory file into a path that can be used to create new viewports. At each idea, I keep running into "issues" with the python example files not executing.

For example, in the viewport example [CloudCompare-PythonRuntime/script_examples/viewport.py] the program errors with the message

import pycc
import cccorelib
CC = pycc.GetInstance()
pc = CC.getSelectedEntities()[0]
bbMin, bbMax = cccorelib.CCVector3(), cccorelib.CCVector3()
pc.getBoundingBox(bbMin, bbMax)
center = (bbMax - bbMin) / 2
center = cccorelib.CCVector3d(*center)
vp = pycc.ccViewportParameters()
vp.setCameraCenter(center, False)
vp.setFocalDistance(150)
glWindow = pc.getDisplay()
glWindow.setViewportParameters(vp)     #error there is no 'setViewportParameters'
glWindow.redraw()
"AttributeError: 'pycc.ccGenericGLDisplay' object has no attribute 'setViewPortParameters'

At:
<string>(19):<module>"

So, while I know this is an error with the example code, my lack of python experience is hindering my ability to "fix" it. Am I doing something wrong or is there no 'setViewportParameters' in the pycc import?

My idea is to have a small trajectory file with about 60 points. At each point along the trajectory, I would like the program create a TLC/GBL as that is the viewpoint I want. Looking through the python API, it seems you cannot create a ccGBLSensor point with the python api. Or if you can, I am surely doing it wrong. So I started looking at using the viewport and creating that view and then inserting/creating a viewport object that could be combined into an animation.

Thank you for your hard work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions