Selezionare un elemento di test per eliminazione

Angelo2449

Utente Junior
professione: Pensionato
software: Autocad
regione: Lombardia
Salve a tutti,
seleziono un Punto
Codice:
        (setq Lista (entget (car (entsel)) '("Gruppo")))
        (setq Xlist (assoc -3 Lista))
        (setq TxtData (car (cdr Xlist)))
        (setq Point1 (cdr (assoc 10 Lista)))
        (setq en1 (cdr (assoc -1 ed1)))
vorrei eliminare o spostare, dopo qualche istruzione, questo Punto.
Come lo devo definire per poterlo poi eliminare o spostare?
Con Point1 (tramite le coordinate) non è possibile in quanto, nella stessa posizione, esistono più elementi, che fare?
Grazie un milione!
 

rpor66

Utente Standard
professione: Programmatore
software: Lisp, Vba per Autocad, BricsCad e GstarCAD, CadWorx
regione: Sicilia
Lista è quello che ti serve per effettuare l'operazione:
(command "_move" Lista "" DalTuoPunto AlTuoPunto)
(command "_erase" Lista "")
 

Angelo2449

Utente Junior
professione: Pensionato
software: Autocad
regione: Lombardia
Grazie rpor66 ma non funziona.
Questo è l'intero listato del comando :
Codice:
    ;;@SPOSTAPUNTO

    (defun SPOSTAPUNTO (/ ed1 Lista Xlist TxtData GaussBoaga ControlloPt Cx Cy PuntoM Point1)

    (setvar "osmode" 16384)

    (while (/= ControlloPt "Non definito")

        (setq Lista (entget (car (entsel)) '("Gruppo")))
        (setq Xlist (assoc -3 Lista))
        (setq TxtData (car (cdr Xlist)))
        (setq Point1 (cdr (assoc 10 Lista)))
        (setq en1 (cdr (assoc -1 ed1)))

        (if (= Xlist nil)
        (alert "La stringa selezionata non è idonea, non sono associati dati estesi!")
            (progn
                (setq GaussBoaga (cdr (nth 5 TxtData)))
                (setq ControlloPt (cdr (nth 7 TxtData)))

                (setq Cx (substr GaussBoaga 1 12))
                (setq Cy (substr GaussBoaga 14 12))             

                (setq PuntoM (list (+ (atof Cx) 1.00) (+ (atof Cy) 1.00) 0.00))
                (command "_move" Lista "" GaussBoaga PuntoM "")
                (command "_line" GaussBoaga PuntoM "")
                (command "_change" "_last" "" "_p" "_layer" "Linee" "")
                (setq Identificativo "000100")

        );;progn
        );;if
    );;while
            
    );;defun
Viene tracciata la linea > GaussBoaga PuntoM < ma > Lista < non viene spostato in PuntoM.
Grazie ancora.
 

rpor66

Utente Standard
professione: Programmatore
software: Lisp, Vba per Autocad, BricsCad e GstarCAD, CadWorx
regione: Sicilia
Grazie rpor66 ma non funziona.
Questo è l'intero listato del comando :
Codice:
    ;;@SPOSTAPUNTO

    (defun SPOSTAPUNTO (/ ed1 Lista Xlist TxtData GaussBoaga ControlloPt Cx Cy PuntoM Point1 Ent)

    (setvar "osmode" 16384)

    (while (/= ControlloPt "Non definito")

        (setq Ent (entsel))
        (setq Lista (entget (car Ent) '("Gruppo")))
        (setq Xlist (assoc -3 Lista))
        (setq TxtData (car (cdr Xlist)))
        (setq Point1 (cdr (assoc 10 Lista)))
        (setq en1 (cdr (assoc -1 ed1)))

        (if (= Xlist nil)
        (alert "La stringa selezionata non è idonea, non sono associati dati estesi!")
            (progn
                (setq GaussBoaga (cdr (nth 5 TxtData)))
                (setq ControlloPt (cdr (nth 7 TxtData)))

                (setq Cx (substr GaussBoaga 1 12))
                (setq Cy (substr GaussBoaga 14 12))           

                (setq PuntoM (list (+ (atof Cx) 1.00) (+ (atof Cy) 1.00) 0.00))
                (command "_move" Ent "" GaussBoaga PuntoM "")
                (command "_line" GaussBoaga PuntoM "")
                (command "_change" "_last" "" "_p" "_layer" "Linee" "")
                (setq Identificativo "000100")

        );;progn
        );;if
    );;while
          
    );;defun
Viene tracciata la linea > GaussBoaga PuntoM < ma > Lista < non viene spostato in PuntoM.
Grazie ancora.

Move per funzionare gli devi passare il gruppo di selezione o il nome dell'entità.
Bye
 

Angelo2449

Utente Junior
professione: Pensionato
software: Autocad
regione: Lombardia
Ho quest'altro codice co il medesimo problema, l'elemento selezionato non viene eliminato.
Codice:
(defun C:3DINPUTDISTO (/ ed1 ed13 fp1 fp2 FC2 NotaOne Prisma Quota NomePuntoOne Dislivello Prisma PuntoCliccato Cx Cy XYZ NomeEntita Oggetto OldList NP NomePunto GaussBoaga TheData NewList Angolo StrAng Lung StrAngUno slm3 DeltaSlm Hp2F DeltaPrisma Delta3 Dist Tanalfa AlfaRad Ctrl Alfa Beta Origine DistInclinata Alpha Delta AlfaMode DeltaMode Disto)


        (SERVOAIUTOICONE)
        (ATTENZIONE)

        (setq FC2 (findfile "C:\\AutocadSupporto\\Varie\\NomePunto.dat"))

        (if FC2
            (vl-file-delete "C:\\AutocadSupporto\\Varie\\NomePunto.dat")
        );;if

        (setvar "osmode" 16384)

        (if (= Punto1 nil)
        (progn
            (alert "Devi prima definire la Stazione Celerimetrica (STAZIONECELERIMETRICA - Punto1)")
                (exit)
            )
        )

        (setq fp3 (open "C:\\AutocadSupporto\\Contatori\\Counter.dat" "r"))
            (setq Contatore (read-line fp3))
            (setq Passo (read-line fp3))
        (close fp3)

        (setq Xlist1 nil)
        (setq ed1 nil)
        (setq txt1 nil)
        (while
            (= ed1 nil)
            (setq ed1 (entsel "\nSeleziona il Nome del Punto da inserire : "))

            (if (/= ed1 nil)
                (progn
                    (setq Lista1 (entget (car ed1) '("Gruppo")))
                    (setq Xlist1 (assoc -3 Lista1))

                    (if (/= Xlist1 nil)
                        (progn
                            (setq TxtData1 (car (cdr Xlist1)))
                            (setq ed1 (entget (car ed1)))
                            (setq txt1 (cdr (assoc 1 ed1)))
                            (setq en1 (cdr (assoc -1 ed1)))
                            (setq Punto2 (cdr (assoc 10 ed1)))
                            (redraw en1 3)

                            (setq NomeX1 (cdr (nth 1 TxtData1)))   
                            (setq TipoPunto1 (cdr (nth 2 TxtData1)))
                            (setq Quota1 (cdr (nth 3 TxtData1)))
                            (setq Ecef1 (cdr (nth 4 TxtData1)))
                            (setq GaussBoaga1 (cdr (nth 5 TxtData1)))
                            (setq ControlloStz1 (cdr (nth 6 TxtData1)))
                            (setq ControlloPt1 (cdr (nth 7 TxtData1)))
                       );;progn
                    );;if
                );;progn
            );;if 
        );;while

        ; ----------------------------------------------------------------------------------------------------

        (setq FC2 (findfile "C:\\AutocadSupporto\\Varie\\NomePunto.dat"))

        (if FC2
            (startapp "C:\\AutocadSupporto\\Liberty\\3dDisto.exe " "C:\\AutoCadSupporto\\Liberty\\3dDisto.tkn")
        );;if

        ; ----------------------------------------------------------------------------------------------------

        (setq AlfaMode nil)
        (while (= AlfaMode nil)
            (setq fp5 (open "C:\\AutocadSupporto\\Celerimetrico\\DatiCele.dat" "r"))
            (setq NomePunto (read-line fp5))
            (setq Quota (read-line fp5))
            (setq Delta (read-line fp5))
            (setq Alfa (read-line fp5))
                (setq HDisto (read-line fp5))
            (setq Nota (read-line fp5))
            (setq DeltaMode (read-line fp5))
            (setq AlfaMode (read-line fp5))
            (close fp5)
        );;while

        (princ "\n")
        (princ "NomePunto >>>>>>>> ")
        (princ NomePunto)
        (princ "\n")

        (princ "Punto1 >>>>>>>> ")
        (princ Punto1)
        (princ "\n")

        (command "_line" Punto1 Punto2 "")
        (command "_change" "_last" "" "_p" "_layer" "Linee" "")

        (command "_circle" Punto1 0.15 "")
        (command "_text" Punto2 0.40 0 NomePunto "")
        (command "_change" "_last" "" "_p" "_layer" "TestoBlu" "")
        (command "_erase" ed1 "")

        (setq NomeEntita (entlast))

        (setq Oggetto "Gruppo")
    
        (if (not (tblsearch "APPID" Oggetto))
            (regapp Oggetto)
        )
 
        (setq OldList (entget NomeEntita))

        (setq NP (assoc 1 OldList))
        (setq NomePunto (cdr NP))
        (setq XYZ (cdr (assoc 10 OldList)))
        (setq GaussBoaga (strcat (rtos (car XYZ)) "," (rtos (cadr XYZ))))

        (setq TheData (list -3 (list Oggetto (cons 1000 NomePunto) (cons 1000 "Punto celerimetrico 3d") (cons 1000 Quota)(cons 1000 "---------------") (cons 1000 GaussBoaga) (cons 1000 VettoreOrientamento) (cons 1000 "Definito"))))

        (setq NewList (append OldList (list TheData)))
        (entmod NewList)
 
    );;defun fine di 3DINPUTDISTO
Dammi dei lumi, non capisco è così semplice.
Grazie.
 

Statistiche forum

Discussioni
59,359
Messaggi
506,902
Utenti registrati
111,718
Ultimo utente registrato
DiegoSc

Utenti online

Top