Selection Set Entity Help #333
-
Hi, I am wondering how I can interact with the entities in the selection set. Also SelectByPolygon seems to be removed or renamed, I am assuming I use selectFence..?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Right As you have noticed points and vectors are now typed as AcGePoint3d and AcVector3d, as well as AcGeMatrix3d. I would cringe every time I saw VBA code doing manual transformations. Here’s a sample selecting a table by point import traceback
from pyrx import Ap, Ax, Ge
def selectTableByPoint(hitPnt: Ge.Point3d, axDoc: Ax.AcadDocument):
try:
# compute max using a vector
max = hitPnt + (axDoc.getVariable("VSMAX") - hitPnt)
axSets = axDoc.selectionSets()
axSs = axSets.add("AXTBLSS")
# filters like [0], ["ACAD_TABLE"] are combined, use a list of tuples
# list like in Lisp or in ARX,
axSs.selectFence([hitPnt, max], [(0, "ACAD_TABLE")])
for axEnt in axSs:
# use the new cast function
axTable = Ax.AcadTable.cast(axEnt)
# functions like hitTest expect Ge types,
# assumes kZAxis is the view direction
print(axTable.hitTest(hitPnt, Ge.Vector3d.kZAxis))
for row in range(axTable.rows()):
for col in range(axTable.columns()):
print(axTable.text(row, col))
break
finally:
axSs.delete()
@Ap.Command()
def xdoit() -> None:
try:
axApp = Ap.Application.acadApplication()
axDoc = axApp.activeDocument()
axUtils = axDoc.utility()
pnt = axUtils.getPoint("\nPick point")
selectTableByPoint(pnt, axDoc)
except Exception as err:
traceback.print_exception(err) |
Beta Was this translation helpful? Give feedback.
Right
selectByPolygon acSelectionSetFence
is nowselectFence
As you have noticed points and vectors are now typed as AcGePoint3d and AcVector3d, as well as AcGeMatrix3d. I would cringe every time I saw VBA code doing manual transformations.
Here’s a sample selecting a table by point