vb.net调用lisp文件
请大神给段代码 C#的版本extern static private int acedInvoke(IntPtr args, out IntPtr result);
public static ResultBuffer CallLispFunction(ResultBuffer args)
{
IntPtr ip = IntPtr.Zero;
int st = acedInvoke(args.UnmanagedObject, out ip);
if (ip != IntPtr.Zero)
{
ResultBuffer rbRes = ResultBuffer.Create(ip, true);
return rbRes;
}
return null;
}
public static ResultBuffer CallLispFunction(string name, params object[] args)
{
ResultBuffer rbArgs = new ResultBuffer();
rbArgs.Add(new TypedValue((int)LispDataType.Text, name));
foreach (object val in args)
{
AddValueToResultBuffer(ref rbArgs, val);
}
return CallLispFunction(rbArgs);
} private static void AddValueToResultBuffer(ref ResultBuffer rb, object obj)
{
if (obj == null)
{
rb.Add(new TypedValue((int)LispDataType.Text, ""));
}
else
{
if (obj is string)
{
rb.Add(new TypedValue((int)LispDataType.Text, obj));
}
else if (obj is Point2d)
{
rb.Add(new TypedValue((int)LispDataType.Text, "_non"));
rb.Add(new TypedValue((int)LispDataType.Point2d, obj));
}
else if (obj is Point3d)
{
rb.Add(new TypedValue((int)LispDataType.Text, "_non"));
rb.Add(new TypedValue((int)LispDataType.Point3d, obj));
}
else if (obj is ObjectId)
{
rb.Add(new TypedValue((int)LispDataType.ObjectId, obj));
}
else if (obj is SelectionSet)
{
rb.Add(new TypedValue((int)LispDataType.SelectionSet, obj));
}
else if (obj is double)
{
rb.Add(new TypedValue((int)LispDataType.Double, obj));
}
else if (obj is short)
{
rb.Add(new TypedValue((int)LispDataType.Int16, obj));
}
else if (obj is int)
{
rb.Add(new TypedValue((int)LispDataType.Int32, obj));
}
else if (obj is TypedValue)
{
rb.Add(obj);
}
}
} 雪山飞狐_lzh 发表于 2014-7-11 17:54 static/image/common/back.gif
private static void AddValueToResultBuffer(ref ResultBuffer rb, object obj)
{
...
要在VB.NET中写一段可以调用lisp程序的代码。能否给个VB代码。 自己转换一下吧 呵呵
VB.NET--->C#
地址(C#---> VB.NET):
http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx
地址( VB.NET--->C#):
http://www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx
雪山飞狐_lzh 发表于 2014-7-12 19:12 static/image/common/back.gif
自己转换一下吧 呵呵
VB.NET--->C#
谢谢大神的帮助
页:
[1]