CadSelectionFilter
from OpenCAD2D import CadSelectionFilter
class CadSelectionFilter(System.Object) ยท CadSelectionFilter in the .NET reference
An object selection filter, as AutoCAD's FILTER makes one: a list of lines, which an object has to pass all of, except where lines are grouped with AND, OR, XOR and NOT (a group may hold groups, ten deep at most); named lists kept for the session, the current one *unnamed, and written to and read from the file AutoCAD keeps them in, filter.nfl. Of a plan with 312 lines on WALLS and 40 circles there, Object = Line and Layer = WALLS pass the 312, and Object = Circle with a NOT group round Circle Radius >= 1 passes the circles under 1 in radius.
The named lists of a filter in the file AutoCAD keeps them in, filter.nfl.
Constructors
__init__
def __init__(self) -> None
Properties and fields
Unnamed
Unnamed: ClassVar[str]
The name of the list being edited where it has no name of its own, as AutoCAD's.
Choices
Choices: ClassVar[System.Collections.Generic.IReadOnlyList[CadFilterChoice]]
Gets the items of the Select Filter list of AutoCAD 2021's dialog, in its order: the properties to test, the kinds of object (Arc, Line, Block) that make an Object line, and the begin and end of each group.
CurrentName
@property
def CurrentName(self) -> str
@CurrentName.setter
def CurrentName(self, value: str | None) -> None
Gets or sets the name of the current list: CadSelectionFilter.Unnamed, or one saved.
FilePath
@property
def FilePath(self) -> str
@FilePath.setter
def FilePath(self, value: str | None) -> None
Gets or sets the file the named lists are kept in, AutoCAD's filter.nfl form: written whenever a list is saved or deleted, and read by CadSelectionFilter.Reload; null keeps them for the session only.
Lines
@property
def Lines(self) -> System.Collections.Generic.IList[CadFilterLine]
Gets the lines of the current list, in the order they were added.
Names
@property
def Names(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the names of the lists saved, CadSelectionFilter.Unnamed first, the others in alphabetical order, capitals and small letters alike ("alpha" before "Beta").
Methods
Apply
def Apply(
self,
document: CadDocument,
handles: System.Collections.Generic.IEnumerable[str],
) -> System.Collections.Generic.IReadOnlyList[str]
Gets the objects of a list that pass, in the order given; handles the document has no entity of are passed over.
DeleteCurrent
def DeleteCurrent(self) -> str
Deletes the current list where it has a name, as Delete Current Filter List; CadSelectionFilter.Unnamed is refused.
KindsIn
@staticmethod
def KindsIn(document: CadDocument) -> System.Collections.Generic.IReadOnlyList[str]
Gets the kinds of the objects of a drawing, as an Object line names them (Line, Circle, MText), in ordinal order.
LinesOf
@staticmethod
def LinesOf(entity: DxfEntity) -> System.Collections.Generic.IReadOnlyList[CadFilterLine]
Gets the lines Add Selected Object adds for an entity, as AutoCAD's: its kind, layer, colour and linetype, then what belongs to its kind, as an arc's centre and radius or a text's position, words, style, height and rotation.
LoadNfl
def LoadNfl(self, text: str) -> str
Reads named lists from the text of a filter.nfl file, in place of the named lists held; a list that does not read leaves them all as they were.
Passes
def Passes(self, entity: DxfEntity) -> bool
Gets whether an entity passes the lines of the list: every one outside a group, and each group as it says.
Reload
def Reload(self) -> str
Reads the named lists from CadSelectionFilter.FilePath, as AutoCAD's FILTER does each time it starts; nothing happens where no file is set or none is there.
Restore
def Restore(self, name: str) -> bool
Makes a list saved the current one, its lines copied into CadSelectionFilter.Lines; CadSelectionFilter.Unnamed keeps the lines there.
SaveAs
def SaveAs(self, name: str) -> str
Saves the current list under a name, replacing a list of that name, and makes the name current.
ToNfl
def ToNfl(self) -> str
Writes the named lists as AutoCAD's FILTER keeps them in filter.nfl: the line "Filter.nfl -- Do not edit this file.", then for each list :ai_lisp|NAME with its tests as the lists of an AutoLISP ssget filter ((8 . "WALLS"), (-4 . ">=") with (40 . 15.0), (-4 . "<NOT")) and :ai_str|NAME with the lines as the dialog lists them, tab between the columns. *unnamed is not kept.
TransparenciesIn
@staticmethod
def TransparenciesIn(document: CadDocument) -> System.Collections.Generic.IReadOnlyList[str]
Gets the transparencies Select... lists for a Transparency line: ByLayer, ByBlock, then the per cents the objects of the drawing have, least first.
Validate
def Validate(self) -> str
Checks the groups of the lines as AutoCAD checks them when the filter is applied: each Begin has its End, nothing is empty, XOR has two operands and NOT one.
@staticmethod
def Validate(lines: System.Collections.Generic.IReadOnlyList[CadFilterLine]) -> str
Checks the groups of lines as CadSelectionFilter.Validate does, for lines not yet given to the filter.