FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CadPythonShell/CADPythonShell/App/IronPythonConsoleApp.cs at dev · chuongmep/CadPythonShell · GitHub
chuongmep
/
CadPythonShell
Public
Notifications
You must be signed in to change notification settings
Fork
23
Star
119
Code
Issues
3
Pull requests
0
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
CadPythonShell
/
CADPythonShell
/
App
/
IronPythonConsoleApp.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
250 lines (243 loc) · 11.5 KB
Breadcrumbs
CadPythonShell
/
CADPythonShell
/
App
/
IronPythonConsoleApp.cs
Copy path
File metadata and controls
250 lines (243 loc) · 11.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
using
Autodesk
.
AutoCAD
.
Runtime
;
using
Autodesk
.
Windows
;
using
CADPythonShell
.
Command
;
using
Orientation
=
System
.
Windows
.
Controls
.
Orientation
;
namespace
CADPythonShell
.
App
{
public
class
IronPythonConsoleApp
:
ICadCommand
{
public
const
string
RibbonTitle
=
"Python Shell"
;
public
const
string
RibbonId
=
"PythonShell"
;
[
CommandMethod
(
"InitPythonConsole"
)
]
public
override
void
Execute
(
)
{
CreateRibbon
(
)
;
}
private
void
CreateRibbon
(
)
{
RibbonControl
ribbon
=
ComponentManager
.
Ribbon
;
if
(
ribbon
!=
null
)
{
RibbonTab
rtab
=
ribbon
.
FindTab
(
RibbonId
)
;
if
(
rtab
!=
null
)
{
ribbon
.
Tabs
.
Remove
(
rtab
)
;
}
rtab
=
new
RibbonTab
(
)
;
rtab
.
Title
=
RibbonTitle
;
rtab
.
Id
=
RibbonId
;
ribbon
.
Tabs
.
Add
(
rtab
)
;
AddContentToTab
(
rtab
)
;
}
}
private
void
AddContentToTab
(
RibbonTab
rtab
)
{
rtab
.
Panels
.
Add
(
AddPanelOne
(
)
)
;
rtab
.
Panels
.
Add
(
AddPanelTwo
(
)
)
;
}
private
static
RibbonPanel
AddPanelOne
(
)
{
RibbonPanelSource
rps
=
new
RibbonPanelSource
(
)
;
rps
.
Title
=
"Cad Python Shell"
;
RibbonPanel
rp
=
new
RibbonPanel
(
)
;
rp
.
Source
=
rps
;
RibbonButton
rci
=
new
RibbonButton
(
)
;
rci
.
Name
=
"Python Shell Console"
;
rps
.
DialogLauncher
=
rci
;
//create button1
var
addinAssembly
=
typeof
(
IronPythonConsoleApp
)
.
Assembly
;
RibbonButton
btnPythonShell
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
"Run CPS"
,
ShowText
=
true
,
Text
=
"Run CPS"
,
Description
=
"Start Write Python Console
\n
Command: PythonShellConsole"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.Python-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.Python-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
IronPythonConsoleCommand
(
)
.
Execute
)
}
;
rps
.
Items
.
Add
(
btnPythonShell
)
;
//create button2
RibbonButton
btnConfig
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
"Configure CPS"
,
ShowText
=
true
,
Text
=
"Configure CPS"
,
Description
=
"Configure Cad Python Shell
\n
Command: PythonShellSetting"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.Settings-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.Settings-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
ConfigureCommand
(
)
.
Execute
)
}
;
//Add the Button to the Tab
rps
.
Items
.
Add
(
btnConfig
)
;
return
rp
;
}
private
static
RibbonPanel
AddPanelTwo
(
)
{
RibbonPanelSource
rps
=
new
RibbonPanelSource
(
)
;
rps
.
Title
=
"Lookup"
;
RibbonPanel
rp
=
new
RibbonPanel
(
)
;
rp
.
Source
=
rps
;
RibbonButton
rci
=
new
RibbonButton
(
)
;
rci
.
Name
=
"Lookup"
;
rps
.
DialogLauncher
=
rci
;
//create button1
var
addinAssembly
=
typeof
(
IronPythonConsoleApp
)
.
Assembly
;
RibbonButton
btnSnoop
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
Snoop
)
,
ShowText
=
true
,
Text
=
"Snoop"
,
Description
=
"Start snoop object inside Autocad
\n
Command: Snoop"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.Find-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.Find-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
SnoopCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Quick Snoop An objects Sample"
,
}
;
RibbonButton
btnSnoopDB
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
SnoopDB
)
,
ShowText
=
true
,
Text
=
"Snoop
\n
Database"
,
Description
=
$
"Start snoop Database inside Autocad
\n
Command:
{
nameof
(
MgdDbgAction
.
SnoopDB
)
}
"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.database-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.database-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
SnoopDBCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Snoop Database"
,
}
;
RibbonButton
btnSnoopEd
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
SnoopEd
)
,
ShowText
=
true
,
Text
=
"Snoop
\n
Editor"
,
Description
=
$
"Start snoop Snoop Editor inside Autocad
\n
Command:
{
nameof
(
MgdDbgAction
.
SnoopEd
)
}
"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.editor-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.editor-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
SnoopEditorCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Snoop Editor"
,
}
;
RibbonButton
btnSnooByHandle
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
SnoopByHandle
)
,
ShowText
=
true
,
Text
=
"Snoop
\n
By Handle"
,
Description
=
$
"Start snoop Snoop Editor inside Autocad
\n
Command:
{
nameof
(
MgdDbgAction
.
SnoopByHandle
)
}
"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.handle-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.handle-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
SnoopByHandleCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Snoop By Handle"
,
}
;
RibbonButton
btnSnoopEntities
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
SnoopEnts
)
,
ShowText
=
true
,
Text
=
"Snoop
\n
Entities"
,
Description
=
$
"Start snoop Snoop Entities inside Autocad
\n
Command:
{
nameof
(
MgdDbgAction
.
SnoopEnts
)
}
"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.snoopentities-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.snoopentities-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
SnoopEntitiesCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Snoop By Entities"
,
}
;
RibbonButton
btnSnoopEntitiesNested
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
SnoopNEnts
)
,
ShowText
=
true
,
Text
=
"Snoop
\n
Nested Entities"
,
Description
=
$
"Start snoop Snoop Entities inside Autocad
\n
Command:
{
nameof
(
MgdDbgAction
.
SnoopNEnts
)
}
"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.snoopentitiesnes-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.snoopentitiesnes-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
SnoopEntitiesNestedCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Snoop By Nested Entities"
,
}
;
RibbonButton
btnSnoopEvents
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
SnoopEvents
)
,
ShowText
=
true
,
Text
=
"Snoop
\n
Events"
,
Description
=
$
"Start snoop Snoop Events inside Autocad
\n
Command:
{
nameof
(
MgdDbgAction
.
SnoopEvents
)
}
"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.events-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.events-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
SnoopEventsCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Snoop Events"
,
}
;
RibbonButton
btnSnoopTestFramework
=
new
RibbonButton
{
Orientation
=
Orientation
.
Vertical
,
AllowInStatusBar
=
true
,
Size
=
RibbonItemSize
.
Large
,
Name
=
nameof
(
MgdDbgAction
.
SnoopTests
)
,
ShowText
=
true
,
Text
=
"Snoop
\n
Test Framework"
,
Description
=
$
"Start snoop Snoop Test Framework inside Autocad
\n
Command:
{
nameof
(
MgdDbgAction
.
SnoopTests
)
}
"
,
Image
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.test-16.png"
)
,
LargeImage
=
CADPythonShellApplication
.
GetEmbeddedPng
(
addinAssembly
,
"CADPythonShell.Resources.test-32.png"
)
,
CommandHandler
=
new
RelayCommand
(
new
TestFrameworkCommand
(
)
.
Execute
)
,
AllowInToolBar
=
true
,
KeyTip
=
"Snoop Test Framework"
,
}
;
rps
.
Items
.
Add
(
btnSnoop
)
;
rps
.
Items
.
Add
(
btnSnoopDB
)
;
rps
.
Items
.
Add
(
btnSnoopEd
)
;
rps
.
Items
.
Add
(
btnSnooByHandle
)
;
rps
.
Items
.
Add
(
btnSnoopEntities
)
;
rps
.
Items
.
Add
(
btnSnoopEntitiesNested
)
;
rps
.
Items
.
Add
(
btnSnoopEvents
)
;
rps
.
Items
.
Add
(
btnSnoopTestFramework
)
;
return
rp
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL