-
|
Dear all, I am trying to pass a selection set as follows to @Ap.Command()
def doit2():
try:
db = Db.curDb()
model_space = db.modelSpace()
objs = []
name = 'test1'
for solid_id in model_space.objectIds(Db.Solid3d.desc()):
objs.append(Db.Solid3d(solid_id))
ss = Ed.SelectionSet()
for obj in objs:
ss.add(obj.id())
resbuf = [
(Rx.LispType.kText, "_SUPPRESS"),
(Rx.LispType.kText, "N"),
(Rx.LispType.kText, name),
(Rx.LispType.kSelectionSet, ss),
(Rx.LispType.kNone, 0),
]
result = Ed.Core.cmdS(resbuf)
except Exception as err:
traceback.print_exception(err) I return the command line halts for input at
Hints on how to improve to avoid command line interactions are welcome. Best Seb |
Beta Was this translation helpful? Give feedback.
Answered by
CEXT-Dan
Nov 27, 2025
Replies: 2 comments 5 replies
-
|
try @Ap.Command()
def doit2():
try:
db = Db.curDb()
model_space = db.modelSpace()
objs = []
name = 'test1'
for solid_id in model_space.objectIds(Db.Solid3d.desc()):
objs.append(Db.Solid3d(solid_id))
ss = Ed.SelectionSet()
for obj in objs:
ss.add(obj.id())
ss.ssSetFirst()
resbuf = [
(Rx.LispType.kText, "_SUPPRESS"),
(Rx.LispType.kText, "N"),
(Rx.LispType.kText, name),
(Rx.LispType.kSelectionSet, ss),
(Rx.LispType.kNone, 0),
]
result = Ed.Core.cmdS(resbuf)
except Exception as err:
traceback.print_exception(err) |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
this seems to work @Ap.Command()
def doit2():
try:
db = Db.curDb()
model_space = db.modelSpace()
objs = []
name = 'test1'
for solid_id in model_space.objectIds(Db.Solid3d.desc()):
objs.append(Db.Solid3d(solid_id))
ss = Ed.SelectionSet()
for obj in objs:
ss.add(obj.id())
resbuf = [
(Rx.LispType.kText, "_SUPPRESS"),
(Rx.LispType.kText, "_N"),
(Rx.LispType.kText, name),
(Rx.LispType.kSelectionSet, ss),
(Rx.LispType.kText, ""), # extra string to simulate enter
(Rx.LispType.kVoid, 0)
]
result = Ed.Core.cmdS(resbuf)
except Exception as err:
traceback.print_exception(err) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
schoeller
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this seems to work