Rhino common api

I tried using ArcCurve and LineCurve but the joinCurve is still not working i also checked if they are touching.
The creation of curves is successful but when I use JoinCurves in the end it gives an input type error again

# Define width and height

width = 3
height = 3

# Define the line

z = -radius - height
start_point_line = Rhino.Geometry.Point3d(0, -width / 2, z)
end_point_line = Rhino.Geometry.Point3d(0, width / 2, z)

line = Rhino.Geometry.LineCurve(start_point_line, end_point_line)

# Add the line to the document

model.Objects.AddCurve(line)

# Define the arc

start_arc_point = Rhino.Geometry.Point3d(0, width / 2, -radius - width)
end_arc_point = Rhino.Geometry.Point3d(0, -width / 2, -radius - width)
arc_point = Rhino.Geometry.Point3d(0, 0, -radius)
arc = Rhino.Geometry.Arc(start_arc_point, arc_point, end_arc_point)

# Create an ArcCurve from the Arc

arc_curve = Rhino.Geometry.ArcCurve(arc)

# Add the arc curve to the document

model.Objects.AddCurve(arc_curve)

# Ensure the curves are in a list

curves = [line, arc_curve]
joined_curves = Rhino.Geometry.Curve.JoinCurves(curves)

In most cases I find rhinoscriptsyntax to be a better choice for this sort of thing.

import rhinoscriptsyntax as rs

width = 3
height = 3

z = -radius - height
start_point_line = Rhino.Geometry.Point3d(0, -width / 2, z)
end_point_line = Rhino.Geometry.Point3d(0, width / 2, z)

line = AddLine(start_point_line, end_point_line)

start_arc_point = Rhino.Geometry.Point3d(0, width / 2, -radius - width)
end_arc_point = Rhino.Geometry.Point3d(0, -width / 2, -radius - width)
arc_point = Rhino.Geometry.Point3d(0, 0, -radius)

arc = rs.AddArc3Pt(start_arc_point, end_arc_point, arc_point)

joined_curves = rs.JoinCurves([line, arc])

Yes you’re right however i can’t use rhinoscriptsyntax because i am using rhinoinside so it’s not in editpythonscript

I would presume you need to cast your objects to all be “Curve” objects, not more specific things like Arcs or Lines. It’s telling you the input is of the wrong type, that’s what it’s saying.

This is a core concept for making sense of Rhinocommon, how you can/have to look at the same geometry through different structures. I usually use Rhinoscript for it but I would guess it’s through the ToNurbsCurve. Of course you can just look up the source of the rs.CoerceCurve function.

Hi @jjjer,

Something to try:

#! python 3
import Rhino
import scriptcontext as sc

# Define width and height
width = 3
height = 3

# Define the line
radius = 1

z = -radius - height
start_point_line = Rhino.Geometry.Point3d(0, -width / 2, z)
end_point_line = Rhino.Geometry.Point3d(0, width / 2, z)

line = Rhino.Geometry.LineCurve(start_point_line, end_point_line)

# Add the line to the document
#sc.doc.Objects.AddCurve(line)

# Define the arc
start_arc_point = Rhino.Geometry.Point3d(0, width / 2, -radius - width)
end_arc_point = Rhino.Geometry.Point3d(0, -width / 2, -radius - width)
arc_point = Rhino.Geometry.Point3d(0, 0, -radius)
arc = Rhino.Geometry.Arc(start_arc_point, arc_point, end_arc_point)

# Create an ArcCurve from the Arc
arc_curve = Rhino.Geometry.ArcCurve(arc)

# Add the arc curve to the document
#sc.doc.Objects.AddCurve(arc_curve)

# Ensure the curves are in a list
curves = [line, arc_curve]
tol = 2.1 * sc.doc.ModelAbsoluteTolerance
joined_curves = Rhino.Geometry.Curve.JoinCurves(curves, tol)
if joined_curves:
    for c in joined_curves:
        sc.doc.Objects.AddCurve(c)

sc.doc.Views.Redraw()

– Dale