Mass Fillet Group of Lines

Mass Fillet Group of Lines

rvtquestions
Advocate Advocate
2,432 Views
7 Replies
Message 1 of 8

Mass Fillet Group of Lines

rvtquestions
Advocate
Advocate

Hi I was wondering if the community could help me solve an issue I am facing. What I would like to achieve is mass fillet (at hard edges, 0 radius) 2 groups of lines, with each group containing lines going in the same direction. For example if Group A was a group of HORIZONTAL lines like:

-

-

-

-

 

and Group B was a group of Vertical lines like:

 

| | | | | 

 

 

I would like to fillet the lowest line of Group A to the first line starting on the left of Group B and so on.

____

___  |

_   |  |

  |  |  |

 

I imagine the initial logic would be to prompt selection of group A and sort them according to their respective Y values, then prompt selection group B and sort them to their respective X values and then fillet index[x] of group A to group B. I would also like this to work regardless if the counts of lines in each group don't match up. If group A has 10 lines but group B has 5 lines, it would just do 5 sets. I suppose the logic to test this would be to get the list count of each group and whichever is smaller....For loop that resulting count and fillet index[x] of each respective group. Any ideas? Thank you!

0 Likes
2,433 Views
7 Replies
Replies (7)
Message 2 of 8

Kent1Cooper
Consultant
Consultant

A Search will find some things already around here, or on other sites [for example, this thread could be just the thing, or this may be close to doing what you want].

Kent Cooper, AIA
0 Likes
Message 3 of 8

john.uhden
Mentor
Mentor

My guess is that each of the horizontal and vertical lines was created by offsetting a previous one.  If the offsets are the same for horizontal and vertical, then I recommend you use a different approach... make the first pair (horizontal and vertical) into a polyline and then just offset as many times as you need and each one will have filleted corners.  Since you want sharp corners, remember to set OFFSETGAPTYPE to 0 first.

 

0 = sharp corners (line segments are extended or trimmed to meet)

1 = rounded corners (radius = offset when toward the outside, otherwise 0)

2 = chamfered corners

 

Use an OFFSETGAPTYPE of 1 when creating a setback line from say a wetlands boundary; there's no sense losing more land than you have to.

John F. Uhden

Message 4 of 8

rvtquestions
Advocate
Advocate

Unfortunately that assumption is incorrect. Like you said if that were the case, a simple offset lisp would do the job. I appreciate the comments but I think the main big idea is being missed here. If I can rephrase the question, I am hoping someone could help translate the psuedo code I've laid out:

 

- User prompt select group A of curves; Sort list of curves by Y values

- User prompt select group B of curves; Sort list of curves by X values

- Compare list count of A & B, whichever is smaller = X

- For i in X:

 Fillet groupA[i] with groupB[i]

 

 

 

0 Likes
Message 5 of 8

Kent1Cooper
Consultant
Consultant

Have you tried the code attached to Post 9 on the first link in my previous Reply?  It seems [in brief testing] to do exactly that, except that the Lines don't need to be orthogonal, so the sorting it does isn't strictly by X or Y coordinate.  Depending on your version, you may need to tweak some parts of it -- see later Posts on that same thread.

Kent Cooper, AIA
0 Likes
Message 6 of 8

Ranjit_Singh
Advisor
Advisor

Try below for example. Order of selection matters

;;Ranjit Singh
(defun c:somefunc ( / p1 adoc) (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object)))) (setvar 'filletrad 0) (foreach x (mapcar 'cons (mapcar 'cadr (ssnamex (ssget "_f" (list (setq p1 (getpoint "\nBegin selecting first group: ")) (getpoint "\nEnd selecting first group: " p1))))) (mapcar 'cadr (ssnamex (ssget "_f" (list (setq p1 (getpoint "\nBegin selecting second group: ")) (getpoint "\nEnd selecting second group: " p1)))))) (command "._fillet" (nentselp (cdr (assoc 10 (entget (car x))))) (nentselp (cdr (assoc 10 (entget (cdr x))))))) (vla-endundomark adoc))

Multi_Fillet.gif

0 Likes
Message 7 of 8

ВeekeeCZ
Consultant
Consultant

Do you want make cross-connestione as well? By "group", do you mean autocad's group or just a group.

Maybe selection of 2 points (the second by getcorner) should be just enough to pair the x-dir and y-dir fence selection...

0 Likes
Message 8 of 8

ВeekeeCZ
Consultant
Consultant

Just little playing around this. Prior goal was to allow a window selection. Then, since the both groups could be quite far away, I've kept a separate selection possible as well. If you want to use the second method, you need to make the window selection almost vertical or horizontal... (side ratio less than 1:0.25)

See the SCREENCAST

Just for fun... The main function took from Ranjit's code, just little adjusted... it's nice though, sophisticated afaict.

 

(defun c:FilletM ( / *error* adoc oVAR nVAR p1 p2 p3 p4 p5)

    (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (mapcar 'setvar nVAR oVAR)
    (vla-endundomark adoc)
    (princ))
  
  (setq oVAR (mapcar 'getvar (setq nVAR '(FILLETRAD PICKSTYLE OSMODE))))
  (mapcar 'setvar nVAR '(0 0 0))
  
  (vla-endundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
  (vla-startundomark adoc)

  (if (and (setq p1 (getpoint "\nSpecify first corner: "))
	   (setq p3 (getcorner p1 "\nSpecify opposite corner: "))
	   )
    (progn
      (if (or (equal (car p3) (car p1) (abs (* (- (cadr p3) (cadr p1)) 0.25)))
	      (equal (cadr p3) (cadr p1) (abs (* (- (car p3) (car p1)) 0.25))))
	(setq p2 p3
	      p5 (getpoint "\Second group, specify first point: ")
	      p4 (getpoint p5 "\Second group, specify second point: "))
	(setq p2 (list (car p3) (cadr p1) 0.)
	      p4 (list (car p1) (cadr p3) 0.)
	      p5 p1))  
	       
      ; by Ranjit Singh
      (foreach e (mapcar 'cons  
			 (mapcar 'cadr (ssnamex (cond ((ssget "_f" (list p1 p2)))
						      ((ssget "_f" (list p2 p3))))))
			 (mapcar 'cadr (ssnamex (cond ((ssget "_f" (list p5 p4)))
						      ((ssget "_f" (list p4 p3)))))))
	(command "_.FILLET"
		 (nentselp (cdr (assoc 10 (entget (car e)))))
		 (nentselp (cdr (assoc 10 (entget (cdr e)))))))))
  (*error* "end")
)