目录
1.Curve.CreateFromGeCurve (Curve3d)
Curve.Extend ([MarshalAs(UnmanagedType.U1)] bool, Point3d)
3.GetClosestPointTo【获取曲线(Curve)上与给定点(Point3d)最近的点】GetClosestPointTo
4.GetFirstDerivative【切线向量】GetFirstDerivative
Curve.GetFirstDerivative (double)
Curve.GetFirstDerivative (Point3d)
5.GetDistanceAtParameter【获取曲线上起点到指定参数值处的曲线长度】
?7.GetOffsetCurvesGivenPlaneNormal
8. GetOrthoProjectedCurve【用于获取曲线在给定平面上的正交投影曲线】
9.GetParameterAtDistance【该函数确定从曲线开始沿曲线的距离为dist的位置上的曲线参数。】
10.GetParameterAtPoint【用于根据给定点获取曲线上的参数值】GetParameterAtPoint
11.GetPointAtDist【用于获取曲线上指定距离处的点坐标的函数】GetPointAtDist
12.GetPointAtParameter【函数确定曲线上与 给定参数值 对应的点,并返回该点的坐标】GetPointAtParameter
?13.GetProjectedCurve 【用于获取曲线在给定平面上的投影曲线的函数】
14.GetSecondDerivative【用于获取曲线在指定参数值或指定点处的二阶导数非法线,作用?】
Curve.GetSecondDerivative (double)
Curve.GetSecondDerivative (Point3d)
15.GetSplitCurves【用于将曲线在指定参数值集合或点集合处进行分割成多个个子曲线(内存对象,不显示)】
16. ReverseCurve【用于反转给定的曲线对象,反转曲线的参数化:起点变成终点】2008无
Curve类下的分支
Autodesk.AutoCAD.DatabaseServices.DBObject Autodesk.AutoCAD.DatabaseServices.Entity Autodesk.AutoCAD.DatabaseServices.Curve Autodesk.AutoCAD.DatabaseServices.Arc Autodesk.AutoCAD.DatabaseServices.Circle Autodesk.AutoCAD.DatabaseServices.Ellipse Autodesk.AutoCAD.DatabaseServices.Leader Autodesk.AutoCAD.DatabaseServices.Line Autodesk.AutoCAD.DatabaseServices.Polyline Autodesk.AutoCAD.DatabaseServices.Polyline2d Autodesk.AutoCAD.DatabaseServices.Polyline3d Autodesk.AutoCAD.DatabaseServices.Ray Autodesk.AutoCAD.DatabaseServices.Spline Autodesk.AutoCAD.DatabaseServices.Xline
1.Curve.CreateFromGeCurve (Curve3d)
是AutoCAD(CAD软件)的API中的一个方法,用于创建AutoCAD中的曲线对象(Curve
)。
该方法的参数 Curve3d
是一个表示三维曲线的对象。它可以是AutoCAD中的任何一种派生自 Curve3d
类的类型,如 LineSegment3d
、CircularArc3d
等。
Curve.CreateFromGeCurve(Curve3d)
方法会将给定的 Curve3d
对象转换为AutoCAD中的曲线对象。返回的曲线对象可以进行进一步的操作,例如修改、显示或计算其长度。
Curve.CreateFromGeCurve (Curve3d, Tolerance)
:该方法的第一个参数 Curve3d
是一个表示三维曲线的对象,可以是AutoCAD中的任何一种派生自 Curve3d
类的类型,如 LineSegment3d
、CircularArc3d
等。
第二个参数 Tolerance
是一个浮点数,表示容差值。它定义了曲线拟合的精度。容差值越小,曲线拟合的精度就越高。
2.Extend
Curve.Extend ([MarshalAs(UnmanagedType.U1)] bool, Point3d)
这个函数将曲线扩展到指定的点。用于延伸曲线对象(Curve
)的端点。
该方法接受两个参数:
-
第一个参数是一个布尔值(
bool
),用于指定延伸的方式。- 如果该值为
true
,则表示延伸曲线以无限延伸直到达到指定的点。 - 如果该值为
false
,则表示仅延伸曲线直到达到指定的点,不进行无限延伸。
- 如果该值为
-
第二个参数是一个三维点(
Point3d
),表示延伸曲线的目标点。
调用 Curve.Extend(bool, Point3d)
方法后,曲线对象的端点将会被延伸到目标点处。如果指定了无限延伸,曲线将一直延伸到目标点,否则只会延伸到目标点。
需要注意的是,该方法只适用于支持延伸操作的曲线类型,如直线、圆弧等。对于其他类型的曲线,可能需要使用不同的方法或技术来实现类似的效果。
Curve.Extend (double)
该函数将曲线的起点或终点扩展到由newParameter值确定的新点。
该方法接受一个参数:参数是一个双精度浮点数(double
),表示延伸的长度。
调用 Curve.Extend(double)
方法后,曲线对象的端点将会被延伸指定的长度。延伸的方向由曲线自身的起始点和朝向确定。
需要注意的是,延伸的长度可以是正数、负数或零,具体取决于所使用的单位系统和曲线的几何特性。正数表示向曲线的朝向方向延伸,负数表示向相反方向延伸,零表示不进行延伸。
如果进行延伸后的曲线与其他曲线相交或产生自相交,可能需要考虑进一步处理这些情况,以确保得到符合设计要求的结果。
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
public class CurveExtensionExample
{
[CommandMethod("ExtendCurve")]
public void ExtendCurve()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor editor = doc.Editor;
// 创建直线对象
Point3d startPoint = new Point3d(0, 0, 0);
Point3d endPoint = new Point3d(5, 0, 0);
Line line = new Line(startPoint, endPoint);
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr = trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
// 将直线添加到模型空间中
ObjectId lineId = btr.AppendEntity(line);
trans.AddNewlyCreatedDBObject(line, true);
// 延伸直线
double extensionLength = 2.0;
line.Extend(extensionLength);
// 提交事务并关闭
trans.Commit();
}
}
}
在上述示例中,我们创建了一个名为 CurveExtensionExample
的类,并在其中定义了一个名为 ExtendCurve
的方法。这个方法包含了整个操作的代码。
在方法中,我们首先获取当前文档的相关对象,然后创建一个起点坐标为 (0, 0, 0)、终点坐标为 (5, 0, 0) 的直线对象。接着通过事务将直线对象添加到模型空间中,并使用 line.Extend(extensionLength)
方法对直线进行延伸操作,将终点向正向延伸 2 个单位长度。