-
|
Dear all, I have a sample of c++ in BRX which reads as below. I would like to convert that to PyRx. AcDbFullSubentPathArray fsp;
Adesk::Int32 ssLength = 0;
acedSSLength(selectionSet, &ssLength);
acutPrintf(_T("\nNumber of selected entities: %ld"), ssLength);
for (Adesk::Int32 entityIndex = 0; entityIndex < ssLength; entityIndex++)
{
Adesk::Int32 ssSubentLength = 0;
acedSSSubentLength(selectionSet, entityIndex, &ssSubentLength);
acutPrintf(_T("\nNumber of faces: %d"), ssSubentLength);
for (Adesk::Int32 subentityIndex = 0; subentityIndex < ssSubentLength; subentityIndex++)
{
AcDbFullSubentPath subentityPath;
acedSSSubentName(selectionSet, entityIndex, subentityIndex, subentityPath);
if (fsp.length() >= 2)
{
acutPrintf(_T("\nInvalid input, more than two faces were selected"));
return;
}
if (subentityPath.subentId().type() != AcDb::kFaceSubentType)
{
acutPrintf(_T("\nInvalid input, faces should be selected"));
return;
}
fsp.append(subentityPath);
}
} In my understanding a subentity is a purely geometric object either vertex, edge or face. I found this AssocPersSubentIdPE .py sample to derive the information from entities. Trying fsp = Db.FullSubentPath()
fsp.setObjectIds(ents)throws Seb |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I uploaded a new build that has acedSSSubentLength and acedSSSubentName @Ap.Command()
def doit1():
try:
ps, ss = Ed.Editor.ssget("_:V", None, None)
for idx in range(ss.size()):
for sidx in range(ss.subentLength(idx)):
print(ss.subentName(idx, sidx))
except Exception as err:
traceback.print_exception(err)
other useful functions for nested Ap.Command()
def doit2():
try:
ps, id, pnt, mat, ownerids = Ed.Editor.nEntSelP("\nselect: ")
_path = Db.FullSubentPath(id, Db.SubentId())
print("You selected a {}: ".format(Db.Entity(id).isA().name()))
for _id in ownerids:
print("owner {}: ".format(Db.Entity(_id).isA().name()))
except Exception as err:
traceback.print_exception(err)
@Ap.Command()
def doit3():
try:
ssResult = Ed.Editor.ssget("_:n", None, None)
if ssResult[0] != Ed.PromptStatus.eNormal:
return
ss = ssResult[1]
nestedInfo = ss.ssNameX()
print(nestedInfo)
except Exception as err:
traceback.print_exception(err) |
Beta Was this translation helpful? Give feedback.
I uploaded a new build that has acedSSSubentLength and acedSSSubentName
sample:
throws Exception, Not implemented in BRX! under BCAD.You can use the constructor
Db.FullSubentPath(ids, Db.SubentId())other useful functions for nested