博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AutoCAD中static 和 instance class的区别
阅读量:5238 次
发布时间:2019-06-14

本文共 1417 字,大约阅读时间需要 4 分钟。

using Autodesk.AutoCAD.ApplicationServices;using Autodesk.AutoCAD.Runtime;using Autodesk.AutoCAD.EditorInput;[assembly: CommandClass(typeof(CommandClasses.FirstClass))][assembly: CommandClass(typeof(CommandClasses.SecondClass))]namespace CommandClasses{  static public class FirstClass  {    private static int counter = 0;    [Autodesk.AutoCAD.Runtime.CommandMethod("glob")]    public static void global()    {      Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;      ed.WriteMessage("\nCounter value is: " + counter++);    }  }  public class SecondClass  {    private int counter = 0;    [Autodesk.AutoCAD.Runtime.CommandMethod("loc")]    public void local()    {      Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;      ed.WriteMessage("\nCounter value is: " + counter++);    }  }}

 

Here’s what happens when you execute the two commands in two separate documents:

[From first drawing...]

Command: glob

Counter value is: 0

Command: glob

Counter value is: 1

Command: glob

Counter value is: 2

Command: loc

Counter value is: 0

Command: loc

Counter value is: 1

Command: loc

Counter value is: 2

Command: new

[From second drawing...]

Command: glob

Counter value is: 3

Command: glob

Counter value is: 4

Command: glob

Counter value is: 5

Command: loc

Counter value is: 0

Command: loc

Counter value is: 1

Command: loc

Counter value is: 2

转载于:https://www.cnblogs.com/swtool/p/8283320.html

你可能感兴趣的文章
ios app 单元测试 自动化测试
查看>>
年薪二十万
查看>>
Reading Notes : 180211 概述计算机
查看>>
强连通tarjan模版
查看>>
javascript_09-数组
查看>>
多进程与多线程的区别
查看>>
Linux 系统下用源码包安装软件
查看>>
HDU3232 Crossing Rivers 数学期望问题
查看>>
PAT 1145 1078| hashing哈希表 平方探测法
查看>>
安装redis 后本地系统空间越来越小
查看>>
Ubuntu(虚拟机)下安装Qt5.5.1
查看>>
Linux第七周学习总结——可执行程序的装载
查看>>
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
查看>>
细说php(二) 变量和常量
查看>>
iOS开发网络篇之Web Service和XML数据解析
查看>>
个人寒假作业项目《印象笔记》第一天
查看>>
java 常用命令
查看>>
ZOJ 1666 G-Square Coins
查看>>
CodeForces Round #545 Div.2
查看>>
卷积中的参数
查看>>