Fillet for multiple blocks LISP

Fillet for multiple blocks LISP

Anonymous
Not applicable
1,774 Views
9 Replies
Message 1 of 10

Fillet for multiple blocks LISP

Anonymous
Not applicable

I have at least 40 blocks with unique block name. These blocks contain a rectangular polyline of which we like to apply fillet of 2.5 radius to distinguish these blocks from other entity. Could you please help me create a lisp to automatically fillet these blocks when CAD file opens up.

Block Name: AP_NOTE, AP_NOTE_1, AP_NOTE_2, AP_NOTE_3, AP_NOTE_4, and so forth

Fillet Radius: 2.5

 

Let me know if you need more information. Thanks in advance.

0 Likes
Accepted solutions (1)
1,775 Views
9 Replies
Replies (9)
Message 2 of 10

dbhunia
Advisor
Advisor

@Anonymous wrote:

I have at least 40 blocks with unique block name. These blocks contain a rectangular polyline of which we like to apply fillet of 2.5 radius to distinguish these blocks from other entity. Could you please help me create a lisp to automatically fillet these blocks when CAD file opens up.

Block Name: AP_NOTE, AP_NOTE_1, AP_NOTE_2, AP_NOTE_3, AP_NOTE_4, and so forth

Fillet Radius: 2.5

 

Let me know if you need more information. Thanks in advance.


 

Try this ........ in a single drawing......(I do not have any of your sample drawings)

 

(defun C:FRB (/);put temp variables here.....
(setq CMD (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "_.fillet" "_radius" 2.5)
(if (setq Fss (ssget "_A" '((0 . "INSERT")(2 . "AP_NOTE*"))))
   (repeat (setq n (sslength Fss))
	(command "_.-BEDIT" (cdr (assoc 2 (entget (ssname Fss (setq n (- n 1)))))))
	(setq ss (ssget "_A" '((0 . "LWPOLYLINE")(90 . 4)(-4 . "&=")(70 . 1))))
	(repeat (setq n1 (sslength ss))
	      (command "_.fillet" "_polyline" (ssname ss (setq n1 (1- n1))))
	)
	(command "_.BCLOSE")
	(while (> (getvar 'CMDACTIVE) 0)
			(command "_save")
	)
   )
)
(setvar "CMDECHO" CMD)
(princ)
)

 

And for ..............

 


@Anonymous wrote:

I have at least 40 blocks with unique block name. These blocks contain a rectangular polyline of which we like to apply fillet of 2.5 radius to distinguish these blocks from other entity. Could you please help me create a lisp to automatically fillet these blocks when CAD file opens up.

Block Name: AP_NOTE, AP_NOTE_1, AP_NOTE_2, AP_NOTE_3, AP_NOTE_4, and so forth

Fillet Radius: 2.5

 

Let me know if you need more information. Thanks in advance.


 

You have to work with "acaddoc.lsp" or "acad.lsp" file......


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 3 of 10

Anonymous
Not applicable

Thanks. It worked however it only filleted 3 corners of the rectangle. The upper left corner is left not filleted. I can't seem to understand why is this.

0 Likes
Message 4 of 10

dbhunia
Advisor
Advisor

give a sample drawing......

 

possible reason ....at that corner polyline is not mating with each other.....they are crossing each other ........


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 5 of 10

Anonymous
Not applicable

check this out

0 Likes
Message 6 of 10

dbhunia
Advisor
Advisor

Hi

 

This is the data extracted from a rectangle inside a block......

 

 

 

Command: (entget (car(entsel)))
Select object: ((-1 . <Entity name: 233d55efd50>) (0 . "LWPOLYLINE") (330 . <Entity name: 233c3f045d0>) (5 . "842D") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Level 1") (62 . 7) (6 . "Continuous") (370 . 0) (100 . "AcDbPolyline") (90 . 5) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 5.0285 3.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 5.0285 -3.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -5.0285 -3.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -5.0285 3.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 -5.0285 3.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0))

 

And the RED Marked shows the Number of points/vertices of a polyline ....... and here it shows "5" .........

 

Try to place a new rectangle ....... And then try...... you will get desired result......


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 7 of 10

Anonymous
Not applicable

Thanks.

Can we have it any other way?

We can fillet this manually.

0 Likes
Message 8 of 10

dbhunia
Advisor
Advisor
Accepted solution

Try this.........(for your particular requirement)

 

(defun C:FRB (/);put temp variables here.....
(setq CMD (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(command "_.fillet" "_radius" 2.5)
(if (setq Fss (ssget "_A" '((0 . "INSERT")(2 . "AP_NOTE*"))))
   (repeat (setq n (sslength Fss))
	(command "_.-BEDIT" (cdr (assoc 2 (entget (ssname Fss (setq n (- n 1)))))))
	(setq ss (ssget "_A" '((0 . "LWPOLYLINE"))))
	(repeat (setq n1 (sslength ss))
	    (setq l nil)
	    (setq v nil)
            (setq v (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (entget (ssname ss (setq n1 (1- n1))))))
                  l (cons (mapcar '(lambda ( x ) (apply 'mapcar (cons x v))) '(min max)) l)
            )
	    (setq p1 (nth 0 (nth 0 l)))
	    (setq p2 (nth 1 (nth 0 l)))
	    (command "rectangle" "_none" p1 "_none" p2)
(command "_.MATCHPROP" (ssname ss n1) (entlast) "") (command "_.fillet" "_polyline" (entlast)) (entdel (ssname ss n1)) ) (command "_.BCLOSE") (while (> (getvar 'CMDACTIVE) 0) (command "_save") ) ) ) (setvar "CMDECHO" CMD) (princ) )

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 9 of 10

ВeekeeCZ
Consultant
Consultant

Adding the OVERKILL into the process will also fix the issue.

 

(command "_.-BEDIT" (cdr (assoc 2 (entget (ssname Fss (setq n (- n 1)))))))
(command "_.-overkill" "_all" "" "_done")
(setq ss (ssget "_A" '((0 . "LWPOLYLINE"))))

 

0 Likes
Message 10 of 10

Anonymous
Not applicable

This is excellent.

It takes a bit of time but does the work. Superb.

Thanks

0 Likes