Ошибка неверный тип аргумента lentityp nil

I have the same problem with my routine, it produces the same error message: ; error: bad argument type: lentityp nil. It skips the ENTSEL in each subroutine of the IF.

Help!!

(defun c:hln(/ LAS OS R1 R2 XNv XFv r2v Y1v X1v X2v P1v P2v xnh xfh r2h y1h x1h x2h p1h p2h)

(SETVAR «CMDECHO» 0)

(SETQ LAS(GETVAR «CLAYER»))

(SETQ OS (GETVAR «OSMODE»))

(initget «V H»)

(setq direc(getkword «Type: Vert/Horiz»))

;need to change from horizontal to vertical

;swap involves components of chosen line

;if statement should control use of those components

;simple way, if V then change components to XNV versus XNH, etc.

(command «layer» «s» «hid» «»)

(setvar «osmode» 512)

(if(= «V» direc)

(

(SETQ R1(ENTSEL «Pick line: «))

(SETQ XNv(GETPOINT «Pick BOTTOM side of plate: «))(terpri);point selected on top line

(SETQ XFv(GETPOINT «Pick TOP hside of plate: «))(terpri);point selected on bottom line

(setq R2v(entget(car R1)))

(setq Y1v(CADR(ASSOC 10 R2v))) ;X COORDINATE

(setq X1v(CADR XNv)) ;BOTTOM SIDE Y COORDINATE

(setq X2v(CADR XFv)) ;TOP SIDE Y COORDINATE

(SETQ P1v(LIST Y1v X1v))

(SETQ P2v(LIST Y1v X2v))

(command «line» p1v p2v /c/c)))

(if(= «H» direc)

(

(SETQ R2(ENTSEL «Pick line: «))

(SETQ XNh(GETPOINT «Pick RIGHT side of plate: «))(terpri)

(SETQ XFh(GETPOINT «Pick LEFT side of plate: «))(terpri)

(setq R2h(entget(car R2)))

(setq Y1h(CADDR(ASSOC 11 R2h))) ;Y COORDINATE

(setq X1h(CADR XNh)) ;NEAR SIDE X COORDINATE

(setq X2h(CAR XFh)) ;FAR SIDE X COORDINATE

(SETQ P1h(LIST X2H Y1h))

(SETQ P2h(LIST X1h Y1h))

(command «line» p1h p2h /c/c)))

(COMMAND «LAYER» «S» LAS «»)

(SETVAR «OSMODE» 183)

(PRINC)

)

What I’m trying to do is draw a hidden line in an adjacent view by just selecting the line in the other «visible» view of the line. I want to specify if it will be vertical or horizontal (I think, might not be necessary) to draw the line. But I can’t get it to select either line.

В этом уроке мы рассмотрим пример AutoLISP программы, которая будет считать сумму длин выбираемых отрезков.

Вначале нарисуем в AutoCAD два отрезка: один длиной 300, другой 200. Чтобы нам было, чего выбирать, и легче было тестировать программу.

Затем запустим Visual LISP, создадим новый файл и откроем консоль Visual LISP.

Для того, чтобы выбрать объект в AutoLISP используется функция entsel.

Функция entsel предлагает пользователю указать объект, выдавая запрос, текст которого задан в качестве аргумента.

( entsel [<запрос>])

Аргумент <запрос> — текст запроса.

Давайте наберем функцию.

(entsel «Выберите отрезок:»: «)

Дважды щелкнем после закрывающейся скобки (функция выделится) и нажмем кнопку «Загрузить выделенный фрагмент». См. Рис. 1.

Пример AutoLISP

Рис. 1.  Функция entsel

На запрос: «Выберите отрезок:» укажите один из ранее нарисованных отрезков. См. Рис. 2.

Пример AutoLISP

Рис. 2.    Выбор отрезка.

Функция entsel вернет нам имя объекта и координаты точки, которые мы указали, выбирая отрезок. См. Рис. 3.

Пример AutoLISP

Рис. 3. Функция entsel. Имя объекта и координаты точки.

Чтобы, оставить только имя объекта, используем функцию car, которая извлекает первый элемент из списка.

В начале запроса поставим n, чтобы он отображался в отдельной строке.

Выделяем всю строку и нажмем кнопку «Загрузить выделенный фрагмент».

На запрос, «Выберите отрезок:» укажите один из ранее нарисованных отрезков.

На консоли Visual LISP появится результат выполнения всей строки — это имя выбранного объекта.

См. Рис. 4.

Пример AutoLISP

Рис. 4.   Функция car. Имя выбранного объекта.

Давайте, при помощи функции присвоения setq, запомним это имя в переменной name_obj.

(setq name_obj (car (entsel «n Выберите отрезок: «)))

Для того, чтобы получить список с характеристиками примитива используем функцию entget. Аргументом этой функции является имя примитива, данные которого мы хотим получить. См. Рис. 5.

Пример AutoLISP

Рис. 5.   Функция entget. Список с характеристиками примитива.

Выделяем вторую строку и нажмем кнопку «Загрузить выделенный фрагмент».

На консоли Visual LISP появится результат выполнения : список с характеристиками примитива.

Весь список выглядит так:

 ((-1 . < Имя объекта: 7ee90e38>) (0 . «LINE») (330 . < Имя объекта: 7ee8ecf8>) (5 . «32F») (100 . «AcDbEntity») (67 . 0) (410 . «Model») (8 . «0») (100 . «AcDbLine») (10 4905.76 5404.8 0.0) (11 5125.47 5609.07 0.0) (210 0.0 0.0 1.0))

Давайте, при помощи функции присвоения setq, запомним этот список в переменной list_obj.

(setq list_obj (entget name_obj))

Из этого списка нам нужны координаты точек выбранного отрезка. Для того, чтобы их от туда извлечь, используем функцию assoc.

Функция assoc применяется к сложному списку, каждый элемент которого начинается с DXF-кода. Именно по этому коду функция assoc и извлекает элемент из списка.

(assoc <код> <список>)

<код>  — DXF-код.

<список> — список с данными примитива.

Для того чтобы получить элемент списка, который содержит координаты первой точки, добавим строку:

(assoc 10 list_obj)

10 – это  DXF-код координат первой точки.

Выделяем третью строку и нажмем кнопку «Загрузить выделенный фрагмент».

В консоли появится результат выполнения. См. Рис. 6.

Пример AutoLISP

Рис. 6.  Функция assoc.  Элемент списка с DXF-кодом 10.

Из списка будет извлечен элемент с DXF-кодом 10.

Для того, чтобы оставить только координаты точки, добавляем функцию cdr.

(cdr(assoc 10 list_obj))

возвращает список без первого элемента.

При помощи функции присвоения setq, запомним значения координат в переменной р1.

(setq p1 (cdr(assoc 10 list_obj)))

Выделяем третью строку и нажмем кнопку «Загрузить выделенный фрагмент».

В консоли появится результат выполнения. См. Рис. 7.

Пример AutoLISP

Рис. 7.   Функция cdr.

В переменной р1 теперь хранятся координаты начальной точки отрезка.

Аналогичным образом извлекаем из списка list_obj координаты конечной точки отрезка (DXF-код конечной точки отрезка равен 11), и сохраняем их в переменной р2.

(setq p2 (cdr(assoc 11 list_obj)))

Длину отрезка определяем при помощи функции distance.

Функция  (distance <точка1> < точка2>) вычисляет расстояние между двумя точками, где

<точка1> < точка2> — координаты точек.

Давайте добавим строку:

(setq dl_otr (distance р1 р2))

в которой мы вычисляем длину выбранного отрезка, и сохраняем ее в переменной dl_otr

Выделяем последние две строчки и нажимаем кнопку «Загрузить выделенный фрагмент».

В консоли появится результат выполнения. Координаты второй точки и длина выбранного отрезка. См. Рис. 8.

Пример AutoLISP

Рис. 8.   Функция distance.

Для того, чтобы программа после указания первого отрезка запросила следующий мы организует цикл при помощи функции while.

Функция while выполняет операцию цикла по многократно проверяемому условию.

(while <условие>

      <выражения>

)

Если <условие> верно, то оно возвращает Т (True), если не верно то nil.

Пока <условие> принимает значение Т, функция while выполняет <выражения>, и она прекратит свою работу, когда на некотором шаге аргумент <условие> получит значение nil.

Чтобы наш цикл был бесконечным, мы вместо условия поставим значение Т.

(while Т

      <выражения>

)

В этом случаи наш цикл будет бесконечно запрашивать новый отрезок, пока мы не прервем его, нажав на <Esc>

Для того, чтобы сосчитать сумму длин выбранных отрезков, введем переменную sum_dl.

Перед началом цикла присвоим sum_dl начальное значение 0.0.

(setq sum_dl 0.0)

Внутри цикла добавим выражение:

(setq sum_dl (+ sum_dl dl_otr))

На первом шаге к sum_dl =0.0 прибавится длина первого отрезка dl_otr. Сумма снова присваивается переменной sum_dl.

На втором шаге к sum_dl (которая равна длине первого отрезка) прибавится длина второго выбранного отрезка dl_otr. Сумма снова присваивается переменной sum_dl.

И так далее с каждым новым шагом мы будем прибавлять длину выбранного отрезка к сумме отрезков выбранных ранее.

Чтобы напечатать результат в командной строке добавим выражение:

(princ sum_dl)

В результате наша программа будет выглядеть так. См. Рис. 9.

Пример AutoLISP

Рис. 9.   Функция while. Создания цикла.

Выделяем весь текст и нажимаем кнопку «Загрузить выделенный фрагмент».

На запрос: «Выберите отрезок:» укажите один из ранее нарисованных отрезков.

В командной строке появится длина выбранного отрезка, ниже снова появится запрос: «Выберите отрезок:»  См. Рис. 10.

Пример AutoLISP

Рис. 10.    Длина выбранного отрезка.

Укажите второй отрезок, и в командной строке появится сумма длин двух отрезков.

Ниже снова появится запрос: «Выберите отрезок:»  См. Рис. 11.

Пример AutoLISP

Рис. 11.   Сумма длин двух отрезков.

Чтобы прервать выполнения программы нажмите <Esc>.

Хотя мы и получили требуемый результат, написание программы еще не окончено.

Давайте проверим, что будет, если при выборе отрезка мы промахнемся и щелкнем мимо.

Снова выделяем весь текст и нажимаем кнопку «Загрузить выделенный фрагмент».

На запрос: «Выберите отрезок:», щелкнете в пустом месте не выбирая отрезок.  См. Рис. 12.

Пример AutoLISP

Рис. 12.    Ошибка: неверный тип аргумента.

Программа прервет свою работу.

В консоли Visual LISP появится сообщение: ошибка: неверный тип аргумента: lentityp nil.

Очевидно, что после того, как мы промахнулись при выборе отрезка, функция entsel вернуло не имя выбранного отрезка, а значение nil. Это и вызвало ошибку.

Чтобы программа не реагировала на промахи пользователя, нужно добавить в нашу программу еще несколько строк.

Функция if выполняет условную операцию типа if-then-else (если-то-иначе)

(if <условие> <выражение1> [<выражение2>])

Если <условие> верно выполняется <выражение1>

Если <условие> не верно выполняется <выражение2>

Давайте напишем <условие> для нашего случая.

Следующее условие (= name_obj nil) будет читаться так: если name_obj рано nil.

Но нам нужно выполнять наши выражения наоборот, когда name_obj не рано nil. А это соответствует следующему условию:

(not (= name_obj nil))

Если <условие> верно и нам нужно выполнить не одно <выражение>, а несколько, то нужно использовать функцию progn.

Функция prong объединяет несколько выражений в одно. Добавим ее к функции if и в общем случаи наш кусок кода будет выглядеть так:

(if (not (= name_obj nil))

    (progn

      <наши выражения>

    ) ;end progn

  ) ; end if

Читается: Если name_obj не равно nil выполнить <наши выражения>

Добавим эти строки в нашу программу и она примет следующий вид. См. Рис. 13

Пример AutoLISP

Рис. 13.   Функции if и progn

Выделяем весь текст и нажимаем кнопку «Загрузить выделенный фрагмент».

Протестируете программу. Теперь даже, если вы щелкаете на пустом месте, программа AutoLISP не прекращает свою работу, а продолжает выдавать запрос: «Выберите отрезок:»

Но пользователь может случайно выбрать другой примитив (не отрезок), например окружность. По всей видимости, программа снова выдаст ошибку. Чтобы этого не произошло, следующим выражением прочитаем и запомним тип выбранного примитива:

(setq tip_obj (cdr (assoc 0 list_obj)))

0 – это  DXF-код типа.

Затем, поставим условия, что выполнять выражения нужно, если выбранный объект имеет тип отрезок («LINE»).

Добавляем выше сказанное в программу, и она приобретает следующий вид. См. Рис. 14.

Пример AutoLISP

Рис. 14.  Проверка типа «LINE«.

Добавленные строки помечены синими полосками.  Теперь наша программа не будет выдавать ошибку, если пользователь случайно выделит другой примитив.

Для того, чтобы пользователь видел какие отрезки он уже выбрал, а какие нет, давайте выделим выбранные отрезки.

Для этого сначала, создадим пустой набор и сохраним его в переменной line_set:

(setq line_set (ssadd))

Функция ssadd добавляет примитив в набор.

(ssadd [<примитив> [<набор>]]) , где

<примитив> — имя примитива.

<набор> — имя набора.

Для того, чтобы выделить примитивы, входящие в набор используется функция sssetfirst:

(sssetfirst <набор1> [<набор2>])

Функция sssetfirst включает ручки у примитивов, входящих в <набор1>.

А у примитивов входящих в <набор2> включает ручки и подсвечивает их пунктиром.

Добавим в нашу программу, следующую строчку:

(sssetfirst nil (ssadd name_obj line_set))

Она добавляет примитив name_obj в набор line_set, а затем включает ручки и подсвечивает пунктиром примитивы, входящие в этот набор.

Теперь наша программа будет иметь следующий вид. См. Рис.15.

Пример AutoLISP

Рис. 15.  Функции ssadd и sssetfirst.

Выделяем весь текст и нажимаем кнопку «Загрузить выделенный фрагмент».

На запрос: «Выберите отрезок:» укажите один из ранее нарисованных отрезков.

Отрезок будет выделен. См. Рис. 16.

Пример AutoLISP

Рис. 16.   Выделенный отрезок.

Причем, если пользователь укажет другой примитив, он выделен не будет и сумма отрезков не изменится.

Теперь давайте сделаем результат, который выводится у нас в командной строке более информативным.

Для этого, сначала преобразуем вещественное число, которое хранится в переменной sum_dl в строку:

(rtos sum_dl).

Затем при помощи функции сцепления строк strcat, прицепим пояснительную надпись.

Строка печати примет следующий вид:

(princ (strcat «nОбщая длина: — « (rtos sum_dl)))

Кроме этого давайте сосчитаем количество выбранных отрезков. Для этого вначале перед циклом введем переменную n и присвоим ей целочисленное значения 0.

Далее внутри цикла помещаем строку

(setq n (+ n 1))

 которая будет считать количество выбранных отрезков.

Затем, преобразуем целое число в строку (itoa n), добавим пояснительную надпись и вставим в строку печати. См. Рис.17.

Пример AutoLISP

Рис. 17.    Добавление количества выбранных отрезков.

Поле чего она примет следующий вид:

(princ (strcat «nОтрезков — « (itoa n) « nОбщая длина: — « (rtos sum_dl))).

Теперь наша программа выглядит так. См. Рис.18.

Пример AutoLISP

Рис. 18. Функции rtos, itoa и strcat. Изменения строки печати.

Выделяем весь текст и нажимаем кнопку «Загрузить выделенный фрагмент».

На запрос: «Выберите отрезок:» укажите сначала один, а затем и второй отрезок.

В командной строке будет написано количество выбранных отрезков и их общая длина. См. Рис. 19.

Пример AutoLISP

Рис. 19.  Количество выбранных отрезков и их общая длина.

Чтобы прервать выполнения программы нажмите <Esc>.

В заключении преобразуем нашу программу в пользовательскую функцию.

Добавим строку, в которой придумаем имя функции и перечислим все временные переменные:

(defun c:SumDl (/ line_set sum_Dl n name_obj list_obj tip_obj p1 p2 dl_otr)

      <наша программа>

) ; end_defun

Окончательный вариант программы см. Рис. 20.

Пример AutoLISP

Рис. 20.  Программа сумма длин отрезков.

Код программы:

(defun c:SumDl (/ line_set sum_Dl n name_obj list_obj tip_obj p1 p2 dl_otr)
   (setq line_set (ssadd)) ; создаем пустой список
   (setq sum_dl 0.0)         ; Сумма длин = 0
   (setq n 0)                      ; Кол-во выбранных отрезков
   (while T (setq name_obj (car (entsel "Выберите отрезок: ")))
       (if (not (= name_obj nil))
          (progn
             (setq list_obj (entget name_obj))
             (setq tip_obj (cdr (assoc 0 list_obj)))
             (if (= tip_obj "LINE")
                (progn
                    (sssetfirst nil (ssadd name_obj line_set))
                    (setq p1 (cdr (assoc 10 list_obj)))
                    (setq p2 (cdr (assoc 11 list_obj)))
                    (setq dl_otr (distance p1 p2))
                    (setq sum_dl (+ sum_dl dl_otr))
                    (setq n (+ n 1))
                 );end progn
              ); end if
           );end progn
        ); end if
        (princ (strcat "nОтрезков - " (itoa n) "nОбщая длина: - " (rtos sum_dl)))
    ); end while
); end_defun

 Скачать программу Sum_dl.lsp Скачать программу Sum_dl.lsp (Размер файла: 464 bytes)

Теперь, чтобы запустить программу, используем кнопку «Загрузить активное окно редактора». Переходим в AutoCAD, в командной строке набираем SumDl и нажимаем <Enter>.

После того, как программа написана и протестирована нужно:

  • Если это ещё не сделано, добавить все локальные переменные в список временных переменных функции defun.
  • Сохранить свою LISP-программу.
  • Закрыть редактор Visual LISP и AutoCAD, чтобы очистить все значения переменных.
  • Загрузить AutoCAD снова.
  • Также можно добавить нашу программу в список автоматической загрузки и создать для нее кнопку запуска. Как это сделать рассмотрено в уроке: Простой запуск LISP программ.

Надеюсь, что этот пример AutoLISP программы у Вас получился, и Вы найдете ему применение.

В следующем уроке мы рассмотрим возможные вариации этой программы: Примеры LISP программ: Сумма длин отрезков.

Пишите в комментариях:

Трудно ли было выполнить этот урок?

Где у вас возникли трудности?

Была ли для Вас полезной информация, данная в этом уроке?

На какие вопросы программирования, Вы хотели бы, увидит ответы в следующих уроках?

Я с удовольствием отвечу на ваши комментарии.

Если вы хотите получать новости с моего сайта. Оформляйте подписку.

До новых встреч.

 «Автор: Михаил Орлов»

Google

Также на эту тему Вы можете почитать:

Issue

You received an error message beginning with the words Error: ‘Bad argument type’. Here are some examples:

  • Error: ‘Bad argument type: Numberp nil’
  • Error: ‘Bad argument type: Stringp nil’
  • Error: ‘Bad argument type: VLA-object nil’
  • Error: ‘Bad argument type: lentityp nil’
  • Error: ‘Bad argument type: VLA-object-collection’
  • Sys-error: ‘Bad argument type: 2D/3D point: nil’
  • Error: ‘Bad argument type: consp nil’
  • Error: ‘Bad argument type: INT nil’

Solution

You might see any number of possible errors that begin with Bad argument type, Before getting into the specific error you saw, it’s important to go through a few simple troubleshooting steps:

• What to do first when you see a Bad Argument Type error

If you receive any error message that includes the text «bad argument type» – including all specific error messages listed on this page – go through the following three steps before getting into any of the various bad argument type error messages listed below. Any bad argument type error can potentially stem from either drawing corruption or a bug in the code, so you’ll need to either rule out or resolve these two causes first.

Step 1: Take a screenshot of the error report

Immediately after receiving the error, press the F2 key on your keyboard. Pressing F2 will open the error report in your AutoCAD Command line, and you’ll be able to see actually generated the bad argument error. It’s important that you take a screenshot of the error report in the Command line and save it to your desktop. You may need it later to figure out what caused the error, and we may ask you to send that screenshot to our tech support team to help us diagnose the issue. 

Closed the error message already? No worries – just do the same thing you did to get the error (place a plant, select a valve, etc.). The error will likely pop up again and you can press F2 and screenshot the error report.

Step 2: Rule out, or address, drawing corruption

Bad argument type errors often result from corruption in your drawing. To check for corruption, open a fresh new DWG drawing file and try the same action that generated the error. For example, if you saw the error immediately after placing a plant or setting your drawing scale, do that same thing in the blank drawing. 

***Important***: It’s crucial that you follow our specific steps to duplicate an error in a blank drawing.

  • Did you get the same bad argument type error in the blank drawing? If so, move on to Step 3.
  • Were you able to complete the same action in the blank drawing without generating the error? If so, the issue is almost certainly the result of drawing corruption. Here’s what to do:

1. Open the file where you first saw the error, and follow our steps to clean your drawing.

2. Configure our recommended settings for showing Proxy information. These settings will help you determine whether your drawing file is still corrupt.

3. Open the cleaned drawing file. If you configured the Proxy information settings correctly, you should see a Proxy Information dialog box immediately. Does this dialog box show no Proxy Objects? If so, your file is clean. Now try the same action (placing a plant, setting the scale, etc.) that generated the error.

  • No error? You’ve resolved the issue.
  • Still getting a bad argument type error? Move on to Step 3.  

Step 3: Check for a bug in the code

Once you’ve either ruled out or addressed drawing corruption, it’s time to check whether the error is the result of a bug in the code of our software.

Note that a bad argument type error will always mean that a variable in the code is not what the system is expecting. In fact, it could be the result of a simple bug – the most common of which is a typo in the code. In this case, the “object” in question may be just fine, but the variable name was mistyped in the code. (Yes, even programmers are human!) So of course the misspelled version is certainly not an object reference and is therefore nil – hence the error message.

The easiest way to check for a bug is to check our list of recent updates.

  • Don’t see a recent update that’s related to what you tried to do when you saw the error? You’ve likely ruled out a bug. It’s time to locate and address the specific bad argument type error message you’re seeing.
  • Do you see a recent update that’s related to what you tried to do when you saw the error? If so, there’s a good chance you’ve detected a bug in the code. For example, if you saw a bad argument type error when you attempted to place a Reference Note Callout, and a recent update has to do with Reference Note Callouts, there’s your bug! If you think you’ve found a bug, please let us know by sending us a technical support ticket. Make sure to include the following items in the ticket:

    • The exact text of the error message, and a screenshot of the error message (if you have it)
    • A description of the action you took that generated the error message (such as placing a plant, editing a detail, etc.)
    • A screenshot of the error report you generated by pressing the F2 key after seeing the error message. Don’t have a screenshot? Just do the same thing that caused the error. You’ll see the bad argument type error message. Press F2 now, and take a screenshot of the entire AutoCAD Command line. Include this screenshot in the technical support ticket.

Based on your ticket, we’ll take a look at the code and determine whether there is indeed a bug. If so, we’ll get right on repairing it in an update. You’ve helped us improve the software!

 Close

Specific ‘Bad Argument Type’ Errors

If you went through the «What to do first» steps above and are still seeing the error, it’s time to get into the specific Bad argument type error you’re seeing.

We’re continually logging the causes and solutions of new Bad argument type errors as we see them. Here are the specific ones we’ve seen:

• Error: ‘Bad argument type: Numberp: nil’

  • If you saw this error when trying to use our Nuke tool, your Proxy settings are configured incorrectly. Please follow our recommendations for the Proxy settings in the Options dialog box. You should then be able to Nuke properly.
  • Are you getting this message when using our Verify tool for Lighting? If so, make sure you don’t have any looped wire sections in your wire paths to fixtures.
  • Otherwise, this error will invariably be the result of drawing corruption. Follow our steps to clean your drawing.

 Close

• Error: ‘Bad argument type: Stringp nil’

You might see this error when you:

  • Tried to use our Verify Labels tool, or when working specifically with plants.
  • Had our Color Render tool turned on.
  • Attempted to open AutoCAD or F/X CAD, and it completely froze.
  • Tried to add a dripline hatch to your project.
  • Tried to place a block from our Discipline Graphics library

As you can see, this particular Bad argument error has several possible causes and, as a result, potential solutions. See our Error: ‘Bad Argument Type: Stringp Nil’ article to find your solution.

 Close

• Error: ‘Bad argument type: VLA-OBJECT nil’

A bad argument type error containing the text VLA-object nil means the software is expecting something in your drawing to be a «smart» object, but a variable in the code has caused that thing to not actually be an object. (In other words, it’s nil.) As a result, the software was not able to reference that object, which in turn prevented it from carrying out the action you were trying to complete and generated the error message.

As for the actual issue, it will depend on what you were trying to do when you received the error, as well as which object reference is now nil. Here are a few possible causes:

  • You have Local Data (MySQL), and your database connection object is nil

First, make absolute sure that you’ve followed our steps for what to do first when you see a bad argument type error – especially Step 3: Check for a bug in the code. Take note of exactly what you did (or tried to do) that resulted in the error, and check it against our recent updates, as described in those steps. 

If you can rule out a bug in the software based on those steps, your next step should be to diagnose a possible problem with your MySQL database server – but only if you’re using our software with a local (MySQL) database. Ask your IT administrator to troubleshoot your office’s MySQL database server, as described on our slow Land F/X performance troubleshooting article. Don’t know whether you’re using Local Data? Your CAD manager or IT admin can let you know.

  • You attempted to create a colorized plan using our Color Render tool 

In this case, the problematic object is a Truecolor object. If you’re getting this error every time you try to apply plant color, you can repair the error by following our steps to uninstall and reinstall AutoCAD or F/X CAD.

  • An XML file is damaged or missing

Are you getting this error right when opening CAD? Is CAD freezing up and you’re unable to use our software? If so, a file named _install_.xml, stored in your LandFX folder, is likely damaged or missing.

In this case, follow our steps to restore the install.xml file.

  • You attempted to perform one of several possible actions with a detail

Finally, you might receive this error when working with a detail. For example, you may have tried to edit, save, copy, or place a detail when you received the error.

In this case, the system is unable to read or write in that detail’s XML file. This can occur for several possible reasons:

  • You don’t have read/write permissions for the folder where that XML file lives. Have your IT administrator ensure that you have all the proper permissions to work with your office’s details. 
  • Your details are stored at a UNC path, which we don’t recommend. Ask your IT administrator to ensure that the folder containing your details is mapped to a letter drive.
  • Any number of issues with your Windows installation – another potential set of troubleshooting steps for your IT admin to complete.
  • Malware (less common). Your IT administrator should ensure that your computer and network are free of malware.

If you’ve ruled out all of the causes listed above, it’s likely that the XML file is missing from the location where the detail is stored. If so, copy the detail to your desktop and use our Save Detail tool to save it into the system.

Still getting the error? If you’ve ruled out permissions, a UNC path, your Windows installation, and malware, it’s possible that you or someone in your office has attempted to import the detail into a Land F/X project but clicked on the wrong XML file.  

Specifically, this error is the result of importing the file _index_.xml rather than the correct XML file for the detail you intended to import.

Instead, you need to import the XML file from the corresponding exported detail. Open the Detail Explorer and click Import.

You’ll then be prompted to select a detail export file.

Navigate to the location where you’ve exported the detail.

Open that folder, and select the file details.xml. Click Open.

You should now be able to work with that detail without receiving the error.

 Close

• Error: ‘Bad argument type: lentityp nil’

A bad argument type error containing the text lentityp nil can have several possible causes, including:

  • Drawing corruption (most commonly), or a bug in the software code

Make absolute certain that you’ve followed our steps for what to do first when you see a bad argument type error. Those steps include instructions on how to check for corruption in your drawing and how to check for a bug in the software.

Note that drawing corruption is the most common cause of this error. If you detect drawing corruption when completing the «what to do first» steps, follow our steps to clean your drawing and all Xrefs. We always recommend cleaning every single drawing you receive from someone else before you start working on it. Keeping your drawings clean will prevent a host of issues (including this error) and save you tons of time.

  • Locked layers in a drawing that contains callouts

If you’ve ruled out a bug and drawing corruption, the error is likely the result of locked layers that are preventing you from working with callouts in your drawing. These can include:

  • Plant labels
  • Reference Notes (RefNotes) 
  • Detail callouts
  • Valve callouts

To unlock layers in your drawing, see our lock/unlock layers documentation section. Note: We don’t recommend locking layers in your drawings – except those that contain your Xrefs.

At the very least, unlock all layers that contain callouts (or portions of callouts). You should now be able to continue working without seeing the error message.

 Close

• Error: ‘Bad argument type: VLA-object collection, VLA-object’

An error message containing the text ‘Bad argument type: vla-object collection’ is always the result of the software attempting (and failing) to determine which sheet you are working on. You might receive this error when:

  • Setting the drawing scale
  • Working with details or detail callouts
  • Doing anything that requires the software to know which sheet you are working on

Follow our steps to resolve this specific error.

 Close

• Sys-error: ‘Bad argument type: 2D/3D point: nil’

You’ll most commonly see this error when trying place or copy an object, or carry out a similar type of action, using one of our tools. You’re seeing the error because the system is unable to calculate an intersection in your drawing. Specifically, it’s trying (and failing) to calculate the distance between the cursor and the object you’re trying to place, copy, or verify. (We’ve seen it happen with placing plants or irrigation equipment such as valves, or using tools such as our Plant Mirror tool that copy objects in a drawing.)

Here’s a past example of this error message:

 [3.33] (sys-error «bad argument type: 2D/3D point: nil»)

:ERROR-BREAK.28 nil
[4.25] (ANGLE (907.216 795.06 0.0) nil)
[5.19] (C:VALVECALLOUT)

In this example, the user tried to place a valve callout but was unsuccessful because the system was unable to calculate the angle between the cursor and valve that was being called out. (Note that the issue can affect any number of items, from irrigation to plant labeling, site objects, etc.) 

This error most commonly results from:

• Corruption in your drawing

Drawing corruption is by far the most common cause of this error. Your first step should be to follow our instructions to clean the drawing and all Xrefs.

Cleaning your drawing will often take care of the error.

Still seeing the error after cleaning your drawing? Read on.

A bad argument type error containing the text 2D/3D point: nil can also result from:

• A bug in the software code

Make absolute sure you’ve followed our steps for what to do first when you see a bad argument type error – especially Step 3: Check for a bug in the code. Take note of exactly what you did (or tried to do) that resulted in the error, and check it against our recent updates, as described in those steps.

• Working in Paper Space rather than Model Space

Check whether you are working in Paper Space. If so, open the Model tab and work in Model Space. Try the same action that generated the error, but in Model Space. If you don’t see the error, you’ve resolved the issue.

You might also see this error if you’re labeling in a Paper Space viewport with the intention that the labels will be moved to Paper Space. If so, the error is occurring because of a problem with either the viewport or the User Coordinate System (UCS) you’re currently using.

Try labeling in a different Paper Space viewport. If you don’t see the error, you’ve isolated the problem to the other viewport.

• A problem with the current User Coordinate System (UCS)

The UCS you’re currently using for your drawing may have an issue that’s preventing the software from calculating angles between the cursor and objects in your plan. To check for and resolve this issue:

  • Use our Restore UCS tool to return your drawing to the World Coordinate System (WCS). Then try the action that generated the error (such as placing a valve callout).

    • Don’t see the error when attempting the same action in the WCS? If not, use our New UCS tool to set a new UCS for your drawing. Make sure you use our New UCS tool – not the AutoCAD UCS command.
    • Does the error persist in the WCS? If so, make absolute sure you’re working in Model Space and not Paper Space.

• An object with a Z elevation

You might see this error when clicking on an object that mistakenly has a Z elevation set to it. For example, you may be trying to call out a plant or a valve with a Z elevation.

Select the object you clicked.

Then open the Properties panel by typing Prop in the Command line and pressing Enter.

In the Properties panel, check the Position Z entry. If it’s anything other than 0, set it to 0. (If it’s already at 0, the object does not have a Z elevation.)

If you changed the Z elevation to 0, try the action that generated the error. Are you able to click the object without getting the error? You’ve solved the issue.

• Attempting to click objects on a locked layer

You might be trying to select an object on a locked layer. For example, you may be trying to call out a plant or valve whose layer is locked. See our section on locked and unlocked layers for instructions on how to unlock layers.

We generally don’t recommend locking layers – except those that contain your Xrefs.

• Using our Verify Labels tool when one of the blocks in your plan is empty – that is, no linework or objects inside the block

In this case, check the Command line history for the name of the object that caused the error. Check the Land F/X object data to determine which block is assigned. Then use one of the following possible solution options:

Option 1: Edit the data to use a different block that isn’t empty.

Option 2: Fix the empty block by either:

  • Using our Using our REDEFINEBLOCK tool, or
  • Editing the block manually to add linework inside it

Option 3: If using Reference Notes (RefNotes), consider whether the reason for the empty block is that you don’t actually want the block to be visible in your drawing.

If you don’t in fact want the block to be visible, change the RefNote from an Amenity RefNote to a Notation RefNote. Then use the Quick Select command to select and delete all the empty blocks and place Notation callouts instead.

 Close

• Error: ‘Bad argument type: consp nil’

This error can result from:

  • A bug in the software code

Make absolute sure you’ve followed our steps for what to do first when you see a bad argument type error – especially Step 3: Check for a bug in the code. Take note of exactly what you did (or tried to do) that resulted in the error, and check it against our recent updates, as described in those steps.

  • Attempting to select an item in your plan that is no longer in the current Land F/X project 

Once you’ve ruled out a bug, it’s time to check whether an object you’re attempting to select, such as a plant or a piece of irrigation equipment, has been removed from your project. If so, you’ll need to add that item back to your project.

  • A font issue

Did you get this error when trying to place text? Solution >

  • Update didn’t complete

Did you get this error after trying to run an update? The update may not have completed correctly. Follow our steps to Revert to a previous version after an update. Then run the update again and restart your computer.

 Close

• Error: ‘Bad argument type: INT nil’

We’ve seen this error pop up right after clicking the Site Color palette, but you might see it when you select or use other Land F/X tools as welll.

You can resolve this error quickly by following our steps to install the latest OpenDCL library.

 Close

Страницы 1 2 Далее

Чтобы отправить ответ, вы должны войти или зарегистрироваться

RSS

Сообщения с 1 по 25 из 35

#1 9 марта 2006г. 09:19:29

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Тема: LISP. Разрыв (обрыв, …) строчки в указанной точке

;|====================================================
 Разрыв (обрыв, ...) строчки в указанной точке
 Программа Дениса Флюстикова "Str_Den"
 Макрос для кнопки: ^C^C^P(load "Str_Den");Str_Den
 Замечания и предложения по адресу fd-@mail.ru
====================================================|;
(defun c:Str_Den (/ n a a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 OSMODE)
(setq a nil)
(while (/= (cdr (assoc 0 a)) "TEXT")
(setq a5 (car (entsel "nВыберите текст:"))
      a (entget a5)))
(setq OSMODE (getvar "OSMODE")
      n '("l" "c" "r" "a" "m" "f")
      a7 (nth (cdr (assoc 72 a)) n )
      n '("" "b" "m" "t")
      n (nth (cdr (assoc 73 a)) n )
      a7 (strcat "_" n a7)
      a9 (cdr (assoc 50 a))
      a2 (cdr (assoc 10 a))
      a2 (trans a2 0 1))
(setvar "CMDECHO" 0)
(command "_.undo" "_g")
(if (> (rem OSMODE 128) 63)
(setvar "OSMODE" (- OSMODE 64)))
(initget 6 "Р У Н В П")
(if (not (vl-catch-all-error-p
(setq a3 (vl-catch-all-apply 'getpoint
(list "nточка Разрыва или вторую часть[Удалить/на Новую строку/Вставить в текст/Перенести]<В текст>:")))))
(progn
(setq a10 a3)
(if (null a3)(setq a10 "В"))
(if (= (type a3) 'LIST)
(setq a10 "Р")
(setq a3 (vl-catch-all-apply 'getpoint
(list "nУкажите точку разделения:"))))
(setvar "OSMODE" OSMODE)
(if (= (type a3) 'LIST)(progn
(setq a1 (cos (- (angle a2 a3) a9))
      a3 (* a1 (distance a2 a3))
      a4 (caadr (Textbox a))
      a6 a4
      a1 (cdr (assoc 1 a))
      n (strlen a1))
(if (and (< a3 a4)(> a3 0))(progn
(command "_.justifytext" a5 "" "_l"
     "_.copy" a5 "" a2 a2)
(setq a (entget a5))
(while (and (> a6 a3)(> n 0))
(setq a8 (substr a1 1 n)
      a8 (vl-string-right-trim " " a8)
      a8 (subst (cons 1 a8)(assoc 1 a) a)
      a6 (caadr (Textbox a8))
      n (1- n))
)
(entmod a8)
(setq a8 (substr a1 (+ 2 n)(strlen a1))
      a6 (subst (cons 1 a8)(assoc 1 a) a)
      a6 (- a4 (caadr (Textbox a6)))
      a1 (entlast)
      a (entget a1))
(if (= a10 "Н")
(setq a9 (- a9 (/ pi 2))
      a6 (cdr (assoc 40 a))
      a6 (* 5 (/ a6 3))))
(setq a2 (polar a2 a9 a6)
      a2 (trans a2 1 0)
      a (subst (cons 10 a2)(assoc 10 a) a))
(entmod (subst (cons 1 a8)(assoc 1 a) a))
(command "_.justifytext" a5 a1 "" a7)
(if (= a10 "П")
(vl-cmdf "_.move" a1 "" a2 pause)
(if (and (/= a10 "Р")(/= a10 "Н"))(progn
(command "_.erase" a1 "")
(if (= a10 "В")
(while a2
(if (vl-catch-all-error-p
(setq a5 (vl-catch-all-apply 'entsel
(list "nВыберите текст:"))))
(setq a2 nil)
(if (= (type a5) 'LIST)(progn
(setq a (entget (car a5)))
(if (wcmatch (cdr (assoc 0 a)) "*TEXT")(progn
(setq a2 nil
      a4 (cdr (assoc 1 a))
      a6 (vl-string-left-trim " " a4)
      a7 (- (strlen a4) (strlen a6))
      a8 (vl-string-right-trim " " a8)
      a6 (strcat a8 " " a6))
(repeat a7
(setq a6 (strcat " " a6)))
(entmod (subst (cons 1 a6)(assoc 1 a) a))
)))))))))))
(princ "nТочка за границами текста")
)))))
(setvar "OSMODE" OSMODE)
(command "_.undo" "_e")
(setvar "CMDECHO" 1)
(princ)
)

#2 Ответ от skkkk 19 мая 2008г. 23:09:39

  • skkkk
  • Участник
  • На форуме с 22 апреля 2008г.
  • Сообщений: 31
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

У меня пишет

; ошибка: неверный тип аргумента: lentityp nil

#3 Ответ от Денис Флюстиков 20 мая 2008г. 21:31:55

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Еще раз проверил работу программы, скопировав код в LISP-формат, вроде все OK. Уточни, когда появляется сообщение, до, после или во время диалога. Проблема на разных машинах, в файлах с разными настройками?

#4 Ответ от Victor 21 мая 2008г. 08:24:43

  • Victor
  • Восстановленный участник
  • На форуме с 26 марта 2007г.
  • Сообщений: 270
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

У меня на англицком автокаде работает. Везде, где русские буквы,
стоят вопросительные знаки, но основную функцию выполняет — делит текст.

#5 Ответ от Денис Флюстиков 24 мая 2008г. 14:12:28

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> skkkk

> Victor
Погонял программу под разными версиями AutoCAD (рус., англ.), ошибок не обнаружил.
Программа работает только с однострочным текстом, и если выбрать многострочный и
нажать пробел, то появляется подобное соощение:
«    ; ошибка: неверный тип аргумента: lentityp nil    »
Этот моментик исправлю

#6 Ответ от Денис Флюстиков 24 мая 2008г. 14:14:23

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

;|====================================================
 Разрыв (обрыв, ...) строчки в указанной точке
 Программа Дениса Флюстикова "Str_Den" от 24.05.08:
 учтены коды подчеркивания и надчеркивания текста
 Макрос для кнопки: ^C^C^P(load "Str_Den");Str_Den
 Замечания и предложения по адресу fd-@mail.ru
====================================================|;
(defun c:Str_Den (/ n a a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 OSMODE)
(setq a nil)
(while (/= (cdr (assoc 0 a)) "TEXT")
(if (setq a5 (car (entsel "nВыберите однострочный текст:")))
(setq a (entget a5)))
)
(setq OSMODE (getvar "OSMODE")
      n '("l" "c" "r" "a" "m" "f")
      a7 (nth (cdr (assoc 72 a)) n )
      n '("" "b" "m" "t")
      n (nth (cdr (assoc 73 a)) n )
      a7 (strcat "_" n a7)
      a9 (cdr (assoc 50 a))
      a2 (cdr (assoc 10 a))
      a2 (trans a2 0 1))
(setvar "CMDECHO" 0)
(command "_.undo" "_g")
(if (> (rem OSMODE 128) 63)
(setvar "OSMODE" (- OSMODE 64)))
(initget 6 "Р У Н В П")
(if (not (vl-catch-all-error-p
(setq a3 (vl-catch-all-apply 'getpoint
(list "nточка Разрыва или вторую часть[Удалить/на Новую строку/Вставить в текст/Перенести]<В текст>:")))))
(progn
(setq a10 a3)
(if (null a3)(setq a10 "В"))
(if (= (type a3) 'LIST)
(setq a10 "Р")
(setq a3 (vl-catch-all-apply 'getpoint
(list "nУкажите точку разделения:"))))
(setvar "OSMODE" OSMODE)
(if (= (type a3) 'LIST)(progn
(setq a1 (cos (- (angle a2 a3) a9))
      a3 (* a1 (distance a2 a3))
      a4 (caadr (Textbox a))
      a6 a4
      a1 (cdr (assoc 1 a))
      n (strlen a1))
(if (and (< a3 a4)(> a3 0))(progn
(vl-cmdf "_.justifytext" a5 "" "_l")
(vl-cmdf "_.copy" a5 "" a2 a2)
(setq a (entget a5)
      a11 a1)
(while (and (> a6 a3)(> n 0))
(setq a11 (substr a11 1 n)
      a11 (vl-string-right-trim " " a11)
      a8 (subst (cons 1 a11)(assoc 1 a) a)
      a6 (caadr (Textbox a8)))
(if (wcmatch a11 "*%%?")
(setq n (- n 3))
(if (wcmatch a11 "*U+????")
(setq n (- n 7))
(if (wcmatch a11 "*%%###")
(setq n (- n 5))
(setq n (1- n)))))
)
(entmod a8)
(setq a6 "%%U"
      a8 1
      a11 (strcase a11))
(while (wcmatch a11 (strcat "*" a6 "*"))
(setq a6 (strcat a6 "*%%U")
      a8 (1+ a8)))
(if (= 0 (rem a8 2))
(setq a3 "%%U")
(setq a3 ""))
(setq a6 "%%O"
      a8 1)
(while (wcmatch a11 (strcat "*" a6 "*"))
(setq a6 (strcat a6 "*%%O")
      a8 (1+ a8)))
(if (= 0 (rem a8 2))
(setq a3 (strcat a3 "%%O")))
(setq a8 (substr a1 (1+ (strlen a11))(strlen a1))
      a8 (strcat a3 a8)
      a6 (subst (cons 1 a8)(assoc 1 a) a)
      a6 (- a4 (caadr (Textbox a6)))
      a1 (entlast)
      a (entget a1))
(if (= a10 "Н")
(setq a9 (- a9 (/ pi 2))
      a6 (cdr (assoc 40 a))
      a6 (* 5 (/ a6 3))))
(setq a2 (polar a2 a9 a6)
      a2 (trans a2 1 0)
      a (subst (cons 10 a2)(assoc 10 a) a)
      a2 (trans a2 0 1))
(entmod (subst (cons 1 a8)(assoc 1 a) a))
(vl-cmdf "_.justifytext" a5 a1 "" a7)
(if (= a10 "П")
(vl-cmdf "_.move" a1 "" a2 pause)
(if (and (/= a10 "Р")(/= a10 "Н"))(progn
(command "_.erase" a1 "")
(if (= a10 "В")
(while a2
(if (vl-catch-all-error-p
(setq a5 (vl-catch-all-apply 'entsel
(list "nВыберите текст:"))))
(setq a2 nil)
(if (= (type a5) 'LIST)(progn
(setq a (entget (car a5)))
(if (wcmatch (cdr (assoc 0 a)) "*TEXT")(progn
(setq a2 nil
      a4 (cdr (assoc 1 a))
      a6 (vl-string-left-trim " " a4)
      a7 (- (strlen a4) (strlen a6))
      a8 (vl-string-right-trim " " a8)
      a6 (strcat a8 " " a6))
(repeat a7
(setq a6 (strcat " " a6)))
(entmod (subst (cons 1 a6)(assoc 1 a) a))
)))))))))))
(princ "nТочка за границами текста")
)))))
(setvar "OSMODE" OSMODE)
(command "_.undo" "_e")
(setvar "CMDECHO" 1)
(princ)
)

#7 Ответ от skkkk 3 июня 2008г. 04:04:35

  • skkkk
  • Участник
  • На форуме с 22 апреля 2008г.
  • Сообщений: 31
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Отлично работает….Дай Бог Вам здоровья:)

#8 Ответ от skkkk 3 июня 2008г. 04:10:17

  • skkkk
  • Участник
  • На форуме с 22 апреля 2008г.
  • Сообщений: 31
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

А с многострочным также нельзя??? И чтоб еще и объединить потом?? В идеале вижу это так: есть мтекст…разрываем его в нужных местах….редактируем, причем, каждую часть разными лиспами, затем обратно соединяем в том виде, как он есть, хотя этот пункт и необязателен, можно сгруппировать на худой конец. Но в любом случае прога — супер

#9 Ответ от Малявка 3 июня 2008г. 08:27:19

  • Малявка
  • Активный участник
  • На форуме с 18 января 2007г.
  • Сообщений: 274
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Спасибо за программу! Часто приходится переносить часть текста на другую строчку. Раньше делала тупым копированием и дальнейшим удалением лишних частей в полученных строчках.
Теперь горя не знаю.

#10 Ответ от Малявка 3 июня 2008г. 11:24:52

  • Малявка
  • Активный участник
  • На форуме с 18 января 2007г.
  • Сообщений: 274
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

А макрос работает только в модели! В листе не работает!!!
(хнык)

#11 Ответ от Денис Флюстиков 3 июня 2008г. 17:24:32

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Для указания места разрыва текста по точке на нижней границе, в коде вместо строчки:
      a6 (caadr (Textbox a8)))
вставте строчки:
      a6 (subst ‘(51 . 0)(assoc 51 a8) a8)
      a6 (caadr (Textbox a6)))
более удобно при работе с наклонным текстом.

> skkkk
Насчет многострочных текстов, то, похоже, здесь потребуется отдельная программа, поэтому лучше спросить на другой ветке форума, может, кто знает аналоги, или имеет проработки, а у меня в этом направлении планов нет.

> Малявка
Обычно пользуюсь программой в модели, да и в работе в листе проблем не замечал. Малявка, забрось мне в ящик этот DWG-файлик, попробую разобраться.

#12 Ответ от Малявка 3 июня 2008г. 18:49:35

  • Малявка
  • Активный участник
  • На форуме с 18 января 2007г.
  • Сообщений: 274
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Денис Флюстиков
Не пойму, что случилось! Всё работает и в листе тоже! Может, перезагрузка помогла, какой-нибудь глюк в моем компе снесла? Не знаю.
Короче, спасибо. Чмоки тя в разные приятные места.

#13 Ответ от Денис Флюстиков 3 июня 2008г. 19:09:05

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Малявка
Это лишнее, мне достаточно было узнать, что с помощью программы сделал человека не знающего горя :)
(> Малявка (2008-06-03 08:27:19))

#14 Ответ от Малявка 3 июня 2008г. 20:03:16

  • Малявка
  • Активный участник
  • На форуме с 18 января 2007г.
  • Сообщений: 274
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Денис Флюстиков
Сделал человека? И когда ж успел? Я че-й-то не заметила… ))
(типа прикол, не хотела обидеть, просто фраза получилась пошленько-смешная. Лучше бы «сделал человека счастливым». Или так: «сделал человека НЕ ЗНАЮЩИМ горя»).

#15 Ответ от Денис Флюстиков 3 июня 2008г. 20:06:39

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

:S

#16 Ответ от Kosarev 4 июня 2008г. 09:27:09

  • Kosarev
  • Активный участник
  • На форуме с 14 октября 2004г.
  • Сообщений: 162
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Нормальная штука.
Ненавязчиво предлагаю подсветить изначально выбранную строку для наглядности, для этого в начало вместо

(while (/= (cdr (assoc 0 a)) "TEXT")
(if (setq a5 (car (entsel "nВыберите однострочный текст:")))
(setq a (entget a5)))
)

вставим

(while (/= (cdr (assoc 0 a)) "TEXT")
  (if (setq a5 (car (entsel "nВыберите однострочный текст:")))
    (progn (redraw a5 3)(setq a (entget a5)))
  )
)

а в конце добавим

перед строкой (command «_.undo» «_e»)
Автор не против?

#17 Ответ от getr 4 июня 2008г. 10:57:30

  • getr
  • Восстановленный участник
  • На форуме с 20 декабря 2005г.
  • Сообщений: 22
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Денису
Флюстикову
Хотелось бы чтобы строка разделялась именно в указанной точке,а не как сейчас на пробел левее.
А то, напр. при опции на Новую строку,нижняя строка начинается с пробела и оказывается смещенной вправо на оный.

#18 Ответ от Малявка 4 июня 2008г. 12:08:38

  • Малявка
  • Активный участник
  • На форуме с 18 января 2007г.
  • Сообщений: 274
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Kosarev
Спасибо, маленькая фенечка, а мне понравилось.

#19 Ответ от Денис Флюстиков 4 июня 2008г. 13:42:24

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Kosarev
Спасибо, так лучше

> getr
Попробуй эту версию, то?

;|====================================================
 Разрыв (обрыв, ...) строчки в указанной точке
 Программа Дениса Флюстикова "Str_Den" от 04.06.08
 Макрос для кнопки:
 ^C^C^P(load "Str_Den");Str_Den
 Замечания и предложения по адресу fd-@mail.ru
 Большое спасибо Kosarev за помощь в доработке программы
====================================================|;
(defun c:Str_Den (/ n a a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 OSMODE)
(setq a nil)
(while (/= (cdr (assoc 0 a)) "TEXT")
(if (setq a5 (car (entsel "nВыберите однострочный текст:")))
(progn (redraw a5 3)(setq a (entget a5)))
)
)
(setq OSMODE (getvar "OSMODE")
      n '("l" "c" "r" "a" "m" "f")
      a7 (nth (cdr (assoc 72 a)) n )
      n '("" "b" "m" "t")
      n (nth (cdr (assoc 73 a)) n )
      a7 (strcat "_" n a7)
      a9 (cdr (assoc 50 a))
      a2 (cdr (assoc 10 a))
      a2 (trans a2 0 1))
(setvar "CMDECHO" 0)
(command "_.undo" "_g")
(if (> (rem OSMODE 128) 63)
(setvar "OSMODE" (- OSMODE 64)))
(initget 6 "Р У Н В П")
(if (not (vl-catch-all-error-p
(setq a3 (vl-catch-all-apply 'getpoint
(list "nточка Разрыва или вторую часть[Удалить/на Новую строку/Вставить в текст/Перенести]<В текст>:")))))
(progn
(setq a10 a3)
(if (null a3)(setq a10 "В"))
(if (= (type a3) 'LIST)
(setq a10 "Р")
(setq a3 (vl-catch-all-apply 'getpoint
(list "nУкажите точку разделения:"))))
(setvar "OSMODE" OSMODE)
(if (= (type a3) 'LIST)(progn
(setq a1 (cos (- (angle a2 a3) a9))
      a3 (* a1 (distance a2 a3))
      a4 (caadr (Textbox a))
      a6 a4
      a1 (cdr (assoc 1 a))
      n (strlen a1))
(if (and (< a3 a4)(> a3 0))(progn
(vl-cmdf "_.justifytext" a5 "" "_l")
(vl-cmdf "_.copy" a5 "" a2 a2)
(setq a (entget a5)
      a11 a1)
(while (and (> a6 a3)(> n 0))
(setq a11 (substr a11 1 n)
      a11 (vl-string-right-trim " " a11)
      a8 (subst (cons 1 a11)(assoc 1 a) a)
      a6 (subst '(51 . 0)(assoc 51 a8) a8)
      a6 (caadr (Textbox a6)))
(if (wcmatch a11 "*%%?")
(setq n (- n 3))
(if (wcmatch a11 "*U+????")
(setq n (- n 7))
(if (wcmatch a11 "*%%###")
(setq n (- n 5))
(setq n (1- n)))))
)
(entmod a8)
(setq a6 "%%U"
      a8 1
      a11 (strcase a11))
(while (wcmatch a11 (strcat "*" a6 "*"))
(setq a6 (strcat a6 "*%%U")
      a8 (1+ a8)))
(if (= 0 (rem a8 2))
(setq a3 "%%U")
(setq a3 ""))
(setq a6 "%%O"
      a8 1)
(while (wcmatch a11 (strcat "*" a6 "*"))
(setq a6 (strcat a6 "*%%O")
      a8 (1+ a8)))
(if (= 0 (rem a8 2))
(setq a3 (strcat a3 "%%O")))
(setq a8 (substr a1 (1+ (strlen a11))(strlen a1))
      a8 (vl-string-left-trim " " a8)
      a8 (strcat a3 a8)
      a6 (subst (cons 1 a8)(assoc 1 a) a)
      a6 (- a4 (caadr (Textbox a6)))
      a1 (entlast)
      a (entget a1))
(if (= a10 "Н")
(setq a9 (- a9 (/ pi 2))
      a6 (cdr (assoc 40 a))
      a6 (* 5 (/ a6 3))))
(setq a2 (polar a2 a9 a6)
      a2 (trans a2 1 0)
      a (subst (cons 10 a2)(assoc 10 a) a)
      a2 (trans a2 0 1))
(entmod (subst (cons 1 a8)(assoc 1 a) a))
(vl-cmdf "_.justifytext" a5 a1 "" a7)
(if (= a10 "П")
(vl-cmdf "_.move" a1 "" a2 pause)
(if (and (/= a10 "Р")(/= a10 "Н"))(progn
(command "_.erase" a1 "")
(if (= a10 "В")
(while a2
(if (vl-catch-all-error-p
(setq a5 (vl-catch-all-apply 'entsel
(list "nВыберите текст:"))))
(setq a2 nil)
(if (= (type a5) 'LIST)(progn
(setq a (entget (car a5)))
(if (wcmatch (cdr (assoc 0 a)) "*TEXT")(progn
(setq a2 nil
      a4 (cdr (assoc 1 a))
      a6 (vl-string-left-trim " " a4)
      a7 (- (strlen a4) (strlen a6))
      a8 (vl-string-right-trim " " a8))
(if (and (wcmatch a8 "*`-")(not (wcmatch a8 "*`-`-")))
(setq a8 (vl-string-right-trim "-" a8)
      a6 (strcat a8 a6))
(setq a6 (strcat a8 " " a6))
)
(repeat a7
(setq a6 (strcat " " a6)))
(entmod (subst (cons 1 a6)(assoc 1 a) a))
)))))))))))
(princ "nТочка за границами текста")
)))))
(setvar "OSMODE" OSMODE)
(command "_.regenall"
     "_.undo" "_e")
(setvar "CMDECHO" 1)
(princ)
)

#20 Ответ от Малявка 4 июня 2008г. 14:08:26

  • Малявка
  • Активный участник
  • На форуме с 18 января 2007г.
  • Сообщений: 274
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Денис Флюстиков
Класс! Я в восхищении!
Я тоже так хочу!

#21 Ответ от getr 4 июня 2008г. 15:46:47

  • getr
  • Восстановленный участник
  • На форуме с 20 декабря 2005г.
  • Сообщений: 22
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

СПАСИБО!Самое то.

#22 Ответ от Tarmo 5 июня 2008г. 12:53:56

  • Tarmo
  • Восстановленный участник
  • На форуме с 28 января 2005г.
  • Сообщений: 306
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Спасибо, Денис!
Мечтала об этом давно… руки так и не дошли! А тут Ваш подарок! : )

#23 Ответ от Денис Флюстиков 5 июня 2008г. 15:25:03

  • Денис Флюстиков
  • Активный участник
  • На форуме с 12 октября 2005г.
  • Сообщений: 374
  • Спасибо: 10

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Странно, что больше двух лет программа не имела отзывов (да и  кол-во просмотров темы не большой), и вдруг оказалось, что она востребована. Странно и было не понятно, как автору, это решение «узкой задачки» для себя, или нужно и другим. Странно.

#24 Ответ от Малявка 5 июня 2008г. 15:55:46

  • Малявка
  • Активный участник
  • На форуме с 18 января 2007г.
  • Сообщений: 274
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

> Денис Флюстиков
Наверное, всему свое время. Главное, чтобы вовремя.

#25 Ответ от Kosarev 6 июня 2008г. 10:03:16

  • Kosarev
  • Активный участник
  • На форуме с 14 октября 2004г.
  • Сообщений: 162
  • Спасибо: 0

Re: LISP. Разрыв (обрыв, …) строчки в указанной точке

Ну и специальный бонус для любителей «фишек»!
Вставьте нижеследующий блок в конце, перед строкой (command «_.regenall» «_.undo» «_e»)

(if (= a10 "Р")(repeat 6
  (redraw a1 2)(command "_.delay" 50)(redraw a1 1)(command "_.delay" 50)
))

Теперь при разрыве строки некоторое время будет происходить волшебство с «оторванным» хвостом…

Страницы 1 2 Далее

Чтобы отправить ответ, вы должны войти или зарегистрироваться

Рекомендуемые сообщения

Роман З

Новичок

    • Жалоба
    • Поделиться

к примеру у меня есть два полигона, у одного 600 поворотных точек у второго 150, можно ли автоматически пронумеровать вершины первого полигона (1-600) и задать нумерацию второго полигона, что бы нумерация началась с 601 до 750 

  • Цитата

Ссылка на комментарий
Поделиться на другие сайты

antochas

Новичок

    • Жалоба
    • Поделиться

Цитата

В 14.03.2020 в 22:54, aerohost сказал:

Ссылка на комментарий
Поделиться на другие сайты

Роман З

Новичок

  • Автор
    • Жалоба
    • Поделиться

почему-то выдает такую ошибку — ошибка: неверный тип аргумента: LENTITYP: nil

добавлено через 0 минут

19 часов назад, antochas сказал:

почему-то выдает такую ошибку — ошибка: неверный тип аргумента: LENTITYP: nil

  • Цитата

Ссылка на комментарий
Поделиться на другие сайты

antochas

Новичок

    • Жалоба
    • Поделиться

5 часов назад, Роман З сказал:

почему-то выдает такую ошибку — ошибка: неверный тип аргумента: LENTITYP: nil

добавлено через 0 минут

почему-то выдает такую ошибку — ошибка: неверный тип аргумента: LENTITYP: nil

В чертеже должен быть дин.блок.  В примере после вызова команды вбивали имя дин. блока «Блок_Нумерации_Makarov.D» Во вложении есть автокадовский файл «Файл», можно в нем попробовать

Ссылка на комментарий
Поделиться на другие сайты

Роман З

Новичок

  • Автор
    • Жалоба
    • Поделиться

16 часов назад, antochas сказал:

В чертеже должен быть дин.блок.  В примере после вызова команды вбивали имя дин. блока «Блок_Нумерации_Makarov.D» Во вложении есть автокадовский файл «Файл», можно в нем попробовать

у себя в проекте я создал блок. В вашем вложении все работает, а в моем почему-то выдает такую ошибку

  • Цитата

Ссылка на комментарий
Поделиться на другие сайты

antochas

Новичок

    • Жалоба
    • Поделиться

21 час назад, Роман З сказал:

у себя в проекте я создал блок. В вашем вложении все работает, а в моем почему-то выдает такую ошибку

Сложно что-то советовать, когда не знаешь ошибку)

Можете вложить свой файл?

  • Цитата

Ссылка на комментарий
Поделиться на другие сайты

Роман З

Новичок

Alex_G

Новобранец

    • Жалоба
    • Поделиться

В 11.04.2021 в 15:33, antochas сказал:

В чертеже должен быть дин.блок.

Пример.dwg

Пронумеровал без проблем с помощью динблока

  • Цитата

Ссылка на комментарий
Поделиться на другие сайты

Присоединяйтесь к обсуждению

Вы можете написать сейчас и зарегистрироваться позже.

Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.

  • Ошибка невозможно запустить игру пожалуйста убедитесь что она правильно установлена
  • Ошибка неверный тип аргумента fixnump nil
  • Ошибка невозможно запустить process failed to start параметр задан неверно
  • Ошибка неверный тип аргумента file nil
  • Ошибка невозможно запросить shsh