@ce232069 さん ありがとうございます。
自己交差した1本のスプラインと解釈しました。
こちらではこのようなデータを作成しました。(添付しておきます)

最初はプロファイルとなっている部分のみの長さを求めているのかと
思ったのですが、記載されたコードから全体の長さを取得すると解釈しています。

こちらでこのようなスクリプトを作成しましたが、自己交差の有無問わず
エラーが出ない為、状態を再現出来ませんでした。
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
msg: str = 'スケッチ曲線を選択 / ESC-キャンセル'
selFilter: str = 'SketchCurves'
sel: core.Selection = select_ent(msg, selFilter)
if not sel:
return
crv: fusion.SketchCurve = sel.entity
eva: core.CurveEvaluator3D = crv.geometry.evaluator
_, sPrm, ePrm = eva.getParameterExtents()
_, length = eva.getLengthAtParameter(sPrm, ePrm)
ui.messageBox(f"パス長さ合計{length}Cm")
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def select_ent(
msg: str,
filter: str
) -> core.Selection:
try:
app: core.Application = core.Application.get()
ui: core.UserInterface = app.userInterface
sel = ui.selectEntity(msg, filter)
return sel
except:
return None
但し、最初のリプライに記載しましたが、単に長さを取得するだけであれば
CurveEvaluator3Dを使用せずに、単純にlengthプロパティで取得可能です。
・・・
crv: fusion.SketchCurve = sel.entity
ui.messageBox(f"パス長さ合計{crv.length}Cm")
・・・
一つだけ疑問だったのが、
include=sketch.include(curve)
ですが、GUIの場合はこちらのコマンドを使用した事と同じです。

この処理の必要性がわかりませんでした。(必要無い気がします)
エラーとなるf3dファイルを添付して頂けると、もう少しお手伝い出来るかも
知れません。