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.
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.
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....]
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....]
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.
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.
And it looks like the code over there is meant to do the lower left pattern here, but there are so many other possibilities....
And it looks like the code over there is meant to do the lower left pattern here, but there are so many other possibilities....
[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.]
[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.]
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)
)
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.