Skip to content

Commit d00c7c3

Browse files
committed
add sample, fix save extension .py
1 parent b13edd5 commit d00c7c3

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

CADPythonShell/IronPythonConsole.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ void saveFileClick(object sender, EventArgs e)
6666
if (currentFileName == null)
6767
{
6868
SaveFileDialog dlg = new SaveFileDialog();
69-
dlg.DefaultExt = ".txt";
69+
dlg.Filter = "Save Files (*.py)|*.py";
70+
dlg.DefaultExt = "py";
71+
dlg.AddExtension = true;
7072
if (dlg.ShowDialog() ?? false)
7173
{
7274
currentFileName = dlg.FileName;

Script Examples/libcivil3dyanmo.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import clr
2+
3+
# Add Assemblies for AutoCAD and Civil 3D APIs
4+
clr.AddReference('acmgd')
5+
clr.AddReference('acdbmgd')
6+
clr.AddReference('accoremgd')
7+
clr.AddReference('AecBaseMgd')
8+
clr.AddReference('AecPropDataMgd')
9+
clr.AddReference('AeccDbMgd')
10+
clr.AddReference('AeccPressurePipesMgd')
11+
clr.AddReference('acdbmgdbrep')
12+
clr.AddReference('System.Windows.Forms')
13+
clr.AddReference('Civil3DNodes')
14+
clr.AddReference('AutoCADNodes')
15+
16+
# Add standard Python references
17+
import sys
18+
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
19+
import os
20+
import math
21+
22+
# Add references to manage arrays, collections and interact with the user
23+
from System import *
24+
from System.IO import *
25+
from System.Collections.Specialized import *
26+
from System.Windows.Forms import MessageBox
27+
28+
# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
29+
import Autodesk.AutoCAD.ApplicationServices.Application as acapp
30+
31+
# Import references from AutoCAD
32+
from Autodesk.AutoCAD.Runtime import *
33+
from Autodesk.AutoCAD.ApplicationServices import *
34+
from Autodesk.AutoCAD.EditorInput import *
35+
from Autodesk.AutoCAD.DatabaseServices import *
36+
from Autodesk.AutoCAD.Geometry import *
37+
38+
# Import references for Civil 3D
39+
from Autodesk.Civil.ApplicationServices import *
40+
from Autodesk.Civil.DatabaseServices import *
41+
42+
# Import references for Dynamo for Civil 3D
43+
from Autodesk.Civil.DynamoNodes import Surface as DynSurface
44+
from Autodesk.Civil.DynamoNodes.Selection import SurfaceByName
45+
from Autodesk.AutoCAD.DynamoNodes import Document as DynDocument

0 commit comments

Comments
 (0)