Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Distribute object

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
545 Views, 5 Replies

Distribute object

How to distribute object (circle) in selection of great number of points?

5 REPLIES 5
Message 2 of 6
_Tharwat
in reply to: Anonymous

More details need about what you are after
Message 3 of 6
hmsilva
in reply to: Anonymous


@Anonymous wrote:

How to distribute object (circle) in selection of great number of points?


Welcome to the forum lovearts123!

 

If I understand correctly, maybe something like this:

 

(defun c:test (/ I SS)
  (if (setq ss (ssget '((0 . "POINT"))))
    (progn
      (setq i (sslength ss))
      ;; set index the number of entities in the selection set
      (while (not (minusp (setq i (1- i))))
	;; while the index is non-negative, subtract one to index
	(entmake (list '(0 . "CIRCLE")
		       '(8 . "Sample-Circle")
		       ;; layer
		       '
			(62 . 1)
		       ;; color 1
		       (cons 10 (cdr (assoc 10 (entget (ssname ss i)))))
		       ;; center point from the the coordinates of each selected point
		       '
			(40 . 1.0)
		       ;; diameter
		 )
	)
	;; entmake
      )
      ;; while
    )
    ;; if
  )
  ;; progn
  (princ)
)
;; test

 

hope that helps
Henrique

EESignature

Message 4 of 6
Lee_Mac
in reply to: hmsilva

This is also how I understood the request from the OP.

 

@hmsilva,

 

Note that

(cons 10 (cdr (assoc 10 (entget (ssname ss i)))))

 is the same as:

(assoc 10 (entget (ssname ss i)))

Hence, your code could become:

 

(defun c:test ( / i s )
    (if (setq s (ssget '((0 . "POINT"))))
        (repeat (setq i (sslength s))
            (entmake (list '(0 . "CIRCLE") '(40 . 1.0) (assoc 10 (entget (ssname s (setq i (1- i)))))))
        )
    )
    (princ)
)

 Also, note that DXF Group 40 is the Circle radius, not diameter. Smiley Happy

 

Message 5 of 6
hmsilva
in reply to: Lee_Mac


@Lee_Mac wrote:

This is also how I understood the request from the OP.

 

@hmsilva,

 

Note that

(cons 10 (cdr (assoc 10 (entget (ssname ss i)))))

 is the same as:

(assoc 10 (entget (ssname ss i)))

Hence, your code could become:

 

(defun c:test ( / i s )
    (if (setq s (ssget '((0 . "POINT"))))
        (repeat (setq i (sslength s))
            (entmake (list '(0 . "CIRCLE") '(40 . 1.0) (assoc 10 (entget (ssname s (setq i (1- i)))))))
        )
    )
    (princ)
)

 Also, note that DXF Group 40 is the Circle radius, not diameter. Smiley Happy

 


Correct!

My bad...Smiley Embarassed

 

Henrique

EESignature

Message 6 of 6
Lee_Mac
in reply to: hmsilva

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report