Trying to add a Nurbs surface to a Model using rhino3d.
I am getting a popup error when trying to add a surface to a model.
How do I add a NurbsSurface to the list of Objects in a File3DM?
Code is
def processSurfaceUV(self, surface):
print(f"=========== Process Surface UV")
print(dir(surface))
UDegree = surface.UDegree
UOrder = UDegree + 1
VDegree = surface.VDegree
VOrder =VDegree + 1
UPoles = surface.NbUPoles
VPoles = surface.NbVPoles
poles = surface.getPoles()
print(f"UPoles {UPoles} VPoles {VPoles}")
print(f"Poles {poles}")
print(f"Poles {len(poles)} x {len(poles[0])}")
print(f"Surface UDegree {UDegree} VDegree {VDegree}")
VKnots = surface.getVKnots()
UKnots = surface.getUKnots()
VMults = surface.getVMultiplicities()
UMults = surface.getUMultiplicities()
nurbSurf = r3.NurbsSurface.Create(3, False, UOrder, VOrder, UPoles, VPoles)
for c in range(0, len(self.curves)-1, 2):
nurbSurf.CreateRuledSurface(self.curves[c], self.curves[c+1])
self.model.Objects.AddSurface(nurbSurf)
And report view has
06:52:48 =========== Process Surface UV
06:52:48 ['Content', 'Continuity', 'FirstUKnotIndex', 'FirstVKnotIndex', 'LastUKnotIndex', 'LastVKnotIndex', 'MaxDegree', 'MemSize', 'Module', 'NbUKnots', 'NbUPoles', 'NbVKnots', 'NbVPoles', 'Rotation', 'Tag', 'TypeId', 'UDegree', 'UKnotSequence', 'UPeriod', 'VDegree', 'VKnotSequence', 'VPeriod', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'approximate', 'bounds', 'buildFromNSections', 'buildFromPolesMultsKnots', 'clone', 'copy', 'curvature', 'curvatureDirections', 'deleteExtensionOfName', 'deleteExtensionOfType', 'dumpContent', 'exchangeUV', 'getAllDerivedFrom', 'getD0', 'getDN', 'getExtensionOfName', 'getExtensionOfType', 'getExtensions', 'getPole', 'getPoles', 'getPolesAndWeights', 'getResolution', 'getUKnot', 'getUKnots', 'getUMultiplicities', 'getUMultiplicity', 'getVKnot', 'getVKnots', 'getVMultiplicities', 'getVMultiplicity', 'getWeight', 'getWeights', 'hasExtensionOfName', 'hasExtensionOfType', 'increaseDegree', 'increaseUMultiplicity', 'increaseVMultiplicity', 'incrementUMultiplicity', 'incrementVMultiplicity', 'insertUKnot', 'insertUKnots', 'insertVKnot', 'insertVKnots', 'interpolate', 'intersect', 'intersectSS', 'isDerivedFrom', 'isPlanar', 'isUClosed', 'isUPeriodic', 'isURational', 'isUmbillic', 'isVClosed', 'isVPeriodic', 'isVRational', 'mirror', 'movePoint', 'normal', 'parameter', 'projectPoint', 'removeUKnot', 'removeVKnot', 'reparametrize', 'restoreContent', 'rotate', 'scale', 'scaleKnotsToBounds', 'segment', 'setExtension', 'setPole', 'setPoleCol', 'setPoleRow', 'setUKnot', 'setUKnots', 'setUNotPeriodic', 'setUOrigin', 'setUPeriodic', 'setVKnot', 'setVKnots', 'setVNotPeriodic', 'setVOrigin', 'setVPeriodic', 'setWeight', 'setWeightCol', 'setWeightRow', 'tangent', 'toBSpline', 'toShape', 'toShell', 'transform', 'translate', 'uIso', 'vIso', 'value']
06:52:48 UPoles 4 VPoles 4
06:52:48 Poles [[Vector (0.0, -2.1094e-13, 950.0000000000002), Vector (9.659258262890681, 5.0, 947.4118095489748), Vector (28.977774788672047, 8.0, 942.2354286469243), Vector (57.438078953694884, 8.0, 934.6095131295624)], [Vector (0.0, -1.4063e-13, 633.3333333333334), Vector (42.76981488940422, 10.366509419193466, 639.800038783734), Vector (114.98804248098074, 25.942211699085767, 653.0411226863124), Vector (183.98534651073962, 26.38138706943139, 663.2280220819055)], [Vector (0.0, -7.031e-14, 316.6666666666667), Vector (57.53550845184717, 19.535200851630535, 330.32632856766327), Vector (168.69102989879252, 30.690388721092194, 358.1915456916792), Vector (286.11668478862555, 21.750615453785397, 385.25146526120216)], [Vector (0.0, 0.0, 0.0), Vector (77.27406610312545, 18.0, 20.70552360820168), Vector (193.18516525781365, 15.0, 51.763809020504205), Vector (338.0740392011739, 0.0, 90.58666578588236)]]
06:52:48 Poles 4 x 4
06:52:48 Surface UDegree 3 VDegree 3
Exported file with just edges and no surface processing
Silk_WF_3_CubicSurface-CubicSurface_44_000.3dm (8.7 KB)