Skip to content

Commit a6741e2

Browse files
committed
add support ironpython3.4
1 parent 28375e8 commit a6741e2

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

CADPythonShell/CADPythonShell.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<DebugType>none</DebugType>
2727
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
2828
</PropertyGroup>
29-
<PropertyGroup Condition="$(Configuration.Contains('A22'))">
29+
<PropertyGroup Condition="$(Configuration.Contains('A23'))">
3030
<DefineConstants>$(DefineConstants);A23</DefineConstants>
3131
</PropertyGroup>
3232
<PropertyGroup>
@@ -228,6 +228,7 @@
228228
<ProjectReference Include="..\PythonConsoleControl\PythonConsoleControl.csproj" />
229229
</ItemGroup>
230230
<ItemGroup>
231+
<PackageReference Include="IronPython" Version="3.4.0" />
231232
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
232233
</ItemGroup>
233234
<PropertyGroup />

CADPythonShell/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"profiles": {
3-
"CADPythonShell": {
3+
"CAD23": {
44
"commandName": "Executable",
55
"executablePath": "C:\\Program Files\\Autodesk\\AutoCAD 2023\\acad.exe"
66
}

CADRuntime/CADRuntime.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
</ItemGroup>
5555
<ItemGroup>
5656
<EmbeddedResource Include="Resources\PythonScript16x16.png" />
57+
<None Remove="Resources\IronPython.3.4.0.zip" />
58+
<EmbeddedResource Include="Resources\IronPython.3.4.0.zip" />
5759
</ItemGroup>
5860
<ItemGroup>
5961
<EmbeddedResource Include="Resources\PythonScript32x32.png" />
4.52 MB
Binary file not shown.

CADRuntime/ScriptExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private void AddEmbeddedLib(ScriptEngine engine)
104104
// use embedded python lib
105105
var asm = this.GetType().Assembly;
106106
var resQuery = from name in asm.GetManifestResourceNames()
107-
where name.ToLowerInvariant().EndsWith("python_27_lib.zip")
107+
where name.ToLowerInvariant().EndsWith("ironpython.3.4.0.zip")
108108
select name;
109109
var resName = resQuery.Single();
110110
var importer = new IronPython.Modules.ResourceMetaPathImporter(asm, resName);

Script Examples/getobject.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
ed = adoc.Editor
1717
output =[]
1818
with adoc.LockDocument():
19-
with adoc.Database as db:
20-
with db.TransactionManager.StartTransaction() as t:
21-
bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
22-
btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
23-
for objectid in btr:
24-
obj1 = t.GetObject(objectid, OpenMode.ForRead)
25-
output.append(obj1)
26-
print(obj1)
19+
with adoc.Database as db:
20+
with db.TransactionManager.StartTransaction() as t:
21+
bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
22+
btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
23+
for objectid in btr:
24+
obj1 = t.GetObject(objectid, OpenMode.ForRead)
25+
output.append(obj1)
26+
print(obj1)
2727
ed.WriteMessage("Done")

0 commit comments

Comments
 (0)