Skip to content

Conversation

praxcom
Copy link

@praxcom praxcom commented Sep 25, 2025

  • Uses native vtk viewer in spwned thread

  • No use of browser or server

  • Message passing via queue standard library

  • Interacts very similarly to existing vis.show func

  • Added example script EX102_Live_Vis.py, which works perfectly but no pure tests

- Uses native vtk viewer in spwned thread
- No use of browser or server
- Message passing via queue standard library
- Interacts very similarly to existing vis.show func

- Added example script EX102_Live_Vis.py, which works perfectly
but no pure tests
from OCP.Geom import Geom_BSplineSurface

import vtk
from vtkmodules.vtkInteractionWidgets import vtkOrientationMarkerWidget

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate line here.

@adam-urbanczyk
Copy link
Member

Probably better to make this into an extension outside of the CQ codebase. At least for the time being.

@praxcom
Copy link
Author

praxcom commented Sep 27, 2025

Leaving as extension is fine if that's what you think is best, but can I ask why?
I needed this feature for embedded cadquery in a in-house gui program so didnt want to use cq-edit.
I can imagine the use case being applicable to others too, hence creating the pull request.

The proposed use case as per Issue #1902:

import cadquery as cq
from cadquery.vis import show_live

box = cq.Workplane().box(5, 2, 1).val() #initial geometry

viewer = show_live(box) #initial view

def gui_callback(event):
    # Do stuff...
    box = #...updated geometry 
    viewer.update(box) #update the view, no blocking on either side

### GUI CODE + LOOP

@adam-urbanczyk
Copy link
Member

Mostly to limit the maintenance burden. If this method turns out to be reliable, we could always replace the current show later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants