How to write Sub Functions in AutoLISP

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024

Комментарии • 8

  • @cyberCADsolutions
    @cyberCADsolutions  2 года назад +2

    ; Using Sub Functions in AutoLISP
    ; Program to calculate ncr value = n!/((n-r)!xr!)
    (defun c:ncr(/ n r nFact rFact nMrFact)
    (setq n 4
    r 2
    )
    (setq nFact (getFact n))
    (setq rFact (getFact r))
    (setq nMrFact (getFact (- n r)))

    (setq ncr (/ nFact (* nMrFact rFact)))
    (alert (rtos ncr 2 2))
    );end
    ; Subfunction to calculate the factorial value
    (defun getFact (i / counter fact)
    (setq counter i
    fact 1
    )
    (while (> counter 1)
    (setq fact (* fact counter))
    (setq counter (1- counter))
    );while
    fact
    );end

  • @soumitratewari483
    @soumitratewari483 2 года назад +1

    Thanks for the video. Please upload more 🙂

  • @engHamdy07
    @engHamdy07 2 года назад

    Do you have a lisp to create a QR code immediately from AutoCAD by selecting a point in its UTM coordinates. The generated QR Code opens google maps and refer to the point location so that one can directly scan code and drive to it.

  • @adityaadit2004
    @adityaadit2004 Год назад

    Sir I am currently having this problem where I have a subfunction inside a function.
    When I load it into a new drawing with APPLOAD and trying to use the function, this error message appears saying (error no definition function ...).
    So I have to load it manually using VLIDE window everytime.
    How to fix it, sir? Thank you?

  • @karthikpandian6567
    @karthikpandian6567 2 года назад

    Very useful bro 🙏🙏

    • @cyberCADsolutions
      @cyberCADsolutions  2 года назад

      Thank you. Please share to your friends and colleagues.

  • @mohamedsathar6174
    @mohamedsathar6174 2 года назад

    Share Your Favorite usefull LISP files