CurveMeshIntersection

计算一条曲线和一个网格物件的相交。

语法

rhinoscriptsyntax.CurveMeshIntersection (curve_id, mesh_id, return_faces=False)

rhinoscript.mesh.CurveMeshIntersection (curve_id, mesh_id, return_faces=False)

参数

curve_id

必须参数。字符串或 Guid。要相交曲线的ID。

mesh_id

必须参数。字符串或 Guid。要相交网格的ID。

return_faces

可选参数。布尔值。同时返回相交点和相交面序号。省略或设置为 False,仅返回相交点。

返回值

List.

如果 return_faces 省略或为 False,返回相交点列表。

List.

如果 return_faces 为 True,返回列表的每个元素为含有相交信息的一维列表。每个子列表包括以下两个元素:

元素

类型

描述

0

Point3d

作为交点的 3-D 点。

1

数字

交点所在网格面的序号。

None

如果执行不成功或出错,返回空值。

示例

import rhinoscriptsyntax as rs

curve = rs.GetObject("Select curve to intersect", rs.filter.curve)

if curve:

    mesh = rs.GetObject("Select mesh to intersect", rs.filter.mesh)

    if mesh:

        cmx = rs.CurveMeshIntersection(curve, mesh, True)

        if cmx:

            for element in cmx:

                print element[0], ", Face index = ", element[1]

                rs.AddPoint(element[0])

同见

MeshClosestPoint

MeshMeshIntersection