• このフォーラムは、www.cad3d.it/forum1 - イタリアのデザインコミュニティの機械翻訳です。いくつかの用語は正しく翻訳されていません。

コンカラーrgbの問題で設定

  • Thread starter Thread starter jim78b
  • Start date Start date

jim78b

Guest
ciao, ho un lisp che mette tutti i colori su byblock anche nei blocchi nidificati ma mis on accorto oggi che con i colori rgb non li cambia proprio (intendo se in un blocco lo edito e metto le entità su un colore rgb es 245,0,0 e poi esco dal blocco e lancio il lisp non mi mette le entità su byblock....se riuscite a corregere la routine grazie

(defun c:setbyblock ( / _byblock e )

(defun _byblock ( n l / a e x )
(if (and
(setq e (tblobjname "block" n))
(not (member n l))
)
(while (setq e (entnext e))
(if (setq a (assoc 62 (setq x (entget e))))
(entmod (subst '(62 . 0) a x))
(entmod (append x '((62 . 0))))
)
(if (= "insert" (cdr (assoc 0 x)))
(_byblock (cdr (assoc 2 x)) (cons n l))
)
)
)
nil
)

(while
(progn (setvar 'errno 0) (setq e (car (entsel "\nselect block: ")))
(cond
( (= 7 (getvar 'errno))
(princ "\nmissed, try again.")
)
( (= 'ename (type e))
(if (= "insert" (cdr (assoc 0 (entget e))))
(_byblock (cdr (assoc 2 (entget e))) nil)
(princ "\nobject is not a block.")
)
)
)
)
)
(command "_.regen")
(princ)
)
 
Code:
(defun c:setbyblock ( / _byblock e )

    (defun _byblock ( n l / a e x )
        (if (and (setq e (tblobjname "block" n)) (not (member n l)))
            (while (setq e (entnext e))
                (setq x (entget e))
                (if (setq a (assoc 420 x))
                    (setq x (vl-remove (assoc 420 x) x))
                )
                (if (setq a (assoc 62 x))
                    (entmod (subst '(62 . 0) a x))
                    (entmod (append x '((62 . 0))))
                )
                (if (= "insert" (cdr (assoc 0 x)))
                    (_byblock (cdr (assoc 2 x)) (cons n l))
                )
            )
        )
        nil
    )

    (while
        (progn
            (setvar 'errno 0) (setq e (car (entsel "\nselect block: ")))
            (cond
                ( (= 7 (getvar 'errno))
                    (princ "\nmissed, try again.")
                )
                ( (= 'ename (type e))
                    (if (= "insert" (cdr (assoc 0 (entget e))))
                        (_byblock (cdr (assoc 2 (entget e))) nil)
                        (princ "\nobject is not a block.")
                    )
                )
            )
        )
    )
    (command "_.regen")
    (princ)
)

ok?
 
ciao grazie x il tempo dedicato, funziona ma non permette di selezionare più elementi , la funzione vecchia era così infatti, si potrebbe fare che seleziona più elementi? ...
 
Code:
(defun c:setbyblock ( / _byblock e n x a sel c)

    (defun _byblock ( n l / a e x )
        (if (and (setq e (tblobjname "block" n)) (not (member n l)))
            (while (setq e (entnext e))
                (setq x (entget e))
                (if (setq a (assoc 420 x))
                    (setq x (vl-remove (assoc 420 x) x))
                )
                (if (setq a (assoc 62 x))
                    (entmod (subst '(62 . 0) a x))
                    (entmod (append x '((62 . 0))))
                )
                (if (= "insert" (cdr (assoc 0 x)))
                    (_byblock (cdr (assoc 2 x)) (cons n l))
                )
            )
        )
        nil
    )

    (prompt "\nselect blocks: ")
    (setq sel (ssget (list (cons 0 "insert"))))
    (setq c 0)
    (repeat (sslength sel)
        (setq n (ssname sel c))       
        (_byblock (cdr (assoc 2 (entget n))) nil)
        (setq c (1+ c))
    )
    
    (command "_.regen")
    (princ)
    
)

aggiornato, ora permette la selezione multipla.
 
ciao ho provato ma non funziona con i blocchi anonimi potresti farlo anche per quelli ?grazie
 
intendo quelli col simbolo * davanti.mi son accorto che forse certi lisp tipo il cambio colore di blocchi nidificati non va ma forse non si può pretendere ...
 

Forum statistics

Threads
46,674
Messages
380,976
Members
2
Latest member
loop80
このフォーラムは、www.cad3d.it/forum1 - イタリアのデザインコミュニティの機械翻訳です。いくつかの用語は正しく翻訳されていません。

Members online

No members online now.
Back
Top