PickFirst Selection Set #83
-
I am trying to adjust a command to accept a selection prior to execution of the command. I see there is something called PickFirstSelectionSet in the docs but I've been unable to access it. Can you share an example if you don't mind? I scoured the examples for this but couldn't find one and wasn't able to piece it together from the docs. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
If I am understanding correctly, one of these samples may help You may register a command with USEPICKSET or’d with REDRAW You can get the previous selection set. Additionally, there’s a handy function is a wrapper around acedGetCurrentSelectionSet from pyrx_impx import Rx, Ge, Gi, Db, Ap, Ed, Ax
import traceback
def PyRxCmd_DOITPKF(CmDFlags = Ap.CmdFlags.USEPICKSET|Ap.CmdFlags.REDRAW):
try:
ss = Ed.Editor.ssget("I", None, None)
print("Woohoo ", ss)
print("Length = ", len(ss[1].objectIds()))
except Exception:
traceback.print_exc()
def PyRxCmd_DOITSP():
try:
ss = Ed.Editor.selectPrevious()
print("Woohoo ", ss)
print("Length = ", len(ss[1].objectIds()))
except Exception:
traceback.print_exc()
def PyRxCmd_DOITCSS():
try:
ids = Ed.Editor.getCurrentSelectionSet()
print("Woohoo ", len(ids))
except Exception:
traceback.print_exc() |
Beta Was this translation helpful? Give feedback.
-
Worth to mention that just setting def PyRxCmd_DOIT(CmDFlags=Ap.CmdFlags.USEPICKSET | Ap.CmdFlags.REDRAW):
try:
sfilter = [(Db.DxfCode.kDxfStart, "LWPOLYLINE")]
ss = Ed.Editor.selectPrompt("\nAdd polyline: ", "\nRemove polyline: ", sfilter)
print(ss)
print(len(ss[1].objectIds())
except Exception:
traceback.print_exc() |
Beta Was this translation helpful? Give feedback.
.NET has a wrapper for acedssgetfirst, I have added this as
Ed.Editor.selectImplied()
It will be available next release (v1.3.026)