TuttoCAD Forum

TuttoCAD Forum
[ Home | Registrati | Discussioni Attive | Discussioni Recenti | Segnalibro | Msg privati | Sondaggi Attivi | Utenti | Album Fotografico | Download | | Cerca | FAQ ]
Nome Utente:
Password:
Salva Password
Password Dimenticata?

 Tutti i Forum
 1 - TuttoCAD Software
 AutoLISP
 Centreline

Nota: Devi essere registrato per poter inserire un messaggio.
Per registrarti, clicca qui. La Registrazione è semplice e gratuita!

Larghezza finestra:
Nome Utente:
Password:
Modo:
Formato: GrassettoCorsivoSottolineatoBarrato Aggiungi Spoiler Allinea a  SinistraCentraAllinea a Destra Riga Orizzontale Inserisci linkInserisci EmailInserisci FlashInserisci Immagine Inserisci CodiceInserisci CitazioneInserisci Lista
   
Icona Messaggio:              
             
Messaggio:

  * Il codice HTML è OFF
* Il Codice Forum è ON

Faccine
Felice [:)] Davvero Felice [:D] Caldo [8D] Imbarazzato [:I]
Goloso [:P] Diavoletto [):] Occhiolino [;)] Clown [:o)]
Occhio Nero [B)] Palla Otto [8] Infelice [:(] Compiaciuto [8)]
Scioccato [:0] Arrabbiato [:(!] Morto [xx(] Assonnato [|)]
Bacio [:X] Approvazione [^] Disapprovazione [V] Domanda [?]
Seleziona altre faccine

    
 
   

V I S U A L I Z Z A    D I S C U S S I O N E
arri Inserito il - 01 dicembre 2010 : 11:55:48
This is quite a simple program to enable a user to quickly add a centreline to an Arc, Circle or Ellipse object.

The centreline length and angle is determined by the user following object selection.


;;--------------------=={ Centreline }==----------------------;;
;;                                                            ;;
;;  Creates a centreline for Arcs, Circles & Ellipses with    ;;
;;  a user-defined length and angle.                          ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2010 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

(defun c:cl nil (c:Centreline))

(defun c:Centreline ( / e a d p1 p2 ) (vl-load-com)
  ;; Lee Mac 2010

  (if (and
        (setq e
          (LM:Selectif
            (lambda ( e )
              (member (cdr (assoc 0 (entget e))) '("CIRCLE" "ARC" "ELLIPSE"))
            )
            entsel "\nSelect Arc, Circle or Ellipse: "
          )
        )
        (setq p2
          (getpoint (setq p1 (trans (cdr (assoc 10 (entget e))) e 1))
            "\nSpecify Length of Centreline: "
          )
        )
      )
    (progn (setq a (angle p1 p2) d (distance p1 p2))
      (mapcar
        (function
          (lambda ( a d )
            (entmakex
              (list
                (cons 0 "LINE")
                (cons 10 (trans (polar p1 a d) 1 0))
                (cons 11 (trans (polar p1 a (- d)) 1 0))
              )
            )
          )
        )
        (list a (+ a (/ pi 2.))) (list d (- d))
      )
    )
  )
  (princ)
)

;;---------------------=={ Select if }==----------------------;;
;;                                                            ;;
;;  Continuous selection prompts until the predicate function ;;
;;  foo is validated                                          ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2010 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  foo - optional predicate function taking ename argument   ;;
;;  fun - selection function to invoke                        ;;
;;  str - prompt string                                       ;;
;;------------------------------------------------------------;;
;;  Returns:  selected entity ename if successful, else nil   ;;
;;------------------------------------------------------------;;

(defun LM:Selectif ( foo fun str / e )
  ;; © Lee Mac 2010
  (while
    (progn (setq e (car (fun str)))      
      (cond
        ( (eq 'ENAME (type e))

          (if (and foo (not (foo e)))
            (princ "\n** Invalid Object Selected **")
          )
        )
      )
    )
  )
  e
)

TuttoCAD Forum © 2001-2010 CADLandia Torna all'inizio della Pagina
Pagina generata in 0,35 secondi.