File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -43,14 +43,45 @@ The biggest limitation is that you can't deploy DLLs with custom scripts at this
4343
4444![ ] ( Images/pythoncmd.png )
4545
46- - Write Console
46+ - Write Console Sample
4747
4848``` py
4949ed = doc.Editor
5050ed.WriteMessage(" Hello" )
5151```
5252![ ] ( Images/console.gif )
5353
54+ - Try create script get Object
55+
56+ ``` py
57+ import clr
58+ import sys
59+ sys.path.append(' C:\Program Files (x86)\IronPython 2.7\Lib' )
60+ import os
61+ import math
62+ clr.AddReference(' acmgd' )
63+ clr.AddReference(' acdbmgd' )
64+ clr.AddReference(' accoremgd' )
65+ # Import references from AutoCAD
66+ from Autodesk.AutoCAD.Runtime import *
67+ from Autodesk.AutoCAD.ApplicationServices import *
68+ from Autodesk.AutoCAD.EditorInput import *
69+ from Autodesk.AutoCAD.DatabaseServices import *
70+ from Autodesk.AutoCAD.Geometry import *
71+ adoc = Application.DocumentManager.MdiActiveDocument
72+ ed = adoc.Editor
73+ with adoc.LockDocument():
74+ with adoc.Database as db:
75+ with db.TransactionManager.StartTransaction() as t:
76+ bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
77+ btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
78+ for objectid in btr:
79+ obj1 = t.GetObject(objectid, OpenMode.ForRead)
80+ print (obj1)
81+ ed.WriteMessage(" Done" )
82+ ```
83+ ![ ] ( Images/getobject.png )
84+
5485Note : you can see more example in folder [ Script Examples] ( https://github.com/chuongmep/CadPythonShell/tree/dev/Script%20Examples )
5586
5687## Contribute
You can’t perform that action at this time.
0 commit comments