rdeits / MeshCat.jl

WebGL-based 3D visualizer in Julia
MIT License
233 stars 42 forks source link

setobject!() ERROR: 'no method matching setobject' #200

Closed PratyushBhattacharya closed 1 year ago

PratyushBhattacharya commented 3 years ago

I'm a greenhorn in Julia & meshcat. I'm trying to run the demo codes in the meshcat GitHUb page in Juno-Atom, but it cannot find the 'setobject!' method. Please help!

`using MeshCat using GeometryTypes using CoordinateTransformations

vis = Visualizer()

open(vis)

setobject!(vis, HyperRectangle(Vec(0., 0, 0), Vec(1., 1, 1))) settransform!(vis, Translation(-0.5, -0.5, 0))`

ERROR:

┌ Info: MeshCat server started. You can open the visualizer by visiting the following URL in your browser: ort └ http://127.0.0.1:8703
ERROR: LoadError: MethodError: no method matching setobject!(::Visiisualizer, ::HyperRectangle{3, Float64}) Closest candidates are: setobject!(::AbstractVisualizer, ::GeometryLike) at C:\Users\AisiSUS.julia\packages\MeshCat\GlCMx\src\abstract_visualizer.jl:21 setobject!(::AbstractVisualizer, ::GeometryLike, ::AbstractMaterial) at C:\Users\ASUS.julia\packages\MeshCat\GlCMx\src\abstraisuct_visualizer.jl:29 setobject!(::Visualizer, ::AbstractObject) at C:\Users\ASUS.julia\packages\MeshCat\GlCMx\src\visualizer.jl:199 SUS Stacktrace:
[1] top-level scope eri @ C:\Users\ASUS\AppData\Local\atom\app-1.57.0\scratch.jl:9 tis [2] eval @ .\boot.jl:360 [inlined] uli [3] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) @ Base .\loading.jl:1094 in expression starting at C:\Users\ASUS\AppData\Local\atom\app-1 .57.0\scratch.jl:9 julia>

ornithos commented 3 years ago

@PratyushBhattacharya I ran into the same thing - looks like the problem crops up from the switch from GeometryTypes (deprecated) to GeometryBasics (commit 9feb28). Both packages define many of the same types, but GeometryLike in MeshCat.jl is defined only for the latter package. Hence changing the example code in the README file as follows should do the trick:

- using GeometryTypes
+ using GeometryBasics
ferrolho commented 3 years ago

You are correct, @ornithos. We should update the examples in the README.md, since the latest releases of MeshCat.jl are now using GeometryBasics.jl instead of GeometryTypes.jl.

ferrolho commented 1 year ago

This issue has now been resolved. The only thing to note is that the contours example is not working because GeometryBasics.jl does not have a SignedDistanceField method, which GeometryTypes.jl used to have. I've captured this in issue https://github.com/rdeits/MeshCat.jl/issues/239, so I'm going to close this one.