Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error in chatgpt lisp code

6 REPLIES 6
Reply
Message 1 of 7
hussicharmssf
446 Views, 6 Replies

Error in chatgpt lisp code

hussicharmssf
Enthusiast
Enthusiast

Hi. I got a lisp code from chatgpt for a tile pattern. But when i load the lisp and run the command it is showing errors like bad argument fuxnump etc. or else if someone can get a code from any ai source that will work properly i will send the details. It is a tile pattern of 3 shades on a wall. Thank you in advance.

0 Likes

Error in chatgpt lisp code

Hi. I got a lisp code from chatgpt for a tile pattern. But when i load the lisp and run the command it is showing errors like bad argument fuxnump etc. or else if someone can get a code from any ai source that will work properly i will send the details. It is a tile pattern of 3 shades on a wall. Thank you in advance.

Tags (2)
6 REPLIES 6
Message 2 of 7
pendean
in reply to: hussicharmssf

pendean
Community Legend
Community Legend
ChatGPT is not ready for the real world of LISP.

Why not create your own by drawing what you want at the size you want, then use SUPERHATCH command for your desired tile pattern?
Or at least draw it up and show us what you are trying to recreate.
0 Likes

ChatGPT is not ready for the real world of LISP.

Why not create your own by drawing what you want at the size you want, then use SUPERHATCH command for your desired tile pattern?
Or at least draw it up and show us what you are trying to recreate.
Message 3 of 7
Kent1Cooper
in reply to: hussicharmssf

Kent1Cooper
Consultant
Consultant

See some replies over in the version of this topic at the AutoCAD Forum, >here<.*  But this Forum is the better place to continue the conversation.

 

* [It's now been moved here into the Customization Forum, so we have two....]

Kent Cooper, AIA
0 Likes

See some replies over in the version of this topic at the AutoCAD Forum, >here<.*  But this Forum is the better place to continue the conversation.

 

* [It's now been moved here into the Customization Forum, so we have two....]

Kent Cooper, AIA
Message 4 of 7
Kent1Cooper
in reply to: hussicharmssf

Kent1Cooper
Consultant
Consultant

Another big AI error in the code over at the other topic:  It assumes a (random) function in AutoLisp, which does not exist.  There are plenty of random-number routines out there, one of which would need to be incorporated.

 

And another:  It assumes "light green" & "medium green" & "dark green" are valid color designations.  The first 7 colors have word name options, but all other must be numerical.

Kent Cooper, AIA
0 Likes

Another big AI error in the code over at the other topic:  It assumes a (random) function in AutoLisp, which does not exist.  There are plenty of random-number routines out there, one of which would need to be incorporated.

 

And another:  It assumes "light green" & "medium green" & "dark green" are valid color designations.  The first 7 colors have word name options, but all other must be numerical.

Kent Cooper, AIA
Message 5 of 7
Kent1Cooper
in reply to: hussicharmssf

Kent1Cooper
Consultant
Consultant

And it looks like the code over there is meant to do the lower left pattern here, but there are so many other possibilities....

Kent1Cooper_0-1727184424254.png

 

Kent Cooper, AIA
0 Likes

And it looks like the code over there is meant to do the lower left pattern here, but there are so many other possibilities....

Kent1Cooper_0-1727184424254.png

 

Kent Cooper, AIA
Message 6 of 7
Kent1Cooper
in reply to: hussicharmssf

Kent1Cooper
Consultant
Consultant

[I suggest the other entry that's now been moved here from the "base" AutoCAD Forum is the better place to carry on, since it includes the AI code.]

Kent Cooper, AIA
0 Likes

[I suggest the other entry that's now been moved here from the "base" AutoCAD Forum is the better place to carry on, since it includes the AI code.]

Kent Cooper, AIA
Message 7 of 7

CADaSchtroumpf
Advisor
Advisor

And this can be respond at younr need?

 

(defun randnum (/ modulus multiplier increment random);return value beetwen 0 and 1
  (if (not seed)
    (setq seed (getvar "DATE"))
  )
  (setq modulus    65536
        multiplier 25173
        increment  13849
        seed (rem (+ (* multiplier seed) increment) modulus)
        random (/ seed modulus)
  )
)
(defun getrandnum (minNum maxNum / tmp);random number range
  (if (not (< minNum maxNum))
    (progn
      (setq tmp    minNum
            minNum maxNum
            maxNum tmp
      )
    )
  )
  (setq random (+ (* (randnum) (- maxNum minNum)) minNum))
)
(defun createhatchlist (e)
  (if e
    (vl-remove-if-not '(lambda (x) (member (car x) '(10 42))) (entget e))
  )
)
(defun entmakex-hatch (l a n s lay c)
 ;; By ElpanovEvgeniy
 ;; version 0.2
 ;; 2012.07.11
 ;; mailto: elpanov@gmail.com
 ;; web:		elpanov.com
 ;; Argument
 ;; L - list point
 ;; A - angle hatch
 ;; N - name pattern
 ;; S - scale
 ;; lay - layer
 ;; c - color
 ;; return - hatch ename
  (entmakex
    (apply 'append
      (list
        (list '(0 . "HATCH") '(100 . "AcDbEntity") '(410 . "Model") '(100 . "AcDbHatch")
          '(10 0.0 0.0 0.0) '(210 0.0 0.0 1.0)
          (cons 2 n)
          (cons 8 lay)
          (cons 62 c)
          (if (= n "SOLID")
            '(70 . 1)
            '(70 . 0)
          ) ;_  if
          '(71 . 0)
          (cons 91 (length l))
        ) ;_  list
        (apply 'append
          (mapcar
            '(lambda (a)
              (apply 'append
                (list
                  (list '(92 . 7) '(72 . 1) '(73 . 1) (cons 93 (/ (length a) 2)))
                  a
                  '((97 . 0))
                ) ;_  list
              ) ;_  apply
            ) ;_  lambda
            l
          ) ;_  mapcar
        ) ;_  apply
        (list
          '(75 . 0) '(76 . 1) (cons 52 a) (cons 41 s) '(77 . 0) '(78 . 1) (cons 53 a)
          '(43 . 0.) '(44 . 0.) '(45 . 1.) '(46 . 1.) '(79 . 0) '(47 . 1.) '(98 . 2)
          '(10 0. 0. 0.0) '(10 0. 0. 0.0) '(451 . 0) '(460 . 0.0) '(461 . 0.0) '(452 . 1)
          '(462 . 1.0) '(453 . 2) '(463 . 0.0) '(463 . 1.0) '(470 . "LINEAR")
        ) ;_  list
      ) ;_  list
    ) ;_  apply
  ) ;_  entmakex
)
(defun c:TilePattern (/ sspl nbe hList)
  (setq sspl (ssget '((0 . "LWPOLYLINE") (-4 . "&") (70 . 1))))
  (cond
    (sspl
      (repeat (setq nbe (sslength sspl))
        (if (setq hList (CreateHatchList (ssname sspl (setq nbe (1- nbe)))))
          (entmakex-hatch (list hList) 0.0 "_SOLID" 1.0 (getvar "CLAYER") (fix (getrandnum 91 94)))
        )
      )
    )
  )
  (prin1)
)

 

0 Likes

And this can be respond at younr need?

 

(defun randnum (/ modulus multiplier increment random);return value beetwen 0 and 1
  (if (not seed)
    (setq seed (getvar "DATE"))
  )
  (setq modulus    65536
        multiplier 25173
        increment  13849
        seed (rem (+ (* multiplier seed) increment) modulus)
        random (/ seed modulus)
  )
)
(defun getrandnum (minNum maxNum / tmp);random number range
  (if (not (< minNum maxNum))
    (progn
      (setq tmp    minNum
            minNum maxNum
            maxNum tmp
      )
    )
  )
  (setq random (+ (* (randnum) (- maxNum minNum)) minNum))
)
(defun createhatchlist (e)
  (if e
    (vl-remove-if-not '(lambda (x) (member (car x) '(10 42))) (entget e))
  )
)
(defun entmakex-hatch (l a n s lay c)
 ;; By ElpanovEvgeniy
 ;; version 0.2
 ;; 2012.07.11
 ;; mailto: elpanov@gmail.com
 ;; web:		elpanov.com
 ;; Argument
 ;; L - list point
 ;; A - angle hatch
 ;; N - name pattern
 ;; S - scale
 ;; lay - layer
 ;; c - color
 ;; return - hatch ename
  (entmakex
    (apply 'append
      (list
        (list '(0 . "HATCH") '(100 . "AcDbEntity") '(410 . "Model") '(100 . "AcDbHatch")
          '(10 0.0 0.0 0.0) '(210 0.0 0.0 1.0)
          (cons 2 n)
          (cons 8 lay)
          (cons 62 c)
          (if (= n "SOLID")
            '(70 . 1)
            '(70 . 0)
          ) ;_  if
          '(71 . 0)
          (cons 91 (length l))
        ) ;_  list
        (apply 'append
          (mapcar
            '(lambda (a)
              (apply 'append
                (list
                  (list '(92 . 7) '(72 . 1) '(73 . 1) (cons 93 (/ (length a) 2)))
                  a
                  '((97 . 0))
                ) ;_  list
              ) ;_  apply
            ) ;_  lambda
            l
          ) ;_  mapcar
        ) ;_  apply
        (list
          '(75 . 0) '(76 . 1) (cons 52 a) (cons 41 s) '(77 . 0) '(78 . 1) (cons 53 a)
          '(43 . 0.) '(44 . 0.) '(45 . 1.) '(46 . 1.) '(79 . 0) '(47 . 1.) '(98 . 2)
          '(10 0. 0. 0.0) '(10 0. 0. 0.0) '(451 . 0) '(460 . 0.0) '(461 . 0.0) '(452 . 1)
          '(462 . 1.0) '(453 . 2) '(463 . 0.0) '(463 . 1.0) '(470 . "LINEAR")
        ) ;_  list
      ) ;_  list
    ) ;_  apply
  ) ;_  entmakex
)
(defun c:TilePattern (/ sspl nbe hList)
  (setq sspl (ssget '((0 . "LWPOLYLINE") (-4 . "&") (70 . 1))))
  (cond
    (sspl
      (repeat (setq nbe (sslength sspl))
        (if (setq hList (CreateHatchList (ssname sspl (setq nbe (1- nbe)))))
          (entmakex-hatch (list hList) 0.0 "_SOLID" 1.0 (getvar "CLAYER") (fix (getrandnum 91 94)))
        )
      )
    )
  )
  (prin1)
)

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report