Type casting in Design Script


#1

I have a series of NurbsCurves and want to make floor slabs out of them. They are closed curves, and they are planar. But when I try to use the Floor.ByTypeOutlineAndLevel, I get a warning message stating “operation failed. External component has thrown an exception”

I’ve tried extracting the control points of the nurbs curve and generating a polygon but that doesn’t yield the same geometric profile desired.

When I use a polygon, polycurve or a curve, the component generates a proper floor slab. Is there a way to type cast a nurbs curve into a curve, polygon, or polycurve in a code block?

I’ve tested in visual studio casting a nurbs curve to a curve and it worked. But I don’t want to have to create a custom component for this.

Thanks,


#2


#3

I’d try Vikram’s suggestion first. Most likely it’s a problem with the geometry of the NURBS (like number of knots).

Tho if you do want to cast a NURBS curve to a curve class, all you need to do is run it through a curve action node. That;s because the NC is a subclass of the Curve class and all of the curve methods reside inside it. For example:


#4

Vikram’s solution seems to be working well. Since the curves are closed curves, extending the start or end doesn’t work for this instance.

Thanks!


#5

Sorry for digging up an old post, but this was really helpful!

I was unable to generate area boundary lines from certain curves and was getting errors about the number of interior knots. Curve.ApproximateWithArcAndLineSegments worked for me. Thanks Vikram!