20.04.2010 12:37    

yazgunesi
Arkadaşlar bildiğiniz gibi autolisp ile çeşitli objelerin çizimini yapabiliyoruz..

Örneğin Autolisp ile çizgi çizimini ;

Kod:

(command  "line"   pt1 pt2  ""     
              "line"   pt3 pt4  ""
              "line"   pt5 pt6  "" )

veya

Kod:

(command  "line"   pt1 pt2 pt3 pt4 pt5 pt6  "")


olarak gerçekleştirebiliyoruz.

Pline söz konusu olduğunda ;

Kod:

(command "pline"  yr1 yr2 yr3 yr4 "")  ; yr1 , yr2  vs. kordinat noktalarını temsil eder..       


gerekli çizimi gerçekleştiriyoruz...

Bu kadar bilgiden sonra gelelim esas konuya..

Entmake ile bu çizim objelerini oluşturken aklıma gelen bazı fikirler var.


Kod:

; Entmake ile line ve daire çizimi test lispi

(defun c:daire2 ()

       (setq drcap 120) ; daire çapı
       (setq yr1 (getpoint "\n Yerlestirme noktasi ? :"))
       (setq cp2 (list(car yr1)(-(cadr yr1)(/ drcap 2))))
       (setq cp4 (list(car yr1)(+(cadr yr1)(/ drcap 2))))
       (setq cp3 (list(+(car yr1)(/ drcap 2))(cadr yr1)))
       (setq cp1 (list(-(car yr1)(/ drcap 2))(cadr yr1)))

(setq vlss (list                     

(cons 0 "circle")       ; Name of entity
(cons 8 "0")            ; Name of it's layer
(cons 10 yr1)           ; Center point of Circle
(cons 40 (/ 120 2))     ; Radius of Circle
(cons 62 2)             ; Color = 2
         )              ; Ent of entity list
      )
(entmake vlss)     ; Create circle


(setq vl1 (list     ; VL1 start

  (cons 0 "line")         ; Name of entity
  (cons 8 "0")     ; Name of it's layer
  (cons 10  cp1)   ; Start point
  (cons 11  cp3)  ; Ent point
  (cons 62 3)               ; Color = yeşil
  (cons 6 "center")   ; Linetype
     ) )              ; Ent of entity list
     
(entmake vl1) ; VL1 end of end

 
(setq vl2 (list                     

  (cons 0 "line")   ; Name of entity
  (cons 8 "0")     ; Name of it's layer
  (cons 10  cp4)   ; Start point
  (cons 11  cp2)  ; Ent point
  (cons 62 3)               ; Color = yeşil
  (cons 6 "center")     ; Linetype 
         ) )            ; Ent of entity list
   
(entmake vl2) ; VL2 end of end

   
(setq vl3 (list                     

  (cons 0 "line")         ; Name of entity
  (cons 8 "0")     ; Name of it's layer
  (cons 10  cp1)   ; Start point
  (cons 11  cp4)  ; Ent point
  (cons 62 1)          ; Color
  (cons 6 "center")     ; Linetype 
         ) )            ; Ent of entity list
   
(entmake vl3) ; VL3 end of end

 
(setq vl4 (list                     

  (cons 0 "line")         ; Name of entity
  (cons 8 "0")     ; Name of it's layer
  (cons 10  cp4)   ; Start point
  (cons 11  cp3)  ; Ent point
  (cons 62 4)          ; Color
  (cons 6 "center")     ; Linetype 
       ) )            ; Ent of entity list
   
(entmake vl4) ; VL4 end of end

 
(setq vl5 (list                     

  (cons 0 "line")         ; Name of entity
  (cons 8 "0")     ; Name of it's layer
  (cons 10  cp1)   ; Start point
  (cons 11  cp2)  ; Ent point
  (cons 62 5)          ; Color
  (cons 6 "center")     ; Linetype 
       ) )            ; Ent of entity list
   
(entmake vl5) ; VL5 end of end

 
(setq vl6 (list                     

  (cons 0 "line")         ; Name of entity
  (cons 8 "0")     ; Name of it's layer
  (cons 10  cp2)   ; Start point
  (cons 11  cp3)  ; Ent point
  (cons 62 6)          ; Color
  (cons 6 "center")     ; Linetype 
       ) )            ; Ent of entity list
   
(entmake vl6) ; VL6 end of end

(princ)
(Princ "Lisp'i çalıştırmak için > daire2 < yazınız! ")


Dikkat ettiyseniz yukarıdaki programda entmake ile her çizgi için tekrardan fonksiyon oluşturuluyor.Bu çizdirme fonksiyonu ile birden fazla çizgiyi çizdirme şansımız varmı polyline mantığı olarak ?

Bu düşünceyle polyline örnek test lispi de yaptım.. Bu arada spline çizdirmeyi başaramadım entmake ile.
Entmake ile spline çizdirmek mümkün olur mu ?

Kod:

; pline çizimi test lispi

(defun c:pln ()

(setq yr1 (getpoint "\n Başlangış noktasi ? :"))
(setq yr2 (getpoint "\n 2. nokta nokta ? :"))
(setq yr3 (getpoint "\n 3. nokta nokta ? :"))
(setq yr4 (getpoint "\n Bitiş noktasi ? :"))
 
(setq plist (list yr1 yr2 yr3 yr4 ))
 
(setq vl (list
   
(cons 0 "lwpolyline")      ; Name of entity   
(cons 8 "0")               ; Name of it'layer   
(cons 100 "AcDbEntity")   
(cons 100 "AcDbPolyline")
(cons 90 (length plist))
(cons 70 0)
(cons 43 0.0)
    )
  )  ; Ent of entity list

; Add vertex point to list

  (foreach le plist
    (setq vl(append vl
       (list (cons 10 le))
  )) )
 
  (entmake vl)

(princ)
) ; program bittmiştir.

(Princ "Lisp'i çalıştırmak için > pln < yazınız! ")

> 1 <
Copyright © 2004-2022 SQL: 0.705 saniye - Sorgu: 42 - Ortalama: 0.01679 saniye