compas-dev / compas

Core packages of the COMPAS framework.
https://compas.dev/compas/
MIT License
309 stars 105 forks source link

NurbsCurve compas.plugins.PluginNotInstalledError #1102

Open sh-stesney opened 1 year ago

sh-stesney commented 1 year ago

Describe the bug Compas fails to produce a Nurbs curve from points.

Traceback (most recent call last):
  File "c:\Users\sh_st\Code_local\ibs\ibs_core\nurbs_curve_test.py", line 12, in <module>
    test_nurbs_curve()
  File "c:\Users\sh_st\Code_local\ibs\ibs_core\nurbs_curve_test.py", line 9, in test_nurbs_curve
    curve = NurbsCurve.from_points([Point(0, 0, 0), Point(3, 6, 0), Point(6, -3, 3), Point(10, 0, 0)])
  File "C:\Users\sh_st\anaconda3\envs\ibsenv\lib\site-packages\compas\geometry\curves\nurbs.py", line 267, in from_points
    return new_nurbscurve_from_points(cls, points, degree=degree)
  File "C:\Users\sh_st\anaconda3\envs\ibsenv\lib\site-packages\compas\plugins.py", line 302, in wrapper
    plugin_impl = _select_plugin(extension_point_url)
  File "C:\Users\sh_st\anaconda3\envs\ibsenv\lib\site-packages\compas\plugins.py", line 486, in select_plugin
    raise PluginNotInstalledError("Plugin not found for extension point URL: {}".format(extension_point_url))
compas.plugins.PluginNotInstalledError: Plugin not found for extension point URL: https:/plugins.compas.dev/factories/new_nurbscurve_from_points

To Reproduce Steps to reproduce the behavior: Sample script:

from compas.geometry import Point, NurbsCurve

def test_nurbs_curve():

    curve = NurbsCurve.from_points([Point(0, 0, 0), Point(3, 6, 0), Point(6, -3, 3), Point(10, 0, 0)])

if __name__ == "__main__":
    test_nurbs_curve()

Expected behavior The function should return a nurbs curve

Desktop (please complete the following information):

Additional context Compas v1.17.3

tomvanmele commented 1 year ago

hi,

the error message is indeed not very helpful. to work with NURBS outside of Rhino, you have to install compas_occ...

activate your environment and do conda install compas_occ

sh-stesney commented 1 year ago

Thank you so much. That worked.

I need curves to make breps with the extrusion method, however testing is returning unexpected results. I was expected the two breps to have equal area and volume.

from compas.geometry import Point, Vector, Box
from compas_occ.brep import BRep
from compas_occ.geometry import OCCNurbsCurve

def test_brep():

    points = [
        Point(0, 0, 0),
        Point(0, 10, 0),
        Point(10, 10, 0),
        Point(10, 0, 0),
        Point(0,0,0)
    ]
    curve = OCCNurbsCurve.from_points(points, degree=1)
    vector = Vector(0, 0, 10)
    brep1 = BRep.from_extrusion(curve, vector)
    print(f"curve length: {curve.length()}")
    print(f"brep1 - area: {brep1.area}, volume: {brep1.volume}")

    box = Box.from_width_height_depth(10, 10, 10)
    brep2 = BRep.from_box(box)
    print(f"brep2 - area: {brep2.area}, volume: {brep2.volume}")

if __name__ == "__main__":
    test_brep()
curve length: 40.0
brep1 - area: 400.0, volume: 650.804722446989
brep2 - area: 599.9999999999999, volume: 999.9999999999998