Jump to content


Fillet several polylines

Fillet Polyline

4 replies to this topic

#1 Adriano

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 25 January 2024 - 07:33 PM

Hello!

I have tried to make (with no success) a lisp to fillet several polylines at the same time.

Why?

I have a CNC machine for leather cut, and the cornes of the shapes must be filleted with 1mm radius. The dxf files have many polylines, and I need to click one by one... total sum is almost 10000 polylines!!!

The ideia is make a "macro" or a lisp file, to change all the corners with one command.

I have tried with this code (its a code for autocad):

(vl-load-com)

(defun c:filetartudo (/ ss polyline filletedObj)
(setq ss (ssget "_X" '((0 . "LWPOLYLINE"))))
(if ss
(progn
(setq cnt 0)
(repeat (sslength ss)
(setq polyline (ssname ss cnt))

; Get the polyline as a VLA-object
(setq polyObj (vlax-ename->vla-object polyline))

; Tenta aplicar o fillet diretamente usando o método VLA-FILLET
(setq filletedObj
(vl-catch-all-apply
'vla-fillet
(list
polyObj
1.0 ; Raio do fillet configurado em 1
)
)
)

; Verifica se ocorreu algum erro durante a chamada
(if (vl-catch-all-error-p filletedObj)
(princ (strcat "\nError filleting polyline: " polyline))
; Se não houve erro, continue com o próximo polyline
(setq cnt (1+ cnt))
)
)
(princ "\nFillet aplicado para todas polilinhas.")
)
(princ "\nNão há polilinhas.")
)
(princ)
)

I have an error in the line: (setq polyObj (vlax-ename->vla-object polyline))

Someone can help with this?

Thanks

#2 Dsw

    Member

  • Members
  • PipPip
  • 17 posts

Posted 26 January 2024 - 09:32 AM

Hi Adriano,
may you share a sample file?

Would be interesting to know which nanoCAD Release are you using?

#3 Adriano

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 26 January 2024 - 01:46 PM

Hi,

Thank you for your answer.

I use the free nanocad version (5.0.2520.1471 - COMMERCIAL).

Here are two files as an example. The file "filetartudo.txt" need to be renamed for "filetartudo.lsp". The lisp file is already loaded in the dxf.

To use the command, you have to type "filetartudo" in nandocad

Thanks!

Attached Files



#4 Dsw

    Member

  • Members
  • PipPip
  • 17 posts

Posted 27 January 2024 - 08:26 PM

NanoCAD 5.0 the fillet dialog box (as much I know) can't be hidden breaking a simple automation script to do the job, that mean more time to develop a automation script.

I'm sorry but I've no time to do it for you, but maybe you will find the answer to your question on follow link
lisp - I need an AutoLISP for fillet command - Stack Overflow

#5 Adriano

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 29 January 2024 - 10:02 AM

Newbie. Thank you very much! I will try there.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users