Laying out hole patterns with a lisp

Laying out hole patterns with a lisp

Anonymous
Not applicable
2,800 Views
21 Replies
Message 1 of 22

Laying out hole patterns with a lisp

Anonymous
Not applicable

Hello everyone,

 

So I am revisiting this topic coming back with more knowledge of lisp and trying to get everything automated.

I was hoping to make a lisp to draw circles within in a rectangle and center them on that rectangle.

I am struggling on how to go about doing this.

Can any one help help me with this?

It cannot be a hatch or super hatch they have to be individual circles created. 

 

thanks a lot  

 

See the attached notated drawing for all the details 

(defun C:test (/ getcenter )
(defun getcenter (/ centroid)
  (setq centroid
       (trans
	 (osnap
	   (cadr
	     (entsel "\nSelect polyline: "
		     )
	     ) "_gcen"
	   ) 1 0
	 )
      )
  )
  (princ )
  (getcenter)
  (command "circle" centroid "Diameter" ".315")
 )

 

0 Likes
Accepted solutions (2)
2,801 Views
21 Replies
Replies (21)
Message 2 of 22

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

first, there is no "gcen" osnap option. second, the "cen" osnap is for circles and arcs only. to find the centroid point of a closed rectangle polyline you can call the (inters) function on it's diagonals OR create a region of the polygon (must go to vla-object) and than you can get it's centroid.

 

on the other hand why work so hard? when you can solve this with exploded hatch?

 

moshe

 

0 Likes
Message 3 of 22

Kent1Cooper
Consultant
Consultant

@Moshe-A wrote:

....

first, there is no "gcen" osnap option. ....

on the other hand why work so hard? when you can solve this with exploded hatch?


 

Yes, there is a geometric-center Object Snap mode in newer versions.  And an Exploded Hatch pattern cannot result in Circles, but could only be approximations of Circles made up of short Line segments.

Kent Cooper, AIA
0 Likes
Message 4 of 22

devitg
Advisor
Advisor

Please state-

polyline are always orthogonally oriented , ture E-W and true N-S

diameter hole  is the same always

distance between set is always the same 

or there is a ratio hole-diameter /  distance 

Or at last,  you want to fill the inner poly with any diameter hole ( constant) , and center distance  as a diameter ratio 

At your sample , diameter to center distance is 5 to 7  , as hole is 5/16" and center distance is 7/16"

 

 

 

 

0 Likes
Message 5 of 22

Anonymous
Not applicable

Understood,

I had pulled this from another forum... 

I totally agree with you and hate working harder than I have to. Unfortunately the circle cant be a hatch because it is going to cnc and have to be extremely precise as well as cant be made up of many line segments which is what you get when you explode a hatch. (at least to the best of my knowledge) 

Thanks for the reply and feedback 

0 Likes
Message 6 of 22

Anonymous
Not applicable

Thanks @Kent1Cooper 

0 Likes
Message 7 of 22

Anonymous
Not applicable

 

Yes rectangles are always typ. true E-W and true N-S

Diameter of circles are always .315" and all circles in a row are 16mm On Center (very important)

 

 

"At your sample , diameter to center distance is 5 to 7  , as hole is 5/16" and center distance is 7/16" " - I do not understand your comment here.  I did add some more to the sample that might add some clarity.

 

Thanks again everyone, 

Seth Brathovd

0 Likes
Message 8 of 22

devitg
Advisor
Advisor

5/8" is not the same as 16 mm , please clear 

 

 

 

 

0 Likes
Message 9 of 22

ВeekeeCZ
Consultant
Consultant

Perhaps like this.

- the routine presumes you select the gray frame and fill that without overlapping the frame (min. offset is zero). If you need different minimum offset, add that to the code. Pretty sure you'll figure how.

- second. The routine presumes that circles are in 1st and 3rd quadrant from a middle point, as is your drawing. Not sure if that matters... If does not, you can simplify the code to change the initial setting of oy to 0.

 

(vl-load-com)

(defun c:Wholes (/ circle dia rad ss i en pll pur mid nll pnt oy ox iy iy)
  
  (defun circle (cen rad)
    (entmakex (list (cons 0 "CIRCLE")
		    (cons 10 cen)
		    (cons 40 rad))))
  
  (setq dia 0.315
	rad (/ dia 2.))
  
  (if (setq ss (ssget '((0 . "LWPOLYLINE"))))
    (repeat (setq i (sslength ss))
      (setq en (ssname ss (setq i (1- i))))
      
      (if (and (not (vla-getboundingbox (vlax-ename->vla-object en) 'minpt 'maxpt))
	       (setq pll (vlax-safearray->list minpt))
	       (setq pur (vlax-safearray->list maxpt))
	       (setq mid (mapcar '/ (mapcar '+ pll pur) '(2 2 2)))
	       
	       (setq nll (mapcar '(lambda (x) (fix (/ x dia))) (mapcar '- mid pll)))
	       (setq pnt (mapcar '+ (mapcar '- mid (mapcar '* nll (list dia dia))) (list rad rad)))
	       
	       (setq oy  (if (= (rem (car nll) 2)
				(rem (cadr nll) 2))
			   0
			   1))
	       (setq iy 0)
	       )
	(repeat (* 2 (cadr nll))
	  (setq oy (- 1 oy)
		ox (- 1 oy)
		ix 0)
	  (repeat (* 2 (car nll))
	    (if (= 1 (setq ox (- 1 ox)))
	      (circle (mapcar '+ pnt (list (* ix dia) (* iy dia))) rad))
	    (setq ix (1+ ix)))
	  (setq iy (1+ iy))))))
  (princ)
  )

 

Message 10 of 22

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:....
(defun C:test (/ getcenter centroid)
(defun getcenter (/ centroid)
  (setq centroid
       (trans
	 (osnap
	   (cadr
	     (entsel "\nSelect polyline: "
		     )
	     ) "_gcen"
	   ) 1 0
	 )
      )
  )
  (princ )
  (getcenter)
  (command "circle" centroid "Diameter" ".315")
 )

 


 

The feedback to your code.

- It's not working! because the centroid variable is localized in the subroutine!

 

Better solution would be use the point as the output of your sub, then the value of the sub set to variable and test it if it's ok, then use it...

(defun C:test (/ getcenter centroid)
  
  (defun getcenter ()
    (trans
      (osnap
	(cadr
	  (entsel "\nSelect polyline: "
		  )
	  ) "_gcen"
	) 1 0
      )
    )
  
  
  (if (setq centroid (getcenter))
    (command "circle" "none" centroid "Diameter" ".315")
    )
  
  (princ)
  )

 

Also you should never forget to turn off osnaps while setting a point within the command function. 

And the last and more important, autocad's commands are VERY slow, better use the entmake, see HERE a minimum requirements.

0 Likes
Message 11 of 22

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

well, here is my version to this 'problem':

dholes.lsp is base on hatch. i have created hatch pattern base on dots called it dholes.pat (attached)

you can use the hatch option to make slightly changes to your holes like setting to hatch origin point, scale and angle with the need to change the code. you can also make change to the hatch pattern in order to achieve different holes pattern.

 

enjoy

moshe

 

 

(vl-load-com); load activex support

(defun c:dholes (/ setPatchOrigin setPatternScale setPatternAngle get_nodes check_rectangle is_circle_inside exe_body ; local functions
	           FUZZ ss0 nodes^ p0 p1 p2 p3 hps hpa)

 (defun setPatternOrigin (/ pt def)
  (setq pt (getvar "hporigin"))
  (setq def (strcat (rtos (car pt) 2) "," (rtos (cadr pt) 2)))  
   
  (if (not (setq pt (getpoint (strcat "\nPattern origin point <" def ">: "))))
   T
   (setvar "hporigin" pt)
  )
 ); setPatternOrigin


 (defun setPatternScale (/ scl)
  (if (not (setq scl (getreal (strcat "\nPattern scale <" (rtos (getvar "hpscale") 2) ">: "))))
   (getvar "hpscale") 
   (setvar "hpscale" scl)
  )
 ); setPatternScale


 (defun setPatternAngle ()
  (if (not (setq ang (getangle (strcat "\nPattern angle <" (angtos (getvar "hpang") 0) ">: "))))
   (getvar "hpang")
   (setvar "hpang" ang)
  )
 ); setPatternAngle

  
 (defun get_nodes (ename / MinPoint MaxPoint t0 t1)
  (vla-getBoundingBox (vlax-ename->vla-object ename) 'MinPoint 'MaxPoint) 
  (setq t0 (vlax-safearray->list MinPoint))
  (setq t2 (vlax-safearray->list MaxPoint))

  (list t0 (list (car t2) (cadr t0)) t2 (list (car t0) (cadr t2)))
 ); get_nodes

  
 (defun check_rectangle (ename)  
 
  (if (/= (cdr (assoc '90 (entget ename))) 4)
   (progn
    (vlr-beep-reaction)
    (prompt "\nSelected polyline is not made of 4 nodes.")
   ); progn
   (progn
    (setq nodes^ (get_nodes ename))
    (setq p0 (nth 0 nodes^) p1 (nth 1 nodes^)
	  p2 (nth 2 nodes^) p3 (nth 3 nodes^))
    
    (if (and
          (equal (car  p0) (car  p3) FUZZ)
          (equal (car  p1) (car  p2) FUZZ)
          (equal (cadr p0) (cadr p1) FUZZ)
          (equal (cadr p2) (cadr p3) FUZZ)
          (equal (distance p0 p2) (distance p1 p3) FUZZ)
        )
      T
     (progn
      (vlr-beep-reaction)
      (prompt "\nSelected polyline does not form a right rectangle.")     
     ); progn
    ); if
   ); progn
  ); if
 ); check_rectangle


 (defun is_circle_inside (/ is_inside ; local function
		            MinPoint MaxPoint t0 t2)

  (defun is_inside (pt)
   (and
     (>= (car  pt) (car  p0))
     (<= (car  pt) (car  p2))
     (>= (cadr pt) (cadr p0))
     (<= (cadr pt) (cadr p2))
   )
  ); is_inside
   

  (vla-getBoundingBox (vlax-ename->vla-object (entlast)) 'MinPoint 'MaxPoint)
  (setq t0 (vlax-safearray->list MinPoint))
  (setq t2 (vlax-safearray->list MaxPoint))

  (and
    (is_inside t0)
    (is_inside t2)
  )
 ); is_circle_inside


 (defun exe_body (ename0 / draw_circle ; local function
		           ss1)

  (defun draw_circle (c0 rad)
   (entmakex
     (list
      '(0 . "circle")
      (cons '10 c0)
      (cons '40 rad)
     )
   ); entmakex
  ); draw_circle

   
  (command-s "._hatch" "dholes" hps hpa "_si" ename0)
  (command-s "._explode" "_last")

  (if (setq ss1 (ssget "_w" p0 p2 '((0 . "line"))))
   (mapcar
    '(lambda (ename1 / elist1 t0 t1 ename2)
      (setq elist1 (entget ename1))
      (setq t0 (cdr (assoc '10 elist1)) t1 (cdr (assoc '11 elist1)))

      (if (and
	    (= (distance t0 t1) 0.0)
	    (setq ename2 (draw_circle t0 (* 0.1575 hps)))
	  )
       (progn
        (if (not (is_circle_inside))
	 (entdel ename2)
        )
	       
        (entdel ename1)
       ); progn
      ); if
     ); lambda
    (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss1)))
   ); mapcar
  ); if
 ); exe_body
  

 ; here start c:dholes
 (setvar "cmdecho" 0)
 (command-s "._undo" "_begin")
  
 (setq FUZZ 1e-9) ; const
   
 (if (and
       (setq ss0 (ssget '((0 . "lwpolyline"))))
       (setPatternOrigin)
       (setq hps (setPatternScale))
       (setq hpa (setPatternAngle))
     )
  (mapcar
   '(lambda (ename0)
     (if (check_rectangle ename0)
      (exe_body ename0)
     ); if
   ); lambda
   (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss0)))
  ); mapcar
 ); if 

 (command-s "._undo" "_end")
 (setvar "cmdecho" 1) 
 (princ)
); c:dholes

  
0 Likes
Message 12 of 22

Moshe-A
Mentor
Mentor

here is dholes.zip (the web rejects the pat file type)

0 Likes
Message 13 of 22

Anonymous
Not applicable

Moshe-A,

 

That works great, but is it missing the point of getting the holes centered within that polyline. The dist from the outer most quadrant should be the same from left to right, it should also be the same from top to bottom. They dont all need to be equal, again only left to right and then top to bottom.  

Otherwise the system works great and lays the holes out within the given frame. 

Thanks for the time and thought that when into this. 

0 Likes
Message 14 of 22

Anonymous
Not applicable

 

This works flawlessly! Exactly what I was looking for. In the future if I want to modify the pattern where in the code do i need to do that if you notate the code for me would that do it or is it too complicated.

Modifying the pattern such as different spacing and or parallel not offset holes...

Thanks for all the hard work and time spent helping me out. You have no idea how appreciated this is!

Also thank you for the feedback on what I started with learned something from it.

0 Likes
Message 15 of 22

Kent1Cooper
Consultant
Consultant

Another way....  It's really not necessary to draw all those Circles independently.  All that's needed is to draw one, Copy it in the appropriate direction, and Array the first one and the copy.  The tricky parts are calculating the numbers of rows and columns, the position of the first one, and in which direction to Copy it, to get the result to not touch or cross the boundary, and to have the right relationship to the center.  Try this, which is done all in metric values, but you can substitute the imperial values if you don't mind the imprecision and all the decimal places [lightly tested]:

(defun C:HOLES (/ rsel rcen rsize rwid rht cols rows set1L set1B)
  (setq
    rsel (entsel "\nNo-touch perimeter: ")
    rcen (osnap (cadr rsel) "_gce")
  ); setq
  (vla-getboundingbox (vlax-ename->vla-object (car rsel)) 'minpt 'maxpt)
  (setq
    rsize (mapcar '- (vlax-safearray->list maxpt) (vlax-safearray->list minpt))
      ;; rectangle size as XY[Z] list
    rwid (car rsize); width
    rht (cadr rsize); height
    cols (- (fix (/ rwid 16)) (if (equal (rem rwid 16) 0 1e-4) 1 0))
    rows (- (fix (/ rht 16)) (if (equal (rem rht 16) 0 1e-4) 1 0))
    set1L (< 0 (rem (- (/ rwid 2) 8) 16) 8); 1st set closer to Left edge [T/nil]
      ;; "1st set" = Array set incl. Circle down-left from center
    set1B (< 0 (rem (- (/ rht 2) 8) 16) 8); 1st set closer to Bottom edge [T/nil]
  ); setq
  (command
    "_.circle" "_none"
      (list
        (- (car rcen) (+ 4 (* 16 (1- (/ cols 2))) (if set1L 16 0))); X coordinate
        (- (cadr rcen) (+ 4 (* 16 (1- (/ rows 2))) (if set1B 16 0))); Y coordinate
      ); list
      4 ; radius [use 4.0005 to be exactly as in sample drawing]
    "_copy" "_last" "" "_none"
      (list (if set1L 8 -8) (if set1B 8 -8)) ""
    "_array" "_last" "_previous" "" "_rectangular" rows cols 16 16
  ); command
  (princ)
); defun

 

Kent Cooper, AIA
0 Likes
Message 16 of 22

Anonymous
Not applicable

@ВeekeeCZ ,

I did just notice the holes are being placed at .63 and not a true 16mm On Center which is a big deal. 

Any way of tweaking that?

0 Likes
Message 17 of 22

Anonymous
Not applicable

@Kent1Cooper ,

This makes a lot more sense and is a little easier to understand, which is a good thing for me just starting off in lisp let alone any coding...

I attempted to change it to imperial but after doing so they are not centering in the polyline. They need to be imperial and and at the highest precision. Gotta love CNC... 

Holes have a dia of .315 so a little over 8mm

holes are 16mm or .629921259 On center 

Am I missing something to adjust the sizing? 

Also I was wondering if its possible to select multiple with "entsel"? or what could be done to get multiple?

This is what I have done to modify it...

(defun C:HOLES (/ rsel rcen rsize rwid rht cols rows set1L set1B)
  (setq
    rsel (entsel "\nNo-touch perimeter: ")
    rcen (osnap (cadr rsel) "_gce")
  ); setq
  (vla-getboundingbox (vlax-ename->vla-object (car rsel)) 'minpt 'maxpt)
  (setq
    rsize (mapcar '- (vlax-safearray->list maxpt) (vlax-safearray->list minpt))
      ;; rectangle size as XY[Z] list
    rwid (car rsize); width
    rht (cadr rsize); height
    cols (- (fix (/ rwid 0.629921259)) (if (equal (rem rwid 0.629921259) 0 1e-4) 1 0))
    rows (- (fix (/ rht 0.629921259)) (if (equal (rem rht 0.629921259) 0 1e-4) 1 0))
    set1L (< 0 (rem (- (/ rwid 2) 0.314960629) 0.629921259) 0.314960629); 1st set closer to Left edge [T/nil]
      ;; "1st set" = Array set incl. Circle down-left from center
    set1B (< 0 (rem (- (/ rht 2) 0.314960629) 0.629921259) 0.314960629); 1st set closer to Bottom edge [T/nil]
  ); setq
  (command
    "_.circle" "_none"
      (list
        (- (car rcen) (+ 0.15748 (* 0.629921259 (1- (/ cols 2))) (if set1L 0.629921259 0))); X coordinate
        (- (cadr rcen) (+ 0.15748 (* 0.629921259 (1- (/ rows 2))) (if set1B 0.629921259 0))); Y coordinate
      ); list
      0.1575 ; radius [ 0.1575 exactly as in sample drawing]
    "_copy" "_last" "" "_none"
      (list (if set1L 0.314960629 -0.314960629) (if set1B 0.314960629 -0.314960629)) ""
    "_array" "_last" "_previous" "" "_rectangular" rows cols 0.629921259 0.629921259
  ); command
  (princ)
); defun

 

0 Likes
Message 18 of 22

Kent1Cooper
Consultant
Consultant
Accepted solution

If you need the "highest precision," then 9 decimal places isn't the best you can do.  Without digging too deeply into your revision for whatever you may have missed to throw it off-center, I made my own, simply changing the values to variables, in which the 16mm spacing is as precise as AutoCAD can handle.  And you could adjust it easily to ask for values, changing only where those variables are set, but leaving their usage in the rest of the code as it is.  Minimally tested:

(defun C:HOLES (/ rsel rcen rsize rwid rht cols rows set1L set1B)
  (setq
    rsel (entsel "\nNo-touch perimeter: ")
    rcen (osnap (cadr rsel) "_gce")
    crad 0.1575; Circle radius
    cspc (cvunit 16 "mm" "inch"); Circle spacing [in orthogonal directions]
  ); setq
  (vla-getboundingbox (vlax-ename->vla-object (car rsel)) 'minpt 'maxpt)
  (setq
    rsize (mapcar '- (vlax-safearray->list maxpt) (vlax-safearray->list minpt))
      ;; rectangle size as XY[Z] list
    rwid (car rsize); width
    rht (cadr rsize); height
    cols (- (fix (/ rwid cspc)) (if (equal (rem rwid cspc) 0 1e-4) 1 0))
    rows (- (fix (/ rht cspc)) (if (equal (rem rht cspc) 0 1e-4) 1 0))
    set1L (< 0 (rem (- (/ rwid 2) (/ cspc 2)) cspc) (/ cspc 2)); 1st set closer to Left edge [T/nil]
      ;; "1st set" = Array set incl. Circle down-left from center
    set1B (< 0 (rem (- (/ rht 2) (/ cspc 2)) cspc) (/ cspc 2)); 1st set closer to Bottom edge [T/nil]
  ); setq
  (command
    "_.circle" "_none"
      (list
        (- (car rcen) (+ (/ cspc 4) (* cspc (1- (/ cols 2))) (if set1L cspc 0))); X coordinate
        (- (cadr rcen) (+ (/ cspc 4) (* cspc (1- (/ rows 2))) (if set1B cspc 0))); Y coordinate
      ); list
      crad ; radius
    "_copy" "_last" "" "_none"
      (list (if set1L (/ cspc 2) (- (/ cspc 2))) (if set1B (/ cspc 2) (- (/ cspc 2)))) ""
    "_array" "_last" "_previous" "" "_rectangular" rows cols cspc cspc
  ); command
  (princ)
); defun

EDIT:  [I had some instances of crad in there [in the calculating of the first Circle's location] that I've corrected to (/ cspc 4).  So if you pulled it before that correction, it'll be off by a hair.

Kent Cooper, AIA
0 Likes
Message 19 of 22

ВeekeeCZ
Consultant
Consultant
Accepted solution

@Anonymous wrote:

@ВeekeeCZ ,

I did just notice the holes are being placed at .63 and not a true 16mm On Center which is a big deal. 

Any way of tweaking that?


Yeah, I know. I've simplified that hoping that you where searching for an algorithm and this little things you will able to adjust by yourself...

 

Anyway, I rewrote the code little bit and added commentaries. It also should help you to make further adjustments.

(defun c:Holes (/ circle grx gry grd dia pll pur mid nll pnt oy ox iy iy)
  
  (defun circle (cen rad)
    (entmakex (list (cons 0 "CIRCLE")
		    (cons 10 cen)
		    (cons 40 rad))))
  
  (setq grx 0.32				; grid x distance
	gry 0.32				; grid y distance
	dia (cvunit 8 "mm" "inch")		; circle diameter
	
	grd (list grx gry)			; grid '(x y)
	)
  
  (if (setq ss (ssget '((0 . "LWPOLYLINE"))))				; multiple polyline selection
    
    (repeat (setq i (sslength ss))					; go thru selection set
      (setq en (ssname ss (setq i (1- i))))				; polyline's ename
      
      (if (and (not (vla-getboundingbox (vlax-ename->vla-object en) 'minpt 'maxpt))			; get polyline's bounding box
	       (setq pll (vlax-safearray->list minpt))							; polyline's lower-left point
	       (setq pur (vlax-safearray->list maxpt))							; polyline's upper-right point
	       (setq mid (mapcar '/ (mapcar '+ pll pur) '(2 2)))					; polyline's center point
	       
	       (setq nll (mapcar 'fix (mapcar '/ (mapcar '- mid pll) grd)))				; number of cells fit to lower-left quadrand in both directions '(n m)
	       (setq pnt (mapcar '+ (mapcar '- mid (mapcar '* nll grd)) (mapcar '/ grd '(2. 2.))))	; get lower-left point from number of cells.
	       
	       (setq o (if (= (rem (car nll) 2)								; if number of cells in x and y direction are both odd or both even
			      (rem (cadr nll) 2))							; set inition on/off state of circle existence
			 1										; 0 - no circle in cell
			 0))										; 1 - a circle to draw
	       (setq iy 0)
	       )
	
	(repeat (* 2 (cadr nll))							; repeat to move in y direction
	  
	  (setq o (- 1 o)
		ix 0)
	  (repeat (* 2 (car nll))							; repeat to move in x direction
	    (if (= 1 (setq o (- 1 o)))							; each cell change 0/1/0 and if it's equal to 1
	      (circle (mapcar '+ pnt (list (* ix grx) (* iy gry))) (/ dia 2.)))		;  ... then draw a circle
	    (setq ix (1+ ix)))								; counter to move in x-dir by 1 cell
	  
	  (setq iy (1+ iy))))))								; counter to move in y-dir by 1 cell
  (princ)
  )

About the pattern - there is o variable in the code which stops every second circle from drawing. It changes its value 0-1-0-1-0-1.... across whole row, than makes one more step before next row... and again going thru a row changing 1-0-1-0...

 

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

There are a lot of mapcar's in the code. I might look difficult to understand... but all those are used very similar way...

Here is one example of used pattern:

(mapcar '+ '(1 2) (list 5 7))

which is: mapcar 'function one-list second-list

all it does is applying the function to each member of lists respectively.

(mapcar '+ '(1 2) (list 5 7))        ===              '(1+5      2+7)               === '(6 9), which is the result.

 

The reason for mapcar usage soooo many times is to do the same operation for x and y coordinates at same time.

See this function from the actual code:

(setq pnt (mapcar '+
		  (mapcar '-
			  mid
			  (mapcar '*
				  nll
				  grd))
		  (mapcar '/
			  grd
			  '(2. 2.))))

 

then the same rewritten just for X coordinate:

(setq pnt-x (+
	      (-
		mid-x
		(*
		  nll-x
		  grd-x))
	      (/
		grd-x
		2.)))

...then you will have to the similar with Y coordinate... or just use a mapcar.

Once you understand to mapcar, I guess would be easy to understand the whole code and adjust that in future by your needs.

 

 

BTW If you feel like Kent's code is more understandable to you, please go ahead and use it. I did a quick test with about 70000 holes... and the performance is just about similar, you probably won't notice a difference - thought my routine is about 10% faster than Kent's.

 

HTH and have fun! Cheers!

0 Likes
Message 20 of 22

Anonymous
Not applicable

@ВeekeeCZ 

@Kent1Cooper 

I just want to say you guys are extremely brilliant, and I appreciate all your help and time! 

What I see here is 2 extremely nice and flawless codes they do exactly what I need them to do. The only difference in them is the ability to select multiple at a time which i prefer.

To @Kent1Cooper

I did realize that the scientific expression you used "1e-4" was only pulling the precision out the 4th decimal which was throwing it off since I have to be to the 8th decimal so I adjusted that and all was well.

I love learning so much from the experts. 

@ВeekeeCZ 

Thank you for the revised code and explanation.

Also thanks for all the info on the mapcar I'm definitely going to study more of that!!

 

 

0 Likes