Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a TubeGeometry - use of Three.Curve #286

Open
hagrid67 opened this issue Sep 21, 2019 · 1 comment
Open

How to create a TubeGeometry - use of Three.Curve #286

hagrid67 opened this issue Sep 21, 2019 · 1 comment

Comments

@hagrid67
Copy link

hagrid67 commented Sep 21, 2019

In your notebook examples/Geometries.ipynb you have the following for TubeGeometry:

# TODO: handling THREE.Curve
TubeGeometry(
    path=None,

I've naively tried using a LineCurve3 for the path but I get an error along the following lines:

TraitError: The 'path' trait of a TubeGeometry instance must be a Curve or None, but a value of class 'pythreejs.extras.curves.LineCurve3_autogen.LineCurve3' (i.e. LineCurve3()) was specified.

Is there a way to get TubeGeometry to work as things stand? Or can you sketch out what work would need to be done?

Comparing this with another example where a constructor takes another pythreejs object:

ball = Mesh(geometry=SphereGeometry(radius=1, widthSegments=32, heightSegments=24), 
            material=MeshLambertMaterial(color='red'),
            position=[2, 1, 0])

Here I find that SphereGeometry is configured in three-class-config.js to have superClass BaseGeometry. Whereas LineCurve3 has a fairly empty configuration, and the autogen python has only ThreeWidget rather than Curve as its superclass.

Many thanks.

@vidartf
Copy link
Member

vidartf commented Sep 23, 2019

I think this was left as a TODO because some logic has to be added to make sure Curve cannot be instantiated on the kernel side (it is an abstract base class). If you want to help with this, you could start by:

  1. Updating the class config to match the three.js docs as closely as possible.
  2. Add a manual override class in Python that cannot be instantiated directly (but can be instantiated as a subclass).

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

No branches or pull requests

2 participants