Python examples not working

Questions related to plugins development
Post Reply
1bigpig
Posts: 1
Joined: Tue Feb 03, 2026 2:38 pm

Python examples not working

Post by 1bigpig »

Daniel,

First off, thank you for all the work you do on Cloud Compare.

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)

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. Orr 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,
Bruce
daniel
Site Admin
Posts: 8158
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Python examples not working

Post by daniel »

Sorry for the late reply. This question should probably be asked directly on the Python plugin project's github page (https://github.com/tmontaigu/CloudCompare-PythonRuntime)
Daniel, CloudCompare admin
Post Reply