Ошибка no function definition nil


@nechtan3 wrote:

Hello.

I worked with .lsp below about 4 years and now it’s not working. I didn’t change the file, that error just happened. What should I do to make it work with AutoCAD 2020?


There doesnt seem to be any obvious reason for the posted code to not work in 2020. 

Is there any lisp program that works on 2020? Are there any other programs loaded at startup? 

Did the error appeared after you run the program?

Judging by the error message, the program is trying to evaluate a variable with an undefined function

((if nil
  	princ po) "nSay Hello to little friend")

Since po is not a defined function, that same error message will appear

To make it easy for everybody, debug the lisp code by using VLIDE

Command: VLIDE

Open the lisp file.

On the menu, go to Debug and choose Break on Error.

load the lisp via Ctrl+Alt+E <— very important

Go back to Autocad drawing session and run your code. if theres an error, vlide will be activated.

To see where the error on the code, go to Debug / Last Break source, the line with error will be highlghted.

Otherwise just post a sample drawing where the code does not work.

The program is to insert a block everything works fine but after running

in the command prompt it gives » ; error: no function definition: nil «

(DTR) is a function which stores the information in the list format which is provided by the user interface DCL

(defun c:getDialogInput (/ input aone )
   (setq input (DTR))
(setq aone (getpoint "nSelect pickint to insert sheet: "))
(cond				
    ((equal input  '("frptitle" "LIGHT")) progn(
						 (command "-insert" "//Mailserver/d/backup/TIT_BLOCK_FRP"   aone "" ""   0 )
				 )
     					)	
    ((equal input '("fabtitle" "LIGHT"))progn(
					       (command "-insert" "//Mailserver/d/backup/TIT_BLOCK_FAB"   aone "" ""  0 )
														))
    ((equal input '("quotitle" "LIGHT"))progn(
					      (command "-insert" "//Mailserver/d/backup/TIT_BLOCK_QUO" aone "" ""  0)
					       							))
    	         ( T (princ "Nothing")  )    
 )
 )


Edited February 23, 2015 by SLW210


Добро пожаловать!

Войдите или зарегистрируйтесь сейчас!

Войти

  1. Форумчанин

    Регистрация:
    22 сен 2014
    Сообщения:
    61
    Симпатии:
    6

    здравствуйте. стоит win7 x64+автокад сивил 2016+растер дизигнер
    помогите решить проблему, запускаю програмки с форума (гео-откос и гео_апп) а они не адекватно работают.
    произошло это как всегда неожиданно примерно в такой последовательности:
    все работало -> какое-то время не пользовался -> и на тебе «как отрезало»
    в частности гео-откос выдает: no function definition: vlax-ename->vla-object
    гео_апп не реагирует на кнопки, чертит не полилинии, а отрезки, не вставляет блоки.
    пробовал (vl-load-com) в коммандной строке вводить в ответ ничего
    пробовал (vla-get-activedocument (vlax-get-acad-object)) в ответ #<VLA-OBJECT IAcadDocument 0000000023870cf8>
    пробовал полную переустановку автокада с чистокой реестра и удалением папок ключей описанную здесь
    конечно при полной переустановке операционной системы все болезни лечатся, но как то это кардинально, да и времени тучу потратить
    может кто сталкивался с подобным?

    #1

  2. Регистрация:
    24 июн 2015
    Сообщения:
    7
    Симпатии:
    2

    Здравствуйте
    Нашли ответ на вопрос? Столкнулся с такой же ситуацией

    #2

  3. Форумчанин

    Регистрация:
    28 май 2012
    Сообщения:
    1.711
    Симпатии:
    639
    Адрес:

    Маськва

    Попробуйте прямо автору написать — BearDyugin
    Или в его соответствующие Ресурсы.

    #3

  4. Форумчанин

    Регистрация:
    30 ноя 2007
    Сообщения:
    2.680
    Симпатии:
    2.397
    Адрес:

    Сибирь

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

    #4

  5. Форумчанин

  6. Регистрация:
    24 июн 2015
    Сообщения:
    7
    Симпатии:
    2

    Сейчас попробую.Спасибо.
    Вчера половину этого перечитал, вопрос так и не решил.Два раза переставлял Cad

    — Сообщения объединены, 15 ноя 2019, Оригинальное время сообщения: 15 ноя 2019

    Подскажите не совсем понятно.В реестре нашел эти строки.Как восстанавливаются пути.Где это делается?Может поможет

    #6

  7. Форумчанин

    просто поиском найди его на диске

    #7

  8. Регистрация:
    24 июн 2015
    Сообщения:
    7
    Симпатии:
    2

    Все получилось.Ура.Но пришлось менять путь в win 64, в win 32 ничего не выходило.
    Спасибо кто помогал

    Благодарность.png

    #8

  9. Форумчанин

    видимо AutoCAD у тебя х64

    #9

  10. Регистрация:
    3 июл 2019
    Сообщения:
    1
    Симпатии:
    2

    Добрый день, у меня, после удаления Autocad 2021 и установки Civil 3D вылезла аналогичная проблема — ошибка функции VLAX-ENAME->VLA-OBJECT
    И, как следствие, я не смог произвести экспорт координат в файл.
    Собственно помогло изменение реестра как указано в ссылка

    #10


    BearDyugin и Qvinto нравится это.

Поделиться этой страницей

  1. 2014-06-16, 04:50 PM

    #1

    lisaj98052674917 is offline


    Member


    Default I’m getting this message » ; error: no function definition: nil»

    I have not don list for a while just getting back into it. so I have this lisp that makes a layer from the selected element and changes the color, and moves the selected ement to that layer, This works fine except I get this error message, «would like to know what this means» and how to fix it.
    Thanks,

    Code:

     
    (defun C:LRl (/ ent elay ldata)  ; = Move To -New Layer [and make that Layer]
      (setvar "cmdecho" 0)
      (setq
        ent   (car
         (entsel
           "nSelect object to make -New Layer for and move to it: "
         )
       )
        elay  (cdr (assoc 8 (entget ent)))
       ldata    ; Layer data without non-transferable elements
       (vl-remove-if-not
         '(lambda (x) (member (car x) '(0 100 2 70 62 6)))
         (entget (tblobjname "layer" elay))
       )    ; vl-remove-if-not & ldata
      )
      (if
        (or
          (< (strlen elay) 5) ; not a long-enough Layer name to already end in -New with anything preceding
          (/= (strcase (substr elay (- (strlen elay) 3))) "-REMV")
         ; not already on a Layer like that
        )     ; and
         (progn
           (entmake
      (subst (cons 2 (strcat elay "-REMV")"") (assoc 2 ldata) ldata)
           )    ; create Layer
           ((command "_.chprop" ent "" "_layer" (strcat elay "-REMV")) ; move object to it
      (command "._layer" "_C" "8" "*-remv*" "")
           )
         )     ; progn
      )
    ("cmdecho" 1)    ; if
    (princ)
    )

    Last edited by rkmcswain; 2014-06-18 at 02:16 PM.

    Reason: added [CODE] tags


  2. 2014-06-16, 05:11 PM

    #2

    Default Re: I’m getting this message » ; error: no function definition: nil»

    Try replacing

    Code:

     ((command "_.chprop" ent "" "_layer" (strcat elay "-REMV"))

    with

    Code:

     (setq elay (strcat elay "-REMV"))
    (command "_.chprop" ent "" "_layer" elay)

    or at least get rid of the extra open parentheses.


  3. 2014-06-16, 05:16 PM

    #3

    Default Re: I’m getting this message » ; error: no function definition: nil»

    Also should be

    Code:

     (setvar "cmdecho" 1)

    While entering a system variable at the command line to change it works it will not in lisp since «cmdecho» is not a lisp command.


  4. 2014-06-16, 06:44 PM

    #4

    lisaj98052674917 is offline


    Member


    Default Re: I’m getting this message » ; error: no function definition: nil»

    Thank you for your response, tried both suggestion and still get this error message:
    it works correctly just has this funny mesage at the end. and dont really understand why.

    PLOT

    Code:

    (defun C:LR (/ ent elay ldata)		; = Move To -New Layer [and make that Layer]
    (setvar "cmdecho" 0)  
    (setq
        ent	  (car
    	    (entsel
    	      "nSelect object to make -New Layer for and move to it: "
    	    )
    	  )
        elay  (cdr (assoc 8 (entget ent)))
        ldata				; Layer data without non-transferable elements
    	  (vl-remove-if-not
    	    '(lambda (x) (member (car x) '(0 100 2 70 62 6)))
    	    (entget (tblobjname "layer" elay))
    	  )				; vl-remove-if-not & ldata
      )
      (if
        (or
          (< (strlen elay) 5)
    			; not a long-enough Layer name to already end in -New with anything preceding
          (/= (strcase (substr elay (- (strlen elay) 3))) "-REMV")
    					; not already on a Layer like that
        )					; and
         (progn
           (entmake
    	 (subst (cons 2 (strcat elay "-REMV")) (assoc 2 ldata) ldata))	; create Layer
    ((command "_.chprop" ent "" "_layer" (strcat elay "-REMV") "" "" ""); move object to it
    (command "._layer" "_C" "8" "*-remv*" "")
    (setvar "cmdecho" 1)
           )
         )					; progn
      )					; if
    )

    Last edited by rkmcswain; 2014-06-18 at 02:17 PM.

    Reason: added [CODE] tags


  5. 2014-06-16, 07:27 PM

    #5

    Default Re: I’m getting this message » ; error: no function definition: nil»

    Try clicking the ‘Go Advanced’ button, Then pick ‘Wrap [CODE] tags around selected text’ (# symbol from menu bars) and place the lisp code inside the [CODE] tags. That makes it easier for us to test your code.

    Pasting everything that was output to the command line in response to the command may help as well.


  6. 2014-06-18, 02:24 PM

    #6

    Default Re: I’m getting this message » ; error: no function definition: nil»

    When you paste code into the edit window, please add [CODE] to the beginning and [/CODE] to the end of your code. That will cause the code to be printed in a special window/font so it’s easy to spot, copy, etc.

    Code:

    ;;; this is a sample

  7. 2014-06-20, 01:40 PM

    #7

    lisaj98052674917 is offline


    Member


    Default Re: I’m getting this message » ; error: no function definition: nil»

    Code:

    (defun C:LR (/ ent elay ldata)		; = Move To -New Layer [and make that Layer]
      (setq
        ent	  (car
    	    (entsel "nSelect object to make -New Layer for and move to it: "))
        elay  (cdr (assoc 8 (entget ent)))
        ldata ; Layer data without non-transferable elements
    	  (vl-remove-if-not
    	    '(lambda (x) (member (car x) '(0 100 2 70 62 6)))
    	    (entget (tblobjname "layer" elay))
    	  ); vl-remove-if-not & ldata
      ):
      (if
        (or
          (< (strlen elay) 5)
    	; not a long-enough Layer name to already end in -New with anything preceding
          (/= (strcase (substr elay (- (strlen elay) 3))) "-REMV"); not already on a Layer like that
        ); and
         (progn
           (entmake
    	 (subst (cons 2 (strcat elay "-REMV")) (assoc 2 ldata) ldata))	; create Layer
           (command "._layer" "_C" "8" "*-remv*" "")
           (command "_.chprop" ent	 "" "_layer" (strcat elay "-REMV") "" "" ""); move object to it
    	 
           )
        )					; progn
      )					; if
    )					; defun

  8. 2014-06-20, 01:59 PM

    #8

    Default Re: I’m getting this message » ; error: no function definition: nil»

    Try:

    Code:

    (defun C:LR (/ ent elay ldata)		; = Move To -New Layer [and make that Layer]
      (setq
        ent	  (car
    	    (entsel
    	      "nSelect object to make -New Layer for and move to it: "
    	    )
    	  )
        elay  (cdr (assoc 8 (entget ent)))
        ldata				; Layer data without non-transferable elements
    	  (vl-remove-if-not
    	    '(lambda (x) (member (car x) '(0 100 2 70 62 6)))
    	    (entget (tblobjname "layer" elay))
    	  )				; vl-remove-if-not & ldata
      )
      :
      (if
        (or
          (< (strlen elay) 5)
    					; not a long-enough Layer name to already end in -New with anything preceding
          (/= (strcase (substr elay (- (strlen elay) 3))) "-REMV")
    					; not already on a Layer like that
        )					; and
         (progn
           (entmake
    	 (subst (cons 2 (strcat elay "-REMV")) (assoc 2 ldata) ldata)
           )				; create Layer
           (command "_.chprop" ent	 "" "_layer" (strcat elay "-REMV") "" "._layer" "_C" "8" "*-remv*" ""); move object to it
         )					; progn
      )					; if
      (princ)
    )

  9. 2014-06-20, 07:59 PM

    #9

    lisaj98052674917 is offline


    Member


    Default Re: I’m getting this message » ; error: no function definition: nil»

    Is there a way to have this promt for user input for the layer it creates?


  10. 2014-06-23, 05:16 PM

    #10

    Default Re: I’m getting this message » ; error: no function definition: nil»

    Try:

    Code:

    (defun C:LR (/ str len ent elay ldata)		; = Move To -New Layer [and make that Layer]
      (setq
        str	  (getstring T "nAdd Suffix: ")
        len	  (strlen str)
        ent	  (car
    	    (entsel
    	      "nSelect object to make -New Layer for and move to it: "
    	    )
    	  )
        elay  (cdr (assoc 8 (entget ent)))
        ldata				; Layer data without non-transferable elements
    	  (vl-remove-if-not
    	    '(lambda (x) (member (car x) '(0 100 2 70 62 6)))
    	    (entget (tblobjname "layer" elay))
    	  )				; vl-remove-if-not & ldata
      )
      :
      (if
        (or
          (< (strlen elay) len)
    					; not a long-enough Layer name to already end in -New with anything preceding
          (/= (strcase (substr elay (- (strlen elay) len))) str)
    					; not already on a Layer like that
        )					; and
         (progn
           (entmake
    	 (subst (cons 2 (strcat elay str)) (assoc 2 ldata) ldata)
           )				; create Layer
           (command "_.chprop" ent	 "" "_layer" (strcat elay str) "" "._layer" "_C" "8" (strcat "*" str) ""); move object to it
         )					; progn
      )					; if
      (princ)
    )

Перейти к содержимому раздела

Форумы CADUser

Информационный портал для профессионалов в области САПР

Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.

Дерево сообщений Активные темы Темы без ответов

Страницы 1

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

#1 21 декабря 2007г. 01:59:52

  • Salina
  • Восстановленный участник
  • На форуме с 25 июля 2007г.
  • Сообщений: 14
  • Спасибо: 0

Тема: error: no function definition

Взят с форума лисп, положен в папку support, макрос на кнопку
^C^C^P(if (not (calc_dist)) (load «calc_dist.lsp»)) (calc_dist)
Сам лисп

(defun c:mlen2 (/ adoc selset layer_list init _kpblc-string-subst item sum_len)
  (vl-load-com)
  (setq  adoc  (vla-get-activedocument (vlax-get-acad-object))
  sum_len  0.0
  ) ;_ end of setq
  (vla-startundomark adoc)
  (if
    (setq ent (entsel "nУкажите примитив, с которого брать слой <Выход> : "))
     (progn
       (setq selset (ssget (list (assoc 8 (entget (car ent))))))
       (while (and selset
       (> (sslength selset) 0)
       ) ;_ end of and
   (setq item (ssname selset 0))
   (ssdel item selset)
   (setq item    (vlax-ename->vla-object item)
         sum_len (+ sum_len
        (if (vlax-property-available-p item 'length)
          (vla-get-length item)
          (cond
            ((= (strcase (vla-get-objectname item) t) "acdbarc")
             (vla-get-arclength item)
             )
            ((= (strcase (vla-get-objectname item) t) "acbcircle")
             (* pi 2.0 (vla-get-radius item))
             )
            (t 0.0)
            ) ;_ end of cond
          ) ;_ end of if
        ) ;_ end of +
         ) ;_ end of setq
   ) ;_ end of while
       (princ (rtos sum_len 2 4))
       ) ;_ end of progn
     ) ;_ end of if
  (vla-endundomark adoc)
  (princ)
  ) ;_ end of defun

И хоть убейся-выдает ошибку error: no function definition: CALC_DIST
Не подскажете, в чем может быть проблема?

#2 Ответ от Electr 21 декабря 2007г. 05:56:43

  • Electr
  • Активный участник
  • Откуда: Киргизстан / Биш
  • На форуме с 6 августа 2007г.
  • Сообщений: 241
  • Спасибо: 2

Re: error: no function definition

Исравь в программе calc_dist на mlen2

#3 Ответ от Electr 21 декабря 2007г. 06:00:07

  • Electr
  • Активный участник
  • Откуда: Киргизстан / Биш
  • На форуме с 6 августа 2007г.
  • Сообщений: 241
  • Спасибо: 2

Re: error: no function definition

Извини не в программе а в макросе. И надо чтобы файл программы назывался mlen2.lsp
^C^C^P(if (not (mlen2)) (load «mlen2.lsp»)) (mlen2)

#4 Ответ от Salina 21 декабря 2007г. 14:16:01

  • Salina
  • Восстановленный участник
  • На форуме с 25 июля 2007г.
  • Сообщений: 14
  • Спасибо: 0

Re: error: no function definition

не получается. теперь error: no function definition: MLEN2 :(

#5 Ответ от Hrenn 21 декабря 2007г. 14:30:27

  • Hrenn
  • Восстановленный участник
  • На форуме с 28 октября 2004г.
  • Сообщений: 2,016
  • Спасибо: 0

Re: error: no function definition

Файл с программой имеет имя mlen2.lsp или какое другое?

#6 Ответ от Salina 21 декабря 2007г. 14:32:02

  • Salina
  • Восстановленный участник
  • На форуме с 25 июля 2007г.
  • Сообщений: 14
  • Спасибо: 0

Re: error: no function definition

именно mlen2.lsp

#7 Ответ от Hrenn 21 декабря 2007г. 14:37:26

  • Hrenn
  • Восстановленный участник
  • На форуме с 28 октября 2004г.
  • Сообщений: 2,016
  • Спасибо: 0

Re: error: no function definition

Попробуйте вручную загрузить лисп через команду _appload
После загрузки введите с ком. строки

Если заработает — надо править макрос

#8 Ответ от Hrenn 21 декабря 2007г. 14:48:58

  • Hrenn
  • Восстановленный участник
  • На форуме с 28 октября 2004г.
  • Сообщений: 2,016
  • Спасибо: 0

Re: error: no function definition

Ещё проверить, прописан ли путь к папке Support в настройках _options

#9 Ответ от Salina 21 декабря 2007г. 14:50:44

  • Salina
  • Восстановленный участник
  • На форуме с 25 июля 2007г.
  • Сообщений: 14
  • Спасибо: 0

Re: error: no function definition

так работает, с кнопки-никак

#10 Ответ от Salina 21 декабря 2007г. 14:51:33

  • Salina
  • Восстановленный участник
  • На форуме с 25 июля 2007г.
  • Сообщений: 14
  • Спасибо: 0

Re: error: no function definition

путь к папке прописан. второй лисп работает в той же папке без проблем.

#11 Ответ от Александр Ривилис 21 декабря 2007г. 15:00:22

  • Александр Ривилис
  • Александр Ривилис
  • Активный участник
  • Откуда: Украина / Киев
  • На форуме с 15 апреля 2005г.
  • Сообщений: 8,659
  • Спасибо: 157

Re: error: no function definition

А так:

^C^C^P(if (not c:mlen2) (load "mlen2.lsp")) mlen2

Или так:

^C^C^P(if (not c:mlen2) (load "mlen2.lsp")) (c:mlen2)

?

#12 Ответ от Salina 21 декабря 2007г. 15:16:15

  • Salina
  • Восстановленный участник
  • На форуме с 25 июля 2007г.
  • Сообщений: 14
  • Спасибо: 0

Re: error: no function definition

а так работает! Спасибо!

Сообщения 12

Тему читают: 1 гость

Страницы 1

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


Добро пожаловать!

Войдите или зарегистрируйтесь сейчас!

Войти

Страница 1 из 2


  1. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    Почему может исчезать подпись точки при ее вращении. Исчезает только в процессе вращения, как только перестаешь вращать подпись снова появляется. C3D20011.

    #1


  2. АлексЮстасу

    Форумчанин

    Регистрация:
    28 май 2012
    Сообщения:
    1.776
    Симпатии:
    653
    Адрес:

    Маськва

    А что такое «подпись точки»?

    #2


  3. sergtor

    Форумчанин

    Регистрация:
    23 сен 2012
    Сообщения:
    1.705
    Симпатии:
    590
    Адрес:

    Ухта

    Blaukempt, попобуйте этот лисп (поворот метки точки вдоль линейного объекта). К сожалению не помню кто автор (спасибо ему).

    Вложения:

    #3


  4. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    Я не помню как там в c3d правильно называется. Есть метка точки а есть стиль точки. Скорее всего то что я имел ввиду это метка точки, значение отметки, описание или номер ее или все вместе сразу.

    — Сообщения объединены, 9 авг 2013, Оригинальное время сообщения: 9 авг 2013

    Спасибо! Попробую завтра. Я надеюсь вы имеете ввиду точку civil’a.

    #4


  5. sergtor

    Форумчанин

    Регистрация:
    23 сен 2012
    Сообщения:
    1.705
    Симпатии:
    590
    Адрес:

    Ухта

    Да, точку Civila. При указании линии поворота выполняется поворот точки вместе с меткой.

    Это все настраивается по вкусу.

    #5


  6. АлексЮстасу

    Форумчанин

    Регистрация:
    28 май 2012
    Сообщения:
    1.776
    Симпатии:
    653
    Адрес:

    Маськва

    Эти точки, похоже, разные бывают?
    И чем вращаете?
    Лучше бы приложили файлик с парой своих точек — попробовать. Например, в моих 2008 и 2012.

    #6


  7. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    вращаю ручкой. у точки есть есть ручка за нее и вращаю.

    — Сообщения объединены, 9 авг 2013, Оригинальное время сообщения: 9 авг 2013

    Что то у меня тот лисп не работает. Пишет no function definition nil
    А в тринадцатом получилось.

    #7


  8. sergtor

    Форумчанин

    Регистрация:
    23 сен 2012
    Сообщения:
    1.705
    Симпатии:
    590
    Адрес:

    Ухта

    Blaukempt, проверил, работает. Команда запуска Align-Point-by-Way указываем угол поворота (можно полилинию) и точки, которые хотим повернуть. По поводу пробемы с запуском: может поможет Это?

    #8


  9. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    Да работает но только не в 11-той версии.
    Автору большое спасибо. Это то что нужно когда снимаешь километры и километры автодорог. Хотя, на ж.д. тоже пригодится.

    #9


  10. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    По поводу пробемы с запуском: может поможет Это?
    А это была не проблема с запуском, он запускался, просил выбрать путь, потом точки и только после этого писал no function definition nil.

    #10


  11. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    Возвращусь опять к этому лиспу. На работе на 13-й версии С3D тоже не работает, пишет: «; ошибка: no function definition: nil». Как это исправить можно?

    #11


  12. sergtor

    Форумчанин

    Регистрация:
    23 сен 2012
    Сообщения:
    1.705
    Симпатии:
    590
    Адрес:

    Ухта

    Blaukempt, в начало кода добавили строку (vl-load-com) ? При выборе пути (оси) должна быть полилиния, а точки — объекты Civila.

    #12


  13. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    sergtor, там в коде программы видно что путем(осью) может выступать объект трасса сивила. точки конечно кого. а vl-load-com, там кажется другое сообщение было у человека:
    «Загружаю лисп, пытаюсь выполнить, а AutoCAD мне в ответ:
    no function definition: VLAX-GET-ACAD-OBJECT
    И результат нулевой. Что делать»
    И еще, я не совсем представляю где у кода начало. Перед точкой с запятой и всеми тире или уже после них.
    Ура заработала! Нашел у кода начало! Объект типа трасса как я и писал работает в качестве пути для разворота! Спасибо за помощь!

    #13


  14. ILYA162

    Регистрация:
    6 ноя 2012
    Сообщения:
    15
    Симпатии:
    0

    Скажите а можно ли подвинуть несколько подписей точек одним махом? Я выделяю несколько меток — но при попытке их перемещения двигается за синий квадрат только одна..Изменения всего стиля точек не вариант тк все равно ручками расставлять много подписей приходится..

    #14


  15. prokopchuk

    Форумчанин

    Регистрация:
    1 ноя 2012
    Сообщения:
    85
    Симпатии:
    39

    Да. Выделяете необходимы точки, затем зажимаете Shift и прощелкиваете квадраты у точек (за которые вытягиваете), они выделятся красным. Далее можно отпустить Shift и потянуть за любой выделенный.

    #15


  16. Blaukempt

    Форумчанин

    Регистрация:
    24 апр 2012
    Сообщения:
    570
    Симпатии:
    49

    Где же ты раньше был?!::apstenu::

    #16


  17. ILYA162

    Регистрация:
    6 ноя 2012
    Сообщения:
    15
    Симпатии:
    0


  18. Dimch123

    Форумчанин

    Надеюсь получиться у меня это сделать с липсами неразу не работал

    #18


  19. geOnix

    Форумчанин

    Регистрация:
    15 апр 2013
    Сообщения:
    71
    Симпатии:
    1

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

    #19


  20. FOXXX591

    Форумчанин

    Регистрация:
    19 окт 2012
    Сообщения:
    3.182
    Симпатии:
    2.505
    Адрес:

    г.Смоленск

Страница 1 из 2

Поделиться этой страницей

Topic: Nil function definition when key is pressed  (Read 2322 times)

0 Members and 1 Guest are viewing this topic.

I am working on rewriting a routine and whenever I press a key, I keep getting the following error: ** Error: no function definition: nil **

Here is the code I have so far, I am not sure what is causing this, any ideas?

Edit: I figured that out, but for some reason F10 causes an error, it doesn’t toggle polar mode.

(defun c:uleader (/ *ThisDrawing* *Space* *Scale* *IsCivil* *Path* *Prompt* *Align* *Match* *Types* Pt1 Pt2 Input Data Code Ent1 POS)
    (vl-cmdf "._-insert" "Uleader.dwg")(command); Insert in leader styles
    (setq *Types* (LIST "MTEXT" "1M08" "PL08" "AH08" "CFM" "FXU" "GPM" "PANEL" "FEEDER"))
    (vl-load-com)
    ;Supporting Functions
    (defun eraseold (obj /) ;Erases the previous version of a VLA object - Code modifcation provided by ronjonp at http://www.theswamp.org/index.php?topic=54340.msg589085#msg589085
        (and (= 'vla-object (type obj))
            (not (vlax-erased-p obj))
            (vlax-write-enabled-p obj)
            (vla-delete obj)
        )
    )
    (defun GetVportScale ()
        (/ 1 (vla-get-CustomScale (vla-get-ActivePViewport (vla-get-activedocument (vlax-get-acad-object)))))
    )
    (defun PolarRound (ang deg)
        (* (/ pi (/ 180 (r2d deg))) (fix (/ (+ (/ pi (/ 360 (r2d deg))) ang) (/ pi (/ 180 (r2d deg))))))
    )
    (defun bitcodef (value bit)
        ;; Originally Written by Lee Ambrosius on: 6/6/04
        ;; Modified by Chris Wade 1/13/2010
        (if (zerop(logand bit value))
            nil
            T
        );;
    ) ;defun bitcode
    (defun D2R (numberOfDegrees)
        (* pi (/ numberOfDegrees 180.0))
    ) ;_ end of defun
    (defun R2D (nbrOfRadians)
        (* 180.0 (/ nbrOfRadians pi))
    )
    ;End of Supporting Functions
    (setq *Path* (getvar "dwgprefix")
          *ThisDrawing* (vla-get-activedocument (vlax-get-acad-object)) ;_ Set Drawing and Space
      *Space*
            (if (zerop (vla-get-activespace *ThisDrawing*))
                (if (= (vla-get-mspace *ThisDrawing*) :vlax-true)
                    (vla-get-modelspace *ThisDrawing*) ; active VP
                    (vla-get-paperspace *ThisDrawing*)
                )
                (vla-get-modelspace *ThisDrawing*)
            )
)
(If (> (strlen *path*) 5);Determine if this is a civil drawing
(progn
(setq pos (vl-string-position (ascii "\") *Path* (+ (vl-string-position (ascii "\") *path* 5) 1)))
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))
(setq *IsCivil* T)
)
)
)
    (if (zerop (vla-get-activespace *ThisDrawing*)); Set scale
        (if (= (vla-get-mspace *ThisDrawing*) :vlax-true)
            (setq *Scale* (GetVportScale))
            (setq *Scale* 1.0)
        )
        (setq *Scale* (getvar "DimScale"))
    )
    (vla-StartUndoMark *ThisDrawing*)
    ;ERROR HANDLER
    (defun *error* (msg)
        (if mlObj
            (progn
                (vla-highlight mlObj :vlax-false)
                (EraseOld mlObj)   
            )
        )
        ;; Added by Pkenewell on 3/28/2014
        (vla-EndUndoMark *ThisDrawing*)
        (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
            (princ (strcat "n** Error: " msg " **"))
        )
        (princ)
    )
    (if (not (tblsearch "LAYER" "LEADER")) ; Check to see if layer exists
(if (= 1 (getvar "pstylemode"))
(command "._-layer" "n" "LEADER" "color" "WHITE" "" "lweight" "DEFAULT" "" "ltype" "CONTINUOUS" "" "")
(command "._-layer" "n" "LEADER" "color" "WHITE" "" "lweight" "DEFAULT" "" "ltype" "CONTINUOUS" "" "pstyle" "BLACK" "" "")
)
)
(setvar "annoautoscale" 4)
(while (not Pt1)
    (initget "Select _Select")
    (setq Pt1 (getpoint "nPick starting point of leader [Select leader]:"))
    (cond
        ((= Pt1 "Select")
            (while (not Ent1)
                (setq Ent1 "nSelect leader to modify or align to:")
                (if (not Ent1)
                    (princ "r*** You must select a leader ***")
                )
                (setq Pt1 (cadr Ent1))
            )
        )
    )
)
(if (not Ent1)
    (setq Ent1 (nentselp "" Pt1))
)
(if Ent1
    (progn ;If existing leader is selected allow for modifying or aligning to the leader
        (princ "nAdd code for modifying/aligning leader here")
    )
    (progn ;If existing leader is not selected, draw a new leader
        (while (not Pt2)
            (setq *Prompt* "rSpeciy second point [Content ")
            (if (or (not *Content*) (= *Content* ""))
                (setq *Content* "MTEXT")
            )
            (setq *Prompt* (strcat *Prompt* "(" *Content* ")"))
            (if *Note*
                (setq *Prompt* (strcat *Prompt* "/** Note **"))
                (setq *Prompt* (strcat *Prompt* "/Note"))
            )
            (if *Typ*
                (setq *Prompt* (strcat *Prompt* "/** Typical **"))
                (setq *Prompt* (strcat *Prompt* "/Typical"))
            )
            (if (not *POC*)
                (setq *Prompt* (strcat *Prompt* "/Poc(d)"))
                (setq *Prompt* (strcat *Prompt* *POC*))
            )
            (setq *prompt* (strcat *Prompt* "/Arrowheads/Exit]:"))
            (if *Align*
                (setq *Prompt* (strcat *Prompt* " " *Align*))
            )
            (if *Match*
                (setq *Prompt* (strcat *Prompt* " " *Match*))
            )
            (princ *Prompt*)
                (setq Input (grread t 4 4)
                      Data (cadr Input)
                      Code (car Input)
                )
                (cond
                    ((= Code 2);Handle all keypresses
                        (cond
                            ((= data 15); Change Orthomode when F8 is pressed
                                (if (= (getvar "orthomode") 1)
        (setvar "orthomode" 0)
        (setvar "orthomode" 1)
        )
                            )
                            ((= data 21); Toggle Polarmode when F10 is pressed
        (setvar "autosnap" (bitcodef (getvar "autosnap") 8))
        )
        ((or (= data 67) (= data 99))
            (setq POS (vl-position *Content* *Types*))
            (if (< POS (length *Types*))
                (setq *Content* (nth (+ POS 1) *Types*))
                (setq *Content* (nth 0 *Types*))
            )
        )
        )
                    )
                )
        )
    )
)
    (vla-EndUndoMark *ThisDrawing*)
)

« Last Edit: July 23, 2018, 06:27:53 PM by cmwade77 »


Logged


I think error is in string

  1. (command «._-layer» «n» «LEADER» «color» «WHITE» «» «lweight» «DEFAULT» «» «ltype» «CONTINUOUS» «» «pstyle» «BLACK» «» «»)

There is no option «pstyle» (ACAD2018):

Command: ._-layer
Current layer:  "0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile/Xref]:


Logged

Sorry for my English.


No, that one is quite correct when using style based plotting and not color based plotting and the if statement checks to make sure if style based or color based plotting is used.

No, the only issue with the posted code is pressing F10 causes an error at present. It should toggle polar snapping on and off, not cause an error.


Logged


A few things jump out:

  1. (defun bitcodef (value bit)

  2. ;; Originally Written by Lee Ambrosius on: 6/6/04

  3. ;; Modified by Chris Wade 1/13/2010

  4. nil

  5.             T

  6. );;

  7. ) ;defun bitcode

Could be written more succinctly as:


  1. (defun PolarRound (ang deg)

  2. (* (/ pi (/ 180 (r2d deg))) (fix (/ (+ (/ pi (/ 360 (r2d deg))) ang) (/ pi (/ 180 (r2d deg))))))

  3. )

  4. (defun D2R (numberOfDegrees)

  5. (* pi (/ numberOfDegrees 180.0))

  6. ) ;_ end of defun

  7. (defun R2D (nbrOfRadians)

  8. (* 180.0 (/ nbrOfRadians pi))

  9. )

These functions are not evaluated anywhere in the code and could therefore be removed.


  1. *Space*

  2. )

  3. )

This could be written more succinctly as:


This:

  1. )

Could become:


This:

  1. (setvar «autosnap» (bitcodef (getvar «autosnap») 8))

Should be changed to the following to XOR bit 8:

Since your

bitcodef

function will return a boolean value, not an integer.


An error of ‘no function definition: nil’ would indicate that you are attempting to evaluate a symbol with no value as a function, however, I can’t see anywhere in your code where this is occurring. As such, I would suggest following this process to determine the line on which the code fails.


Logged


Sorry, I should have mentioned the code is a work in progress, the functions that aren’t currently being called will be in the end code. And as always, thank you Lee, lots of great info. And I as I mentioned about, I got rid of the nil error, it was stupidity on my part not adding a (cond) that should have been there.


Logged


Hi,

Not so often… ;)

This could be written more succinctly as:


Logged

Speaking English as a French Frog


This could be written more succinctly as:

This won’t return Modelspace for an active Paperspace viewport…  :wink:


Logged


Gile, your code is a very close second to Lee’s as to how often it appears in our routines. Honestly, I think you have had some solutions that no one else could have solved. In the end this will be a complex piece of code, but I hope to get it working more reliably than my old uleader routine, so starting off with these recommendations is very helpful.


Logged


Sorry, I should have mentioned the code is a work in progress, the functions that aren’t currently being called will be in the end code. And as always, thank you Lee, lots of great info. And I as I mentioned about, I got rid of the nil error, it was stupidity on my part not adding a (cond) that should have been there.

You’re welcome Chris, the F10 issue should be solved when you implement my suggestion:


Logged


Ok, I have implemented several of the recommendations so far and made some tweaks, as well as added some additional code, so here is where things stand now:

(defun c:uleader (/ *ThisDrawing* *Space* *Scale* *IsCivil* *Path* *Prompt* *Align* *Match* *Types* *Style* *POC* *POCS* *Typ* *Note* Pt1 Pt2 Input Data Code Ent1 POS Pt1Tst)
    (vl-cmdf "._-insert" "Uleader.dwg")(command); Insert in leader styles
    (setq *Types* (LIST "MTEXT" "1M08" "PL08" "AH08" "CFM" "FXU" "GPM" "PANEL" "FEEDER")
          *POCS* (list nil "-Poc" "-Pod")
    )
    (vl-load-com)
    ;Supporting Functions
    (defun eraseold (obj /) ;Erases the previous version of a VLA object - Code modifcation provided by ronjonp at http://www.theswamp.org/index.php?topic=54340.msg589085#msg589085
        (and (= 'vla-object (type obj))
            (not (vlax-erased-p obj))
            (vlax-write-enabled-p obj)
            (vla-delete obj)
        )
    )
    (defun GetVportScale ()
        (/ 1 (vla-get-CustomScale (vla-get-ActivePViewport (vla-get-activedocument (vlax-get-acad-object)))))
    )
    (defun PolarRound (ang deg)
        (* (/ pi (/ 180 (r2d deg))) (fix (/ (+ (/ pi (/ 360 (r2d deg))) ang) (/ pi (/ 180 (r2d deg))))))
    )
    (defun D2R (numberOfDegrees)
        (* pi (/ numberOfDegrees 180.0))
    ) ;_ end of defun
    (defun R2D (nbrOfRadians)
        (* 180.0 (/ nbrOfRadians pi))
    )
    ;End of Supporting Functions
    (setq *Path* (getvar "dwgprefix")
          *ThisDrawing* (vla-get-activedocument (vlax-get-acad-object)) ;_ Set Drawing and Space
      *Space* (vlax-get-property *ThisDrawing* (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)); Code adjustment from Lee Mac at: http://www.theswamp.org/index.php?topic=54349.msg589159#msg589159
      *Scale* (if (zerop (vla-get-activespace *ThisDrawing*))
                        (if (= (vla-get-mspace *ThisDrawing*) :vlax-true)
                            (GetVportScale)
                            1.0
                        )
                        (getvar "DimScale")
                  )
)
(If (> (strlen *path*) 5);Determine if this is a civil drawing
(progn
(setq pos (vl-string-position (ascii "\") *Path* (+ (vl-string-position (ascii "\") *path* 5) 1)))
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))
    (setq *IsCivil* T)
)
)
)
    (if (zerop (vla-get-activespace *ThisDrawing*)); Set scale
        (if (= (vla-get-mspace *ThisDrawing*) :vlax-true)
            (setq *Scale* (GetVportScale))
            (setq *Scale* 1.0)
        )
        (setq *Scale* (getvar "DimScale"))
    )
    (vla-StartUndoMark *ThisDrawing*)
    ;ERROR HANDLER
    (defun *error* (msg)
        (if mlObj
            (progn
                (vla-highlight mlObj :vlax-false)
                (EraseOld mlObj)   
            )
        )
        ;; Added by Pkenewell on 3/28/2014
        (vla-EndUndoMark *ThisDrawing*)
        (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
            (princ (strcat "n** Error: " msg " **"))
        )
        (princ)
    )
    (if (not (tblsearch "LAYER" "LEADER")) ; Check to see if layer exists
(if (= 1 (getvar "pstylemode"))
(command "._-layer" "n" "LEADER" "color" "WHITE" "" "lweight" "DEFAULT" "" "ltype" "CONTINUOUS" "" "")
(command "._-layer" "n" "LEADER" "color" "WHITE" "" "lweight" "DEFAULT" "" "ltype" "CONTINUOUS" "" "pstyle" "BLACK" "" "")
)
)
(setvar "annoautoscale" 4)
(while (not Pt1)
    (initget "Select _Select")
    (setq Pt1 (getpoint "nPick starting point of leader [Select leader]:"))
    (cond
        ((= Pt1 "Select")
            (while (not Ent1)
                (setq Ent1 "nSelect leader to modify or align to:")
                (if (not Ent1)
                    (princ "r*** You must select a leader ***")
                )
                (setq Pt1 (cadr Ent1))
            )
        )
    )
)
(if (not Ent1)
    (setq Ent1 (nentselp "" Pt1))
)
(if Ent1
    (progn ;If existing leader is selected allow for modifying or aligning to the leader
        (princ "nAdd code for modifying/aligning leader here")
    )
    (progn ;If existing leader is not selected, draw a new leader
        (while (not Pt2)
        (if (or (not *Content*) (= *Content* ""))
                (setq *Content* (nth 0 *Types*))
            )
            (If (= *Content* "MTEXT")
                (progn
                    (if *IsCivil*
                        (setq *Arrowheads* (list "CIVIL" "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1" "BEISPL"))
                        (setq *Arrowheads* (list "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1" "BEISPL"))
                    )
                )
                (progn
                    (if *IsCivil*
                        (setq *Arrowheads* (list "CIVIL" "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1"))
                        (setq *Arrowheads* (list "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1"))
                    )
                )
            )
            (setq *Prompt* (strcat "rSpecify second point [Content (" *Content* ")"))
            (if (or (not *Style*) (= *Style* ""))
                (setq *Style* (nth 0 *Arrowheads*))
            )
            (if (and (/= *Content* "1M08") (/= *Content* "MTEXT"))
                (progn
                    (if *Note*
                        (setq *Prompt* (strcat *Prompt* "/** Note **"))
                        (setq *Prompt* (strcat *Prompt* "/Note"))
                    )
                    )
                )
                (if (/= *Content* "MTEXT")
                (progn
                    (if *Typ*
                        (setq *Prompt* (strcat *Prompt* "/** Typical **"))
                        (setq *Prompt* (strcat *Prompt* "/Typical"))
                    )
                    )
                )
            (if (not *POC*)
                (setq *Prompt* (strcat *Prompt* "/Poc(d)"))
                (setq *Prompt* (strcat *Prompt* "/" (substr *POC* 2)))
            )
            (setq *prompt* (strcat *Prompt* "/Arrowheads (" *Style* ")/Exit]:"))
           
            (if *Align*
                (setq *Prompt* (strcat *Prompt* " " *Align*))
            )
            (if *Match*
                (setq *Prompt* (strcat *Prompt* " " *Match*))
            )
            (princ *Prompt*)
                (setq Input (grread t 4 4)
                      Data (cadr Input)
                      Code (car Input)
                )
                (cond
                    ((= Code 2);Handle all keypresses
                        (cond
                            ((= data 15); Change Orthomode when F8 is pressed
                                ;Code adjustment from Lee at http://www.theswamp.org/index.php?topic=54349.msg589159#msg589159
                                (setvar 'orthomode (- 1 (getvar 'orthomode)))
                            )
                            ((= data 21); Toggle Polarmode when F10 is pressed
                                ;Code adjustment from Lee at http://www.theswamp.org/index.php?topic=54349.msg589159#msg589159
        (setvar 'autosnap (boole 6 8 (getvar 'autosnap)))
        )
        ((or (= data 65) (= data 97)); Change arrowheads when A is pressed
            (setq POS (vl-position *Style* *Arrowheads*))
            (if (< POS (length *Arrowheads*))
                (setq *Style* (nth (+ POS 1) *Arrowheads*))
                (setq *Style* (nth 0 *Arrowheads*))
            )
        )
        ((or (= data 67) (= data 99)); Change content when C is pressed
            (setq POS (vl-position *Content* *Types*))
            (if (< POS (length *Types*))
                (setq *Content* (nth (+ POS 1) *Types*))
                (setq *Content* (nth 0 *Types*))
            )
        )
        ((or (= data 80) (= data 112)); Cycle through Point of connection/disconnection when P is pressed
            (setq POS (vl-position *POC* *POCS*))
            (if (< POS (length *POCS*))
                (setq *POC* (nth (+ POS 1) *POCS*))
                (setq *POC* (nth 0 *POCS*))
            )
        )
        ((and (or (= data 78) (= data 110)) (/= *Content* "1M08") (/= *Content* "MTEXT")); Change Note when N is pessed
            (if *Note*
                (setq *Note* nil)
                (setq *Note* T)
            )
        )
        ((and (or (= data 84) (= data 116)) (/= *Content* "MTEXT")); Change Typical when T is pessed
            (if *Typ*
                (setq *Typ* nil)
                (setq *Typ* T)
            )
        )
        )
                    )
                )
        )
    )
)
    (vla-EndUndoMark *ThisDrawing*)
)

I will have more changes coming, but I am wondering if there are things I can do to simplify this code further.


Logged


As promised, here is more, for some reason when I put the style to the leader, the leader always ends at 0,0, does anyone have an idea as to why?

(defun c:uleader (/ *ThisDrawing* *Space* *Scale* *IsCivil* *Path* *Prompt* *Align* *Match* *Types* *Style* *POC* *POCS* *Typ* *Note* *NewPoints* *MlObj* Pt1 Pt2 FxPt Input Data Code Ent1 POS Pt1Tst)
    (vl-cmdf "._-insert" "Uleader.dwg")(command); Insert in leader styles
    (setq *Types* (LIST "MTEXT" "1M08" "PL08" "AH08" "CFM" "FXU" "GPM" "PANEL" "FEEDER")
          *POCS* (list nil "-Poc" "-Pod")
    )
    (vl-load-com)
    ;Supporting Functions
    (defun eraseold (obj /) ;Erases the previous version of a VLA object - Code modifcation provided by ronjonp at http://www.theswamp.org/index.php?topic=54340.msg589085#msg589085
        (and (= 'vla-object (type obj))
            (not (vlax-erased-p obj))
            (vlax-write-enabled-p obj)
            (vla-delete obj)
        )
    )
    (defun GetVportScale ()
        (/ 1 (vla-get-CustomScale (vla-get-ActivePViewport (vla-get-activedocument (vlax-get-acad-object)))))
    )
    (defun PolarRound (ang deg)
        (* (/ pi (/ 180 (r2d deg))) (fix (/ (+ (/ pi (/ 360 (r2d deg))) ang) (/ pi (/ 180 (r2d deg))))))
    )
    (defun D2R (numberOfDegrees)
        (* pi (/ numberOfDegrees 180.0))
    ) ;_ end of defun
    (defun R2D (nbrOfRadians)
        (* 180.0 (/ nbrOfRadians pi))
    )
    ;End of Supporting Functions
    (setq *Path* (getvar "dwgprefix")
          *ThisDrawing* (vla-get-activedocument (vlax-get-acad-object)) ;_ Set Drawing and Space
      *Space* (vlax-get-property *ThisDrawing* (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)); Code adjustment from Lee Mac at: http://www.theswamp.org/index.php?topic=54349.msg589159#msg589159
      *Scale* (if (zerop (vla-get-activespace *ThisDrawing*))
                        (if (= (vla-get-mspace *ThisDrawing*) :vlax-true)
                            (GetVportScale)
                            1.0
                        )
                        (getvar "DimScale")
                  )
)
(setq newpoints (vlax-make-safearray vlax-vbDouble '(1 . 6)))
(If (> (strlen *path*) 5);Determine if this is a civil drawing
(progn
(setq pos (vl-string-position (ascii "\") *Path* (+ (vl-string-position (ascii "\") *path* 5) 1)))
(If (or (= (strcase (substr *path* (+ pos 8) 1)) "C") (= (getvar "USERS5") "CIVIL"))
    (setq *IsCivil* T)
)
)
)
    (if (zerop (vla-get-activespace *ThisDrawing*)); Set scale
        (if (= (vla-get-mspace *ThisDrawing*) :vlax-true)
            (setq *Scale* (GetVportScale))
            (setq *Scale* 1.0)
        )
        (setq *Scale* (getvar "DimScale"))
    )
    (vla-StartUndoMark *ThisDrawing*)
    ;ERROR HANDLER
    (defun *error* (msg)
        (if mlObj
            (progn
                (vla-highlight mlObj :vlax-false)
                (EraseOld mlObj)   
            )
        )
        ;; Added by Pkenewell on 3/28/2014
        (vla-EndUndoMark *ThisDrawing*)
        (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
            (princ (strcat "n** Error: " msg " **"))
        )
        (princ)
    )
    (if (not (tblsearch "LAYER" "LEADER")) ; Check to see if layer exists
(if (= 1 (getvar "pstylemode"))
(command "._-layer" "n" "LEADER" "color" "WHITE" "" "lweight" "DEFAULT" "" "ltype" "CONTINUOUS" "" "")
(command "._-layer" "n" "LEADER" "color" "WHITE" "" "lweight" "DEFAULT" "" "ltype" "CONTINUOUS" "" "pstyle" "BLACK" "" "")
)
)
(setvar "annoautoscale" 4)
(while (not Pt1)
    (initget "Select _Select")
    (setq Pt1 (getpoint "nPick starting point of leader [Select leader]:"))
    (cond
        ((= Pt1 "Select")
            (while (not Ent1)
                (setq Ent1 "nSelect leader to modify or align to:")
                (if (not Ent1)
                    (princ "r*** You must select a leader ***")
                )
                (setq Pt1 (cadr Ent1))
            )
        )
    )
)
(vlax-safearray-put-element newpoints 1 (car pt1))
(vlax-safearray-put-element newpoints 2 (cadr pt1))
(vlax-safearray-put-element newpoints 3 (caddr pt1))
(if (not Ent1)
    (setq Ent1 (nentselp "" Pt1))
)
(if Ent1
    (if (/= (cdr (assoc 0 (entget (car Ent1)))) "MULTILEADER")
        (progn
            (setq *STYLE* "BEIOB-R1"
                  Ent1 nil
            )
        )
        (setq *STYLE* "BEINOB-R1")
    )
    (setq *STYLE* "BEINOB-R1")
)
(if Ent1
    (progn ;If existing leader is selected allow for modifying or aligning to the leader
        (princ "nAdd code for modifying/aligning leader here")
    )
    (progn ;If existing leader is not selected, draw a new leader
        (while (not Pt2)
        (if (or (not *Content*) (= *Content* ""))
                (setq *Content* (nth 0 *Types*))
            )
            (If (= *Content* "MTEXT")
                (progn
                    (if *IsCivil*
                        (setq *Arrowheads* (list "CIVIL" "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1" "BEISPL"))
                        (setq *Arrowheads* (list "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1" "BEISPL"))
                    )
                )
                (progn
                    (if *IsCivil*
                        (setq *Arrowheads* (list "CIVIL" "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1"))
                        (setq *Arrowheads* (list "BEIOB-R1" "BEINOB-R1" "BOX-R1" "LOOP-R1"))
                    )
                )
            )
            (setq *Prompt* (strcat "rSpecify second point [Content (" *Content* ")"))
            (if (or (not *Style*) (= *Style* ""))
                (setq *Style* (nth 0 *Arrowheads*))
            )
            (if (and (/= *Content* "1M08") (/= *Content* "MTEXT"))
                (progn
                    (if *Note*
                        (setq *Prompt* (strcat *Prompt* "/** Note **"))
                        (setq *Prompt* (strcat *Prompt* "/Note"))
                    )
                    )
                )
                (if (/= *Content* "MTEXT")
                (progn
                    (if *Typ*
                        (setq *Prompt* (strcat *Prompt* "/** Typical **"))
                        (setq *Prompt* (strcat *Prompt* "/Typical"))
                    )
                    )
                )
            (if (not *POC*)
                (setq *Prompt* (strcat *Prompt* "/Poc(d)"))
                (setq *Prompt* (strcat *Prompt* "/" (substr *POC* 2)))
            )
            (setq *prompt* (strcat *Prompt* "/Arrowheads (" *Style* ")]:"))
           
            (if *Align*
                (setq *Prompt* (strcat *Prompt* " " *Align*))
            )
            (if *Match*
                (setq *Prompt* (strcat *Prompt* " " *Match*))
            )
            (princ *Prompt*)
                (setq Input (grread t 4 4)
                      Data (cadr Input)
                      Code (car Input)
                )
                (cond
                    ((= Code 2);Handle all keypresses
                        (cond
                            ((= data 15); Change Orthomode when F8 is pressed
                                ;Code adjustment from Lee at http://www.theswamp.org/index.php?topic=54349.msg589159#msg589159
                                (setvar 'orthomode (- 1 (getvar 'orthomode)))
                            )
                            ((= data 21); Toggle Polarmode when F10 is pressed
                                ;Code adjustment from Lee at http://www.theswamp.org/index.php?topic=54349.msg589159#msg589159
        (setvar 'autosnap (boole 6 8 (getvar 'autosnap)))
        )
        ((or (= data 65) (= data 97)); Change arrowheads when A is pressed
            (setq POS (vl-position *Style* *Arrowheads*))
            (if (< POS (length *Arrowheads*))
                (setq *Style* (nth (+ POS 1) *Arrowheads*))
                (setq *Style* (nth 0 *Arrowheads*))
            )
        )
        ((or (= data 67) (= data 99)); Change content when C is pressed
            (setq POS (vl-position *Content* *Types*))
            (if (< POS (length *Types*))
                (setq *Content* (nth (+ POS 1) *Types*))
                (setq *Content* (nth 0 *Types*))
            )
        )
        ((or (= data 80) (= data 112)); Cycle through Point of connection/disconnection when P is pressed
            (setq POS (vl-position *POC* *POCS*))
            (if (< POS (length *POCS*))
                (setq *POC* (nth (+ POS 1) *POCS*))
                (setq *POC* (nth 0 *POCS*))
            )
        )
        ((and (or (= data 78) (= data 110)) (/= *Content* "1M08") (/= *Content* "MTEXT")); Change Note when N is pessed
            (if *Note*
                (setq *Note* nil)
                (setq *Note* T)
            )
        )
        ((and (or (= data 84) (= data 116)) (/= *Content* "MTEXT")); Change Typical when T is pessed
            (if *Typ*
                (setq *Typ* nil)
                (setq *Typ* T)
            )
        )
        )
                    )
                    ((= Code 5)
                        (setq FxPt (trans data 1 0))
                        (EraseOld *MlObj*)
                        (vlax-safearray-put-element newpoints 4 (car FxPt))
(vlax-safearray-put-element newpoints 5 (cadr FxPt))
(vlax-safearray-put-element newpoints 6 (caddr FxPt))
(setq *MlObj* (vla-AddMleader *Space* newpoints 0))
(vla-put-stylename *MlObj* *Style*);Something appears to be wrong with this line, it causes the leader to always end at 0,0
(vla-put-layer *MlObj* "LEADER")
                    )
                )
        )
    )
)
    (vla-EndUndoMark *ThisDrawing*)
)


Logged


  • Home
  • Forum
  • Discussions and Support
  • Programming
  • AutoLISP
  • «No function definition» After COMMAND Call

  1. 2015-10-01, 05:58 PM


    #1

    Question «No function definition» After COMMAND Call

    Hey All,

    Simple little problem, lisp works fine, but I get an annoying «error: no function definition: nil».

    I know this line of code returns nil, but I don’t know how to stop the error… Any ideas?

    Code:

    (command "_.shademode" "G")

    Full lisp (to toggle wireframe/shaded modes):

    Code:

    (defun c:togglevs (/ cvs)       (setq cvs
    	      (assoc 281 (entget (tblobjname "VPORT" "*ACTIVE")))
    	     )
      (setq cvs (cdr cvs))
      
      (cond
        (
         (OR
         (= cvs 0)
         (= cvs 1)
         (= cvs 2)
         )
         (
          (command "_.shademode" "G")
          (prompt "Toggling to Shaded mode")
          )
         )
        (
         (OR
         (= cvs 4)
         (= cvs 6)
         )
         (
          (command "_.shademode" "3D")
          (prompt "Toggling to Wireframe mode")
          )
         )
        )
      (princ)
      )


  2. 2015-10-01, 07:46 PM


    #2

    Default Re: «No function definition» After COMMAND Call

    I guess you have an extra parenthesis before that command call which is no needed.


  3. 2015-10-01, 07:55 PM


    #3

    Default Re: «No function definition» After COMMAND Call

    Quote Originally Posted by Tharwat
    View Post

    I guess you have an extra parenthesis before that command call which is no needed.

    That parentheses wraps the «command» and «prompt» statements together as the «then» part of the COND statement.

    Code:

    (
       (command "_.shademode" "G")
       (prompt "Toggling to Shaded mode")
    )


  4. 2015-10-01, 08:01 PM


    #4

    Default Re: «No function definition» After COMMAND Call

    Quote Originally Posted by stusic
    View Post

    That parentheses wraps the «command» and «prompt» statements together as the «then» part of the COND statement.

    Code:

    (
       (command "_.shademode" "G")
       (prompt "Toggling to Shaded mode")
    )

    That is not needed with cond function nor even the progrn function


  5. 2015-10-01, 08:34 PM


    #5

    Default Re: «No function definition» After COMMAND Call

    Quote Originally Posted by Tharwat
    View Post

    That is not needed with cond function nor even the progrn function

    How would I separate the «ifs» from the «thens»?


  6. 2015-10-01, 08:35 PM


    #6

    Default Re: «No function definition» After COMMAND Call

    Try this UNTESTED :

    Code:

    (defun c:togglevs (/ cvs)
      (if (setq csv (tblobjname "VPORT" "*ACTIVE"))
        (setq cvs (cdr (assoc 281 (entget csv))))
      )
      (cond
        ((<= 0 cvs 2)
         (command "_.shademode" "G")
         (prompt "Toggling to Shaded mode")
        )
        (
         (OR
           (= cvs 4)
           (= cvs 6)
         )
         (command "_.shademode" "3D")
         (prompt "Toggling to Wireframe mode")
        )
      )
      (princ)
    )


  7. 2015-10-01, 08:55 PM


    #7

    Default Re: «No function definition» After COMMAND Call

    Interesting.

    I tried your code: works.
    I tried my code, but removed the parentheses as you suggested: works.

    Note: I see now how the COND statement still works without the parentheses. Thanks


  8. 2015-10-01, 09:05 PM


    #8

    Default Re: «No function definition» After COMMAND Call

    Quote Originally Posted by stusic
    View Post

    Interesting.

    I tried your code: works.
    I tried my code, but removed the parentheses as you suggested: works.

    Note: I see now how the COND statement still works without the parentheses. Thanks

    Excellent. You’re welcome.


  • Home
  • Forum
  • Discussions and Support
  • Programming
  • AutoLISP
  • «No function definition» After COMMAND Call

Similar Threads

  1. Replies: 9

    Last Post: 2014-06-23, 05:16 PM

  2. Replies: 2

    Last Post: 2010-04-20, 12:09 PM

  3. Replies: 3

    Last Post: 2008-04-30, 02:20 PM

  4. Replies: 41

    Last Post: 2007-11-20, 12:32 AM

  5. Replies: 39

    Last Post: 2005-11-04, 08:22 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  • BB code is On
  • Smilies are On
  • [IMG] code is On
  • [VIDEO] code is On
  • HTML code is Off

Forum Rules

Сайт autocad.ru / caduser.ru, к сожалению, иногда «переезжает». При этом теряется масса интереснейших вещей. С большим трудом я нашел функцию от Эдуарда (пока он лиспом еще занимался), показывающую все внутренности dwg (ссылка на данный момент)

Иногда бывает полезно заглянуть в потроха рисунка smile:)
Программка до ужаса простая. Тупо перебирает метки
переводя их из шестнадцатеричной системы исчисления в десятичную и обратно.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

;;;Функция преобразования числа из шестнадцатиричной в десятичную систему исчисления
;;;аргументы :
;;;а — число в шестнадцатиричной системе исчисления , тип string
;;;переменные:
;;;listst — список степеней числа 16. Длина списка равна количеству символов аргумента
(defun hdec (a / i listst)
  (setq i (strlen a))
  (repeat i
    (setq listst (cons (expt 16 (1 i)) listst))
    (setq i (1 i))
    ) ;_ end of repeat
  (rtos
    (apply
      (function +)
      (mapcar
        (function *)
        (reverse
          (mapcar
            (function
              (lambda (x)
                (cond
                  (
                   (vl-symbolp (read (chr x)))
                   (+ (vl-position (chr x)(«A» «B» «C» «D» «E» «F»))
                      10
                      ) ;_ end of +
                   )
                  (t
                   (atoi (chr x))
                   )
                  ) ;_ end of cond
                ) ;_ end of lambda
              ) ;_ end of function
            (vlstring->list a)
            ) ;_ end of mapcar
          ) ;_ end of reverse
        (mapcar (function float) listst)
        ) ;_ end of mapcar
      ) ;_ end of apply
    ) ;_ end of rtos
  ) ;_ end of defun

;;;Функция преобразования числа из десятичной в шестнадцатиричную систему исчисления.
;;;Аргументы:
;;;b- число в десятичной системе исчисления , тип integer
;;;Переменные:
;;;blist — число в шестнадцатеричной системе исчисления , тип string
(defun dech (b / blist list16)
  (setq list16 ‘(«0» «1» «2» «3» «4» «5» «6» «7» «8» «9» «A» «B» «C» «D» «E» «F»))
  (while (>= b 16)
    (setq blist (cons (fix (rem b 16)) blist)
          b     (fix (/ b 16.00))
          ) ;_ end of setq
    ) ;_ end of while
  (apply (function strcat)
         (mapcar(function(lambda (x)
                    (nth x list16)
                    ))
                 (setq blist (cons b blist))
                 ) ;_ end of mapcar
         ) ;_ end of apply
  ) ;_ end of defun

;;; Функция экспорта базы данных рисунка в текстовой файл. Производит поиск графических и не графических примитивов в
;;; базе
;;; рисунка
;;;перебирая метки с 1 до метки последнего созданного примитива , выводит свойства примитивов в текстовой файл
;;; в виде :  «класс объекта»  «метка»  «метка в десятичном представлении» «имя объекта» (при его наличии)
;;; аргументов нет
;;; переменные :
;;;filename — имя файла вывода данных
;;;dsk — дескриптор файла
;;;lp — имя последнего созданного примитива
;;;m — метка примитива
;;;lm — список меток
(defun es_export_database (/ lm filename dsk lp m)
  (setq i 1)
  (if (and
        (setq filename (getfiled «Файл вывода « «C:« «xls» 1))
          ;имя файла вывода
        (setq dsk (open filename «
a«)) ;дескриптор файла
        (setq lp (entmakex ‘((0 . «
point«) (10 0 0 0))))
          ; создаем примитив для определения количества повторов цикла перебора меток
        ) ;_ end of and
    (progn
      (repeat (1- (atoi (h-dec (cdr (assoc 5 (entget lp))))))
          ;цикл перебора меток
        (if
          (setq m (handent (dec-h i)))
           (setq lm (cons m lm)) ; список содержащий метки существующих в чертеже примитивов
           ) ;_ end of if
        (setq i (1+ i)
              ) ;_ end of setq
        ) ;_ end of repeat
      (entdel lp) ; удаляем рабочий примитив
      (mapcar
        ‘(lambda (x / nam prn)
           (setq prn (strcat (vla-get-objectname x)
                             «
t«
                             (vla-get-handle x)
                             «
t«
                             (h-dec (vla-get-handle x))
                             «
t«
                             (rtos (vla-get-objectid x) 2 0)
                             «
t«
                             ) ;_ end of strcat
                 ) ;_ end of setq
           (if
             (and
               (vlax-property-available-p x ‘name)
               (not (vl-catch-all-error-p
                      (setq
                        nam (vl-catch-all-apply ‘vla-get-name (list x))
                        ) ;_ end of setq
                      ) ;_ end of vl-catch-all-error-p
                    ) ;_ end of not
               ) ;_ end of and
              (setq prn (strcat prn nam «
t«))
              (setq prn (strcat prn «
t«))
              ) ;_ end of if
           (princ (strcat prn «
n«) dsk)
           ) ;_ end of lambda
        (vl-remove ‘nil
                   (mapcar ‘vlax-ename->vla-object (reverse lm))
                   ) ;_ end of vl-remove
        ) ; функция печати данных примитива в файл
      (close dsk)
      ) ;_ end of progn
    ) ;_ end of if
  ) ;_ end of defun

Issue

You saw an error containing the text No function definition.

You may have received one of several possible No function definition errors. The exact ones we’ve chronicled are listed in the Solution below.

Cause

A No function definition error is the result of a function within the software that can’t be completed (in other words, it’s not defined). The solution will depend on the function that’s not being defined.

Solution

Step 1: Restart your computer.

Simply restarting can sometimes clear up the error. Try opening CAD after restarting. If you don’t see a No function definition error, you’ve resolved the issue.

Still seeing a No function definition error after restarting your computer? Move on to the specific error message troubleshooting steps below.

Step 2 (if necessary): Troubleshoot your specific No function definition error message.

If restarting your computer didn’t resolve the error, your solution will depend on the exact text within the No function definition error you’re seeing:

• Error: No function definition: WM:COMMAND-WILL-START

This error is the result of custom civil engineering objects that the Canadian firm GHD attaches to its drawings. This practice allows GHD to implement precautions such as preventing users from deleting or moving critical utilities. However, this method of adding this functionality does not follow programming best practices, and essentially makes the file unusable by other firms.

Complete the following steps to clean these custom objects.

1. Open the CAD Options dialog box by typing Options or Op in the Command line and pressing Enter.

2. In the Options dialog box, select the Open and Save Tab. Then set the Demand load ObjectARX apps menu to Command invoke.

3. Open the problematic file.

4. Copy and paste the following text into the Command line, making sure to include all the parentheses:
(dictremove (namedobjdict) «VL-REACTORS»)

5. Press Enter.

6. Immediately run our Nuke tool on the file.

The reactor should now be removed from the file, and you can work with it as you would normally.

Close

• Error: No function definition: vlax-vla-object->ename

• Error: No function definition: vlax-ename->vla-object

• Error: No function definition: VLR-DWG-Reactor

If you received any of these three no function definition errors, your AutoCAD installation is likely configured improperly. The exact cause of these errors is unknown, although they may result from having multiple versions of AutoCAD on your computer.

To resolve the issue:

1. Download the zip file linked below.

Download the file to a location where you can easily find it, such as your desktop.

2. Locate and double-click the downloaded file vlax-ename fix.reg.zip.

3. You’ll now see the Registry Editor warning message pictured to the right. Click Yes.

We are the source of the information referenced in the message, and yes, you can trust us.

4. You’ll now have a file named vlax-ename fix.reg in that same location. Double-click this file.

You may need to run this file as an administrator.

5. Restart CAD.

6. Attempt the same action that generated the error. If you don’t see the error, you’ve resolved the issue.

Still getting the error? Move on to the next step.

7. Check whether you have multiple versions of AutoCAD or F/X CAD installed. If you have an older version installed, follow our steps to uninstall that version. Do not reinstall that older version.

8. Once you’re sure you only have one version of AutoCAD or F/X CAD (the version you want to use) installed, follow our steps to reinstall that version.

For example, if you got the error while trying to use F/X CAD 2018, repair F/X CAD 2018 after removing any older versions.

Problems installing? You may need to disable your antivirus software temporarily while installing AutoCAD or F/X CAD. Don’t forget to enable it once the installer finishes.

AutoCAD includes myriad add-on libraries. If you’re curious, take a look in the folder C:/Program Files/Autocad on your computer. The error may be a result of a problem with one of the following files in that folder: vlreac.dll, vllib.dll, or vlcom.dll.We have been unable to resolve this issue by copying these files over, and these files are not self-registering DLL files, which leaves reinstalling as the only viable solution.

Close

• Error: No function definition: dcl-form-show

This error is the result of a problem with the OpenDCL function. You can easily resolve it by following our steps to reinstall OpenDCL.

Close

• Error: No function definition: (command name)

Examples include:

— Error: No function definition: projectplants

— Error: No function definition: defineworkarea

The exact text of this error message will depend on the command or tool you attempted to use when you received the error. Examples include:

  • Error: No function definition: projectplants: You would have received this error when clicking on a plant.
  • Error: No function definition: defineworkarea: You would have received this error when attempting to open our New Work Area tool.

A similar No function definition error means the file LandFX.vlx was not able to load, but your menu loaded successfully. This issue can occur when:

• The file LandFX.vlx is stored in the LandFX folder on your office server, and the server connection is bad.

If so, ask your IT Admin to troubleshoot your Land F/X installation.

If you are not using our software with an office server, or if your IT admin has determined that your server connection is functioning properly, the issue may be occurring because:

• The file LandFX.vlx is lost, damaged, or missing.

If so, you can resolve the issue by reverting the LandFX.vlx file to the previous version:

1. Locate the file LandFX.vlx in your LandFX folder. Rename this file, giving it the name LandFX.vlx.old

2. Locate the file LandFX.vlx.bak in the same location. Rename this file, giving it the name LandFX.vlx

Close

Понравилась статья? Поделить с друзьями:
  • Ошибка no entry cfgworlds
  • Ошибка nissan 0110
  • Ошибка net runtime 1023
  • Ошибка net helpmsg 3547
  • Ошибка net framework при установке автокад