Re: Удаление на слое
> Евгений А.
Для целых - запятая не годится.
Информационный портал для профессионалов в области САПР
Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.
Форумы CADUser → Программирование → LISP → Удаление на слое
Чтобы отправить ответ, вы должны войти или зарегистрироваться
-> (Для тех кто не знает, а то я сам в справке не всречал)
Вот так - пожалуйста:
(ssget "_X" '((-4 . "<OR") (62 . 2) (62 . 3) (-4 . "OR>")))
Можно сложные фильтры делать с AND, NOT, OR (больше не знаю).
А со строчными вообще можно работать как с WCMATCH, даже так
(ssget "_X" '((0 . "L*,C*")))
> Евгений А.
Есть еще операторы сравнения. В том числе и по маске (для целых): (-4 . "&="). Так что можно еще сократитить фильтр для группы 62.
> Александр Ривилис
А можно поподробнее? Я в справке что-то такое не встречал :(
> Кулик Алексей aka kpblc
Плохо искал! :)
Relational Tests By default, acedSSGet() selects entities that match all the criteria in the filter list. The implied relation between each item in filter is "equals." For numeric groups (integers, reals, points, and vectors) you can specify other relationships by including a special -4 result buffer that specifies a relational operator. The operator applies to the result buffer that immediately follows it. Relational operators are specified by strings. The following table shows the possible operators. Relational operators for selection set filter lists: Operator Description "*" Anything goes (always true) "=" Equals "!=" Not equal to "/=" Not equal to "<>" Not equal to "<" Less than "<=" Less than or equal to ">" Greater than ">=" Greater than or equal to "&" Bitwise AND (integer groups only) "&=" Bitwise masked equals (integer groups only) The relational operators can be used in any of the following ways, depending on the group you are testing. All relational operators except for the bitwise operators "&" and "&=" are valid for both real- and integer-valued groups. The bitwise operators "&" and "&=" are valid only for integer-valued groups. The result buffer that follows the bitwise operator must be of type RTSHORT, which is used as a mask for the integer group. The bitwise AND "&" is true if the bits set in the mask are set also in the integer group ((integer_group & mask) != 0). The bitwise masked equals "&=" is true if the mask is identical to the integer group ((integer-group ^ mask) == 0). For point groups, the X, Y, and Z tests can be combined into a single string, with each operator separated by commas--for example, ">,>,*". If you omit an operator from the string (for example, "=,<>" leaves out the Z test), the "anything goes" operator "*" is assumed. Direction vectors (group type 210) can be compared only with the operators "*", "=", and "!=" (or one of the equivalent "not equals" strings). You cannot use the relational operators with string groups. Use wild-card tests instead
> Александр Ривилис
Каюсь. Виновен. Посыпаю голову пеплом.
> Александр Ривилис
Копнул массу полезной информации!!!
Вот только
Есть еще операторы сравнения. В том числе и по маске (для целых): (-4 . "&="). Так что можно еще сократитить фильтр для группы 62.
по поводу сократить, наверно, вы погорячились :)
> Евгений А.
В данном случае возможно и погорячился (цифры 2 и 3 не очень удачные для маскирования).
Другие сложные фильтры идут!Этот нет.:( Пишет, что неверная точечная пара. я так понял,что фильтр по цвету, а как он работает не очень ясно? И что формируется в наборе?
(defun c:udal4 (/)
(and (setq msg (entsel "\укажите :"))
(setq msg (assoc 8 (entget (car msg))))
( setq msg (ssget "_X" '( (-4 . "<OR") (62 . 2) (62 . 3) (-4 . "OR>") msg))) ;_ end setq
(foreach str (ssnamex msg) (entdel (cadr str)))
) ;_ end and
) ;_ end defun
А так:
(defun c:udal4 (/) (and (setq msg (entsel "\nВыберите примитив :")) (setq msg (assoc 8 (entget (car msg)))) (setq msg (ssget "_X" (list '(-4 . "<OR") '(62 . 2) '(62 . 3) '(-4 . "OR>") msg))) (foreach str (ssnamex msg) (entdel (cadr str))) ) ;_ end and (princ) ) ;_ end defun
P.S.: Эта функция удаляет все примитивы со слоя выбранного примитива имеющие цвет 2 или 3.
> Виктор Бабченко
Надо было внимательней переписывать... :)
> Александр Ривилис
Попробовал второй раз :) ну ничего не удаляет с цветом 2 или 3. при выборе слоя. У вас прога идет???
> Виктор Бабченко
Конечно. Чего бы я выкладывал ее код?
P.S.: Может у твоих примитивов цвет "по слою", а не явно заданный? Тогда конечно она ничего удалять не будет.
Чтобы отправить ответ, вы должны войти или зарегистрироваться
Форумы CADUser → Программирование → LISP → Удаление на слое
Форум работает на PunBB, при поддержке Informer Technologies, Inc