- 积分
- 260
- 明经币
- 个
- 注册时间
- 2011-10-14
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 syeanwoo 于 2011-12-5 17:34 编辑
在一个过程中调用了求直线斜率a和截矩b的函数(见最后),用一个二维点Point2d的X和Y分别来存储a和b,VS没有提示有问题,但是运行时却说4613行( 现在的第3行:Point3d pt1 = L3d.StartPoint;)有问题,以下为错误提示信息,望各位赐教,多谢:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Autodesk.AutoCAD.Geometry.Curve3d.get_StartPoint()
at MyProject.CADCom.LineAB(Line3d L3d) in F:\Users\Syean Woo\Documents\Visual Studio 2010\Projects\MyFirstProject\MyFirstProject\MyClass.cs:line 4613
at MyProject.CADCom.IntersectPoints(Line3d L1, Line3d L2) in F:\Users\Syean Woo\Documents\Visual Studio 2010\Projects\MyFirstProject\MyFirstProject\MyClass.cs:line 4581
at MyProject.ModifyObjects.ThreeArcs() in F:\Users\Syean Woo\Documents\Visual Studio 2010\Projects\MyFirstProject\MyFirstProject\MyClass.cs:line 2741
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
- static public Point2d LineAB(Line3d L3d)
- {
- Point3d pt1 = L3d.StartPoint;
- Point3d pt2 = L3d.EndPoint;
- double a = (pt1.Y - pt2.Y) / (pt1.X - pt2.X);
- double b = (pt1.X * pt2.Y - pt2.X * pt1.Y) / (pt1.X - pt2.X);
- return new Point2d(a, b);
- }
复制代码
|
|