AutoCAD二次开发(.Net)之获取LSP变量的值
2024-08-29 22:21:03
//https://blog.csdn.net/qq_21489689/article/details/78973787
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("accore.dll", EntryPoint = "acedPutSym",
CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
extern static private int acedPutSym(string args, IntPtr result); /// <summary>
/// Set a LISP variable value.
/// </summary>
/// <param name="name">The variable name.</param>
/// <param name="rb">The variable value</param>
public static void SetLispSym(string name, ResultBuffer rb)
{
acedPutSym(name, rb.UnmanagedObject);
} [System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("accore.dll", EntryPoint = "acedGetSym",
CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
extern static private int acedGetSym(string args, out IntPtr result); /// <summary>
/// Get a LISP variable value.
/// </summary>
/// <param name="name">The variable name.</param>
/// <returns>The variable value or null if failed.</returns>
public static ResultBuffer GetLispSym(string name)
{
IntPtr ip = IntPtr.Zero;
int status = acedGetSym(name, out ip);
if (status == (int)PromptStatus.OK && ip != IntPtr.Zero)
{
return ResultBuffer.Create(ip, true);
}
return null;
}
//当然,要读取这个变量,首先要设置或者加载这个变量
ResultBuffer rb1114c = GetLispSym("dydj");
float intRetio=;
foreach (TypedValue val in (System.Collections.IEnumerable)rb1114c)
{
intRetio = (float)Convert.ToDouble((val.Value.ToString()));//根据你设置的类型进行转换
}
最新文章
- console 输出信息美化
- sessionStorage/localStorage 本地存储
- FZU xxx游戏(拓扑排序+暴力)
- NSArray block用法
- hdu 3790 (最短路径问题dijkstra)
- Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: ";((()))";, ";(()())";, ";(())()";, ";()(())";, ";()()()";
- C#线程安全使用(五)
- __name__的意义与作用
- Python技术之书籍汇总
- 【SRM-06 D】五色战队&;&;【codeforces 788E】 New task
- tensorflow/core/kernels/conv_ops.cc:659] check failed: stream->;parent()->;getc
- Java:多个文档合并输出到一个文档
- leetcode1004
- CUDA C Programming Guide 在线教程学习笔记 Part 3
- Android开发学习之3大类菜单
- 爬虫6:pyquery库
- 【Network Architecture】Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning(转)
- 【转】 Pro Android学习笔记(九十):了解Handler(4):Worker线程
- [POJ1637]混合图的欧拉回路判定|网络流
- ios调用Html内JS alert 不能点击关闭为甚?
热门文章
- Spark 中的机器学习库及示例
- android_sdcard读写(二)
- JAVA面试题 手写ArrayList的实现,在笔试中过关斩将?
- RDIFramework.NET框架基于Quartz.Net实现任务调度详解及效果展示
- ASP.NET Core系列(二):创建第一个.Net Core 项目
- Java调用方法参数究竟是传值还是传址?
- RabbitMQ从入门到精通(三)
- 跟着大彬读源码 - Redis 6 - 对象和数据类型(下)
- iOS 图解弹幕功能的实现
- 《VR入门系列教程》之2---VR头显