Replies: 11 comments 54 replies
-
I don’t know, that would be cool though Debugpy, is all Python, or at least I don’t do anything in C++ to enable this except redirect stdout Lines 36 to 89 in d7a9404 Communication with Debugpy is not without its side effects. I’m pretty sure that Debugpy hijacks stdin to push data to python. But if you notice when debugging, interaction with AutoCAD’s command line gets wonky Ideally, I would like to see something that can be more interactive with the CAD side like autolisp A short-term solution would be to create a modeless dialog, or even better a palette (Like the PyChat sample, maybe with the send button removed and have an ‘enter event’) |
Beta Was this translation helpful? Give feedback.
-
So, let's do it!
Additionally, I don't know how to add something to the model space of the current document, I get a message that the database is locked. |
Beta Was this translation helpful? Give feedback.
-
This works very well: import traceback
import wx
import wx.py.shell
from pyrx_imp import Ap, Db, Ed, Ge, Gi, Gs, Rx # will be added to PyShell
def PyRxCmd_pyshell():
try:
dlg = wx.py.shell.ShellFrame(None, locals=globals())
dlg.Show()
except Exception:
traceback.print_exc() I still don't know how to add something to the database: >>> p1 = Ge.Point3d(0,0,0)
>>> p2 = Ge.Point3d(100,100,0)
>>> line = Db.Line(p1,p2)
>>> Db.curDb().addToCurrentspace(line)
Traceback (most recent call last):
File "<input>", line 1, in <module>
RuntimeError:
Exception!(eLockViolation), function addToBlock1, Line 560, File PyDbDatabase.cpp: |
Beta Was this translation helpful? Give feedback.
-
PyShell, calling help(), copyright(), credits(), license(), nukes AutoCAD |
Beta Was this translation helpful? Give feedback.
-
I tried to improve PyEdUserInteraction::userInteraction,for function like entSel(“\nSelect: “) ShellFrame inherits from a custom frame, that may be the place to start customizing |
Beta Was this translation helpful? Give feedback.
-
PyShell on the palette: import traceback
import wx
from pyrx_imp import *
from wx.py.shell import Shell
palette = Ap.PaletteSet("PyShell")
class MyPanel(wx.Panel):
def __init__(self):
super().__init__()
self.Bind(wx.EVT_SHOW, self.OnShow)
def OnShow(self, event):
sizer = wx.BoxSizer()
sizer.Add(Shell(self, locals=globals()), 1, wx.EXPAND, 0)
self.SetSizerAndFit(sizer)
self.Layout()
def createPalette():
try:
panel = MyPanel()
palette.add("PyShell", panel)
palette.setVisible(True)
palette.setName("PyShell")
except Exception:
traceback.print_exc()
def PyRxCmd_pyshellpalette():
try:
createPalette()
except Exception:
traceback.print_exc() |
Beta Was this translation helpful? Give feedback.
-
Autocomplete doesn't use the stubs. I asked about it here |
Beta Was this translation helpful? Give feedback.
-
The pyshell palette loses focus when the tooltip is displayed and the cursor is on the tooltip. When the cursor is out, it's ok, but you can't see what you're writing. |
Beta Was this translation helpful? Give feedback.
-
I installed python 3.13 @CEXT-Dan, how do you feel about using the python interpreter in the console instead of the palette? |
Beta Was this translation helpful? Give feedback.
-
I am uploading a module to test the REPL. The original file is here, but in the attached file I have added all the functions from other
|
Beta Was this translation helpful? Give feedback.
-
Looks pretty cool! Though, for me I don’t see that ptpython is any better than the wxPython shell, in that it does not see the .PYI stubs |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to run something similar to
PYCMDPROMPT
(REPL) in an external console, preferably in the vscode console (integratedConsole
). It's a bit like runningdebugpy
, but without locking the AutoCAD interface.Beta Was this translation helpful? Give feedback.
All reactions