Jump to content

i need a lisp to change circles to nodes or points


Recommended Posts

Posted

Hi All i have a problem, dont know if anyone can help, i have 43 drawings done by someone else that i need to change all the circles (and there is thousands of them) to either nodes or points and was hoping there may be a lisp to help. the holes are not uniform and quite random.

 

Cheers Mark

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • MSasu

    10

  • southwood1990

    5

  • Tharwat

    3

  • Dadgad

    3

Top Posters In This Topic

Posted Images

Posted

Hi All i have 43 drawings, done by someone else and need to change all the circles to nodes or points. there is thousands of them and they are random over the drawing, does anyone know if there is a lisp to do this.

 

Cheers Mark

Posted

Not sure that understand - do you want to replace all circle entities with point entities?

What do you mean by nodes? For me that means the Osnap mode used to locate point entities.

Posted

I too have a similar understanding of the OP's request, Mircea.

 

Perhaps the OP will provide more detailed information as to what criteria may be used to either create a selection set, or iterate the potential DBXDocuments, such as layer, etc..

Posted

By the way, there is no need to multiply the post (#1, #2); it will just split the discussion. Please ask a moderator to remove the other ones.

Posted

Welcome to the forum. :)

 

Depending on why you need to do this, and how they will be used, it could be as simple as this.

Open a drawing, turn on your QUICK PROPERTIES (or Properties).

CTRL+A (select all).

By using the dropdown menu you can choose the CIRCLES. This is just an easy way to FILTER all of the circles from the numerous other entities in the drawing.

In quick properties (as shown in first image radii varies) you can see the dimensions of all the circles.

As they are not all of the same size the fields indicate VARIES.

You can click into either the RADIUS or DIAMETER field and enter a very small value, then hit ENTER.

All of the circles will be reduced to such a scale that they will display as points.

You may need to adjust that new dimension, to a larger one than I used in the example, to ensure that it will display when printing.

 

Barring that I am sure someone will supply a lisp, just thought I would throw this quick fix out, in case it would be helpful.

select all circles.jpg

tiny little circles.jpg

Posted

Thanks for the reply the only problem is i have to use the data in a cad cam environment, and it is going to know if it is a point or very small circle and it will try and machine it rather than drill it.

Posted

node not the best description, will need to be points, as i have to run this through a cad cam program.

Posted

Good luck buying a drill bit that size, SEARS won't have it! :beer:

 

Somebody will fix you up, sorry this didn't do it, and I understand.

Lisp is the way to go.

Good luck with it.

Posted

This tool will replace all circles from your drawing with point entities, preserving original features:

;Replace Circles with Points (25-VI-2012)
(defun c:RCP( / );ssetCircles countCircles itemCircle assocCircle assocPoint  )
(if (setq ssetCircles (ssget "_X" '((0 . "CIRCLE"))))
 (repeat (setq countCircles (sslength ssetCircles))
  (setq itemCircle (ssname ssetCircles 0)
        assocCircle (entget itemCircle)
        assocPoint  '((0 . "POINT")))
  (foreach codeDXF '(10 8 410 210)
   (setq assocPoint (append assocPoint (list (assoc codeDXF assocCircle))))
  )
  (if (assoc 62 assocCircle) 
   (setq assocPoint (append assocPoint (list (assoc 62 assocCircle)))))
  (if (assoc 6 assocCircle) 
   (setq assocPoint (append assocPoint (list (assoc 6 assocCircle))))) ;???
  (entmakex assocPoint)
  (ssdel itemCircle ssetCircles)
  (entdel   itemCircle)
 )
)
(prompt (strcat "\nReplaced " (itoa countCircles) " circles."))
(princ)
)

Posted
This tool will replace all circles from your drawing with point entities, preserving original features:
;Replace Circles with Points (25-VI-2012)

(defun c:RCP( / )

 

That didn't take too long!

You've likely made the OP's day.

Masterfully done Mircea. :beer:

Posted

Thank you for your comments, Dadgad, but is just a simple code. Have a nice day, my friend!

Posted (edited)

Maybe this .... ?

 

codes removed 

Edited by Tharwat
Posted

Tharwat, that code will relocate the circles on points in a totally arbitrary order. How this solution is applicable in a technical drawing, where location of the holes (OP is talking about CAM processing) is mandatory?!?

Posted
By the way, there is no need to multiply the post (#1, #2); it will just split the discussion. Please ask a moderator to remove the other ones.

 

Threads are now merged.

Posted

My version:

 

(defun c:c2p ( / e i s )
   (if (setq s (ssget "_X" '((0 . "CIRCLE"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i)))))
           (if (entmake
                   (list
                      '(0 . "POINT")
                       (assoc 010 e)
                       (assoc 008 e)
                       (cond ((assoc 006 e)) ('(006 . "BYLAYER")))
                       (cond ((assoc 039 e)) ('(039 . 0.0)))
                       (cond ((assoc 062 e)) ('(062 . 256)))
                       (cond ((assoc 370 e)) ('(370 . -1)))
                       (assoc 210 e)
                       (assoc 410 e)
                   )
               )
               (entdel (cdr (assoc -1 e)))
           )
       )
   )
   (princ)
)

Posted

Mircea

 

Could you please tell me what is the CAM processing ?

Posted
My version:

...
(cond ((assoc 006 e)) ('(006 . "BYLAYER")))
(cond ((assoc 039 e)) ('(039 . 0.0)))
(cond ((assoc 062 e)) ('(062 . 256)))
(cond ((assoc 370 e)) ('(370 . -1)))
...

Lee, I really like this approach!

Posted
Could you please tell me what is the CAM processing ?

That stands for Computer Aided Manufacturing – if you follow all posts, seems that OP is looking to send the sketch to a machine in his/her shop for mechanical processing. If the holes are relocated, then the final result is useless.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...