Blok Yerleştir

Bu AutoLISP programı, çizimdeki daireleri arayan ve belirtilen bloğu merkezlerine yerleştiren c:PlaceBlocks adlı bir işlevi tanımlar. Program, eklemeyi denemeden önce çizimde "block01" adlı bloğun var olup olmadığını kontrol eder. Blok bulunamazsa bir uyarı görüntülenir. (defun c:PlaceBlocks () (setq blockName "block01") ; Specify the name of the block to be inserted (if (not (tblsearch "block" blockName)) (alert (strcat "Block '" blockName "' not found. Please insert the block first.")) (progn (setq circles (ssget "X" '((0 . "CIRCLE")))) (if circles (progn (repeat (sslength circles) (setq circle (entget (ssname circles 0))) (setq centerPt (cdr (assoc 10 circle))) ; Extract the center point of the circle ; Insert the block at the center of the circle (command "_.insert" blockName centerPt 1.0 1.0 0.0) ; Move to the next circle (setq circles (ssdel (ssname circles 0) circles)) ) (princ "\nBlocks placed successfully.") ) (princ "\nNo circles found in the drawing.") ) ) ) (princ) ) ; Call the function when the AutoLISP program is loaded (c:PlaceBlocks)

Yorumlar

Bu blogdaki popüler yayınlar

AUTOLISP DOSYALARININ KALICI KULLANIMI

AUTOLISP PROGRAMLARINI ÇALIŞTIRMAK

MS Access Veritabanı Tablosuna Visual Basic ile Veri Eklemek