Replies: 4 comments 3 replies
- 10000
-
try with command flags |
Beta Was this translation helpful? Give feedback.
3 replies
-
Well, the good news is that it’s the same behavior as in ARX, so it does not appear to be a bug in the wrappers, the bad news is, it doesn’t work static void AcRxPyApp_idoit(void)
{
int nReturn;
ads_name name;
ads_point pt;
nReturn = acedEntSel(_T("Select entity\n"), name, pt);
if (nReturn != RTNORM)
return;
//get the object Id of the entity
AcDbObjectId Id;
if (acdbGetObjectId(Id, name) != Acad::eOk)
return;
//from object id to selection set
ads_name ss, ename;
//create a selection set
acedSSAdd(NULL, NULL, ss);
//get the ads name from objectID
acdbGetAdsName(ename, Id);
//add the selected entity ads name to selection set
acedSSAdd(ename, ss, ss);
//select with grip
acedSSSetFirst(ss, NULL);
AcDbObjectIdArray ids;
if (auto es = acedGetCurrentSelectionSet(ids); es != eOk)
{
acutPrintf(_T("\nError %ls"), acadErrorStatusText(es));
}
else
{
for (auto id : ids)
{
wchar_t buffer[AcDbHandle::kStrSiz];
id.handle().getIntoAsciiBuffer(buffer, AcDbHandle::kStrSiz);
acutPrintf(_T("%ls,"), buffer);
}
}
acedSSFree(ss);
} output: handle 261 is never added
|
Beta Was this translation helpful? Give feedback.
0 replies
-
this works def sset_handles(ss: Ed.SelectionSet):
for id in ss.objectIds():
yield id.handle().toString()
@Ap.Command("doit", Ap.CmdFlags.USEPICKSET | Ap.CmdFlags.REDRAW)
def woohoo():
try:
ps, sset = Ed.Editor.selectImplied()
print(*sset_handles(sset), sep=",")
sset.add(Db.curDb().getObjectId(False, Db.Handle("261")))
print(*sset_handles(sset), sep=",")
except Exception as err:
traceback.print_exception(err) output:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
It probably won't be solved |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Calling
ssSetFirst
changes the current SelectionSet, after the command is finished the selection on the screen is correct, butgetCurrentSelectionSet
still returns the previous selection (during this command, in the next one it is ok). Is it supposed to be like this?Beta Was this translation helpful? Give feedback.
All reactions