- UID
- 658062
- 积分
- 2147
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2008-10-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- [LispFunction("ReturnArgs")]
- public static Object ReturnArgs(ResultBuffer args)
- {
- // extract the lisp parameters if any !
- if (args != null)
- {
- // extract Arguments
- ResultBuffer argsOut = new ResultBuffer();
- //Database db = Application.DocumentManager.MdiActiveDocument.Database;
- Database db = HostApplicationServices.WorkingDatabase;
- Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
- foreach (TypedValue arg in args)
- {
- switch (arg.TypeCode)
- {
- case (short)LispDataType.Angle:
- ed.WriteMessage("\n Angle");
- argsOut.Add(new TypedValue((int)LispDataType.Angle, arg.Value));
- break;
- case (short)LispDataType.DottedPair:
- ed.WriteMessage("\n DottedPair");
- argsOut.Add(new TypedValue((int)LispDataType.DottedPair, arg.Value));
- break;
- case (short)LispDataType.Double:
- ed.WriteMessage("\n Double");
- argsOut.Add(new TypedValue((int)LispDataType.Double, arg.Value));
- break;
- case (short)LispDataType.Int16:
- ed.WriteMessage("\n Int16");
- argsOut.Add(new TypedValue((int)LispDataType.Int16, arg.Value));
- break;
- case (short)LispDataType.Int32:
- ed.WriteMessage("\n Int32");
- argsOut.Add(new TypedValue((int)LispDataType.Int32, arg.Value));
- break;
- case (short)LispDataType.ListBegin:
- ed.WriteMessage("\nListBegin");
- argsOut.Add(new TypedValue((int)LispDataType.ListBegin, arg.Value));
- break;
- case (short)LispDataType.ListEnd:
- ed.WriteMessage("\nListEnd");
- argsOut.Add(new TypedValue((int)LispDataType.ListEnd, arg.Value));
- break;
- case (short)LispDataType.Nil:
- ed.WriteMessage("\n Nil");
- argsOut.Add(new TypedValue((int)LispDataType.Nil, arg.Value));
- break;
- case (short)LispDataType.None:
- ed.WriteMessage("\n None");
- argsOut.Add(new TypedValue((int)LispDataType.None, arg.Value));
- break;
- case (short)LispDataType.ObjectId:
- ed.WriteMessage("\nObjectId");
- argsOut.Add(new TypedValue((int)LispDataType.ObjectId, arg.Value));
- break;
- case (short)LispDataType.Orientation:
- ed.WriteMessage("\n Orientation");
- argsOut.Add(new TypedValue((int)LispDataType.Orientation, arg.Value));
- break;
- case (short)LispDataType.Point2d:
- ed.WriteMessage("\n Point2d");
- argsOut.Add(new TypedValue((int)LispDataType.Point2d, arg.Value));
- break;
- case (short)LispDataType.Point3d:
- ed.WriteMessage("\n Point3d");
- argsOut.Add(new TypedValue((int)LispDataType.Point3d, arg.Value));
- break;
- case (short)LispDataType.SelectionSet:
- ed.WriteMessage("\n SelectionSet");
- ObjectId[] ids = new ObjectId[0];
- SelectionSet ss = SelectionSet.FromObjectIds(ids);
- ss = arg.Value as SelectionSet;
- argsOut.Add(new TypedValue((int)LispDataType.Int16, ss.Count));
- ObjectId[] oidcol = ss.GetObjectIds();
- foreach (ObjectId oid in oidcol)
- {
- argsOut.Add(new TypedValue((int)LispDataType.Text, oid.Handle.ToString()));
- }
- break;
- case (short)LispDataType.T_atom:
- ed.WriteMessage("\n T_atom\n");
- argsOut.Add(new TypedValue((int)LispDataType.T_atom, arg.Value));
- break;
- case (short)LispDataType.Text:
- ed.WriteMessage("\n Text\n");
- argsOut.Add(new TypedValue((int)LispDataType.Text, arg.Value));
- break;
- default:
- ed.WriteMessage("\n Error: incorrect argument\n");
- argsOut.Add(new TypedValue((int)LispDataType.Text, "Error: incorrect argument"));
- //ed.WriteMessage("\nError: incorrect argument\n");
- break;
- }
- }
- return argsOut;
- }
- else
- {
- return new TypedValue((int)LispDataType.Nil, "nil");
- }
- }
说明:
(returnargs params)
params 任何Lisp数据,返回在 C# 中的TypeCode |
|