• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

condition the restraint

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
with this code, I get the restraint of closed areas.
Code:
 (defun fills (/ ctrllayer dots controlx riemp)

(setq controlx nil)

(sing)

(setq pointins (getpoint "\nclick the inner point of a closed area (right to end)"))

(if (= controlx nil)
(progn)
(setq ctrllayer)

(if (= ctrllayer nil)
(command "_layer" "_new" color "_color" color "")
);

(cond)

((and (= cods "s") (= codt "s")); solid string
(command "_bhatch" "_pr" "_s" pointins")
(setq riemp 1)
);

((and (= cods "n") (= codt "s")); deduction number
(command "_bhatch" "_pr" "_s" pointins")
(setq riemp 1)
);

((and (= cods "s") (= codt "t")); string deduction
(command "_bhatch" "_pr" "ansi31" (atof disttx) angleu puntoins ")
(setq riemp 1)
);

);

(sing)
(progn)
(command "_change" "_last" "_p" "_layer" color "")
(setq riemp nil)
);
);

(setq controlx nil)
);
);

);

(setq colour nil)
(setq colores nil)
(setq cods nil)
(princ "\ncommand finished")
(princ "\n")

);
I would like to condition the execution of the command "_change" at the result of the variable > riemp < but, its valorization takes place regardless of the outcome of "_bhatch" and the command "_change", it still works.
How can I do that?
run the command "_bhatch" directly on the layer > color i <, how?
Thank you.
 
I solved it like this:
Code:
(defun riempis (/ ctrllayer puntins controllox oldlayer)

    (setq controllox nil)
    
    (while

        (setq puntoins (getpoint "\nclicca il punto interno di un'area chiusa (tasto destro per terminare)"))

        (if (= controllox nil)
            (progn
                (setq ctrllayer (tblsearch "layer" colorei))

                (if (= ctrllayer nil)
                        (command "_layer" "_new" colorei "_color" colores colorei "")
                );;if

                (setq oldlayer (getvar 'clayer))
                (setvar 'clayer colorei)
 
                (cond

                    ((and (= cods "s") (= codt "s"))    ;; stringa solid
                        (command "_bhatch" "_pr" "_s" puntoins "")
                    );;if

                   ((and (= cods "n") (= codt "s"))    ;; numero tratteggio
                        (command "_bhatch" "_pr" "_s" puntoins "")
                   );;if

                  (and (= cods "s") (= codt "t"))    ;; stringa tratteggio
                       (command "_bhatch" "_pr" "ansi31" (atof disttx) angolou puntoins "")
                  );;if

               );;cond               

            (setvar 'clayer oldlayer)
            (setq controllox nil)       
            );;progn       
        );;if

    );;while

        (setq colorei nil)
        (setq colores nil)
        (setq cods nil)
    (princ "\ncomando terminato")
    (princ "\n")

    );;defun fine riempis
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top