- 积分
- 24557
- 明经币
- 个
- 注册时间
- 2004-3-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 雪山飞狐_lzh 于 2017-11-9 23:33 编辑
先把工程直接贴上了
使用方法:将IronPython.zip解压至任意目录,加载NFox.Python.dll
在IronPython/Pycad中修改acad.py的相应内容
mycmds2.py文件中有代码示例
下面的三个例子分别示例实体操作、WinApi调用和WinForm
- import Autodesk.AutoCAD.ApplicationServices as aas
- import Autodesk.AutoCAD.DatabaseServices as ads
- import Autodesk.AutoCAD.EditorInput as aei
- import Autodesk.AutoCAD.Geometry as ag
- import Autodesk.AutoCAD.Runtime as ar
- import Autodesk.AutoCAD.Internal as ai
- from Autodesk.AutoCAD.Internal import Utils
- from NFox.Cad import *
- @acadcmd()
- def mycir():
- with DBTrans(commit = True) as tr:
- btr = tr.OpenCurrSpace()
- cir = ads.Circle(ag.Point3d(10,10,0), ag.Vector3d.ZAxis, 2)
- tr.AddEntity(btr, cir)
- tr.SetXRecord([[1000, 'abc']], cir, 'NFox.Cad')
- tr.Document.Editor.WriteMessage(tr.GetXRecord(cir, 'NFox.Cad').__str__())
- @acadcmd()
- def mymsg():
- from ctypes import windll
- windll.user32.MessageBoxW(0,"Great","Hello World",0)
- @acadcmd()
- def showfrm():
- import Forms
- winform = Forms.TForm()
- aas.Application.ShowModalDialog(winform)
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|