KeithSloan / ImportNURBS

Add Import of 3DM files to FreeCAD
Other
11 stars 5 forks source link

<class 'AttributeError'>: 'rhino3dm._rhino3dm.PolylineCurve' object has no attribute 'Radius' #6

Open s-light opened 2 years ago

s-light commented 2 years ago

if i try to import attached example file i get this error message:

<class 'AttributeError'>: 'rhino3dm._rhino3dm.PolylineCurve' object has no attribute 'Radius'

steps to reproduce

expected result

full console log

$ freecad
FreeCAD 0.19, Libs: 0.19R
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2021
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

connect failed: No such file or directory
Import 3DM file : /home/stefan/mydata/freecad/tests/STEP_import/BallAndCubeRH7.3dm
Import3DM Version 0.01
-----------------
Extrusion
Geometry type
<class 'rhino3dm._rhino3dm.Extrusion'>
Extrusion
['AddInnerProfile', 'CapCount', 'Create', 'CreateBoxExtrusion', 'CreateCylinderExtrusion', 'CreatePipeExtrusion', 'Decode', 'Degree', 'Domain', 'Duplicate', 'Encode', 'FrameAt', 'GetBoundingBox', 'GetMesh', 'GetNurbsFormParameterFromSurfaceParameter', 'GetPathPlane', 'GetProfilePlane', 'GetProfileTransformation', 'GetSpanVector', 'GetSurfaceParameterFromNurbsFormParameter', 'GetUserString', 'GetUserStrings', 'HasBrepForm', 'IsAtSeam', 'IsAtSingularity', 'IsCappedAtBottom', 'IsCappedAtTop', 'IsClosed', 'IsCone', 'IsCylinder', 'IsDeformable', 'IsMiteredAtEnd', 'IsMiteredAtStart', 'IsPeriodic', 'IsPlanar', 'IsSingular', 'IsSolid', 'IsSphere', 'IsTorus', 'IsValid', 'IsoCurve', 'MakeDeformable', 'MiterPlaneNormalAtEnd', 'MiterPlaneNormalAtStart', 'NormalAt', 'ObjectType', 'PathEnd', 'PathLineCurve', 'PathStart', 'PathTangent', 'PointAt', 'Profile3d', 'ProfileCount', 'ProfileIndex', 'RdkXml', 'Rotate', 'Scale', 'SetDomain', 'SetOuterProfile', 'SetPathAndUp', 'SetUserString', 'SpanCount', 'ToBrep', 'ToNurbsSurface', 'Transform', 'Translate', 'UserStringCount', 'WallEdge', 'WallSurface', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
Is Cylinder : False
<bound method PyCapsule.NormalAt of <rhino3dm._rhino3dm.Extrusion object at 0x7f81a8366cb0>>
0.0,15.000000000000002,0.0
0.0,15.000000000000002,12.0
0.0,0.0,1.0
<bound method PyCapsule.PointAt of <rhino3dm._rhino3dm.Extrusion object at 0x7f81a8366cb0>>
<bound method PyCapsule.GetPathPlane of <rhino3dm._rhino3dm.Extrusion object at 0x7f81a8366cb0>>
Profile Count : 1
0
<rhino3dm._rhino3dm.PolylineCurve object at 0x7f81c05977f0>
False
3
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/stefan/.FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 36, in insert
    process3DM(doc,filename)
  File "/home/stefan/.FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 405, in process3DM
    fi.parse_objects(doc)
  File "/home/stefan/.FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 58, in parse_objects
    obj = self.import_geometry(doc, self.f3dm.Objects[i].Geometry)
  File "/home/stefan/.FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 231, in import_geometry
    print(c.Radius)
<class 'AttributeError'>: 'rhino3dm._rhino3dm.PolylineCurve' object has no attribute 'Radius'

the same happens with the current daily build:

$ freecad-daily 
FreeCAD 0.20, Libs: 0.20R
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2022
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Sheet Metal workbench loaded
Assembly4 workbench (v0.11.10) loaded
Interlocking laser cut workbench loaded
('Mod/Pyramids_and_polyhedrons', 'Mod/Pyramids-and-Polyhedrons', 'Mod/FreeCAD-Pyramids-and-Polyhedrons', 'Mod/Pyramids-and-polyhedrons')
Cannot find icon: /Resources/icons/Maker_workbench_icon.svg
connect failed: No such file or directory
Import 3DM file : /home/stefan/mydata/freecad/tests/STEP_import/BallAndCubeRH7.3dm
Import3DM Version 0.01
-----------------
Extrusion
Geometry type
<class 'rhino3dm._rhino3dm.Extrusion'>
Extrusion
['AddInnerProfile', 'CapCount', 'Create', 'CreateBoxExtrusion', 'CreateCylinderExtrusion', 'CreatePipeExtrusion', 'Decode', 'Degree', 'Domain', 'Duplicate', 'Encode', 'FrameAt', 'GetBoundingBox', 'GetMesh', 'GetNurbsFormParameterFromSurfaceParameter', 'GetPathPlane', 'GetProfilePlane', 'GetProfileTransformation', 'GetSpanVector', 'GetSurfaceParameterFromNurbsFormParameter', 'GetUserString', 'GetUserStrings', 'HasBrepForm', 'IsAtSeam', 'IsAtSingularity', 'IsCappedAtBottom', 'IsCappedAtTop', 'IsClosed', 'IsCone', 'IsCylinder', 'IsDeformable', 'IsMiteredAtEnd', 'IsMiteredAtStart', 'IsPeriodic', 'IsPlanar', 'IsSingular', 'IsSolid', 'IsSphere', 'IsTorus', 'IsValid', 'IsoCurve', 'MakeDeformable', 'MiterPlaneNormalAtEnd', 'MiterPlaneNormalAtStart', 'NormalAt', 'ObjectType', 'PathEnd', 'PathLineCurve', 'PathStart', 'PathTangent', 'PointAt', 'Profile3d', 'ProfileCount', 'ProfileIndex', 'RdkXml', 'Rotate', 'Scale', 'SetDomain', 'SetOuterProfile', 'SetPathAndUp', 'SetUserString', 'SpanCount', 'ToBrep', 'ToNurbsSurface', 'Transform', 'Translate', 'UserStringCount', 'WallEdge', 'WallSurface', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
Is Cylinder : False
<bound method PyCapsule.NormalAt of <rhino3dm._rhino3dm.Extrusion object at 0x7f9974472d70>>
0.0,15.000000000000002,0.0
0.0,15.000000000000002,12.0
0.0,0.0,1.0
<bound method PyCapsule.PointAt of <rhino3dm._rhino3dm.Extrusion object at 0x7f9974472d70>>
<bound method PyCapsule.GetPathPlane of <rhino3dm._rhino3dm.Extrusion object at 0x7f9974472d70>>
Profile Count : 1
0
<rhino3dm._rhino3dm.PolylineCurve object at 0x7f99baa0f730>
False
3
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/stefan/mydata/freecad/config/share_FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 36, in insert
    process3DM(doc,filename)
  File "/home/stefan/mydata/freecad/config/share_FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 405, in process3DM
    fi.parse_objects(doc)
  File "/home/stefan/mydata/freecad/config/share_FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 58, in parse_objects
    obj = self.import_geometry(doc, self.f3dm.Objects[i].Geometry)
  File "/home/stefan/mydata/freecad/config/share_FreeCAD/Mod/ImportNURBS/freecad/importNURBS/import3DM.py", line 231, in import_geometry
    print(c.Radius)
<class 'AttributeError'>: 'rhino3dm._rhino3dm.PolylineCurve' object has no attribute 'Radius'

i attached the file i tried to load. BallAndCube.zip

s-light commented 2 years ago

fixed with #8

KeithSloan commented 2 years ago

As you say in #8 the Brep shape is handled but the extrusion of the PolylineCurve is NOT.

I am unsure if I should be calling ToNurbsCurve or ToPolyLine and how to test, do you have an image of object so I see what sort of line is being extruded.

s-light commented 2 years ago

thanks for looking into it! i check tomorow if i have a image of the result...

s-light commented 2 years ago

i only have the - also included in the zip file - step BallAndCube.stp. imported in FreeCAD it looks like this: image