Jump to content

Recommended Posts

Posted

Hi, does anyone know how to change roughly 1000 points into actual entities/circles/donuts something i can work with.

Posted (edited)

If you go to the web site of Jeffery P Sanders, there is a lisp called NodeSert which will insert a block at every node in a drawing. If you make a block with entities of your choice, then you can explode all blocks after using the lisp. :D

Edited by eldon
OOps, I just saw LT, so you can't do the above
Posted

Here is mine I have just made it for your purpose .

(defun c:Pt2Circles (/ ss)
 ; Tharwat Nov 25 . 2010
(if (setq ss (ssget "_:L" '((0 . "POINT"))))
 ((lambda (i / a )
  (while
    (setq a (ssname ss (setq i (1+ i))))    
 (entmakex (list (cons 0 "CIRCLE")
                 (cons 10 (cdr (assoc 10 (entget a))))
                 (cons 40 0.2)))[color=red]; <-- You can change the Radius of the Circles[/color]
   (entdel a)
   )
    )
   -1
   )
 (princ "\nNo points selected")
 )
 (princ)
 )

Hope you like it . :)

 

Tharwat

Posted

Cheers for the reply, altering the point style doesn't really solve the problem, i need to hatch the nodes/circles/points

Posted

I did modify my previous routine to meet your needs with Hatch .

 

(defun c:Pt2Circles (/ ss)
 ; Tharwat Nov 25 . 2010
(if (setq ss (ssget "_x" '((0 . "POINT"))))
 ((lambda (i / a ss1)
  (while
    (setq a (ssname ss (setq i (1+ i))))
    (setq ss1 (ssadd))    
 (ssadd (entmakex (list (cons 0 "CIRCLE")
                 (cons 10 (cdr (assoc 10 (entget a))))
                 (cons 40 0.2)))
   ss1)
 (command "_.-hatch" "_p" "_solid" "_s" ss1 "" "")
    (entdel a)
   )
    )
   -1
   )
 (princ "\nNo points selected")
 )
 (princ)
 )

:)

 

Tharwat

Posted
works great thanks

 

Glad you like it.

 

You're welcome any time . :)

 

Tharwat

Posted

Hi Tharwat,

 

Nice work :)

 

I would be more inclined to use something like this to retain the layer/linetype/lineweight etc properties of the original points:

 

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:pt2circles [b][color=RED]([/color][/b] [b][color=BLUE]/[/color][/b] rad ss [b][color=RED])[/color][/b]
 [i][color=#990099];; © Lee Mac 2010[/color][/i]

 [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] rad [b][color=#009999]0.2[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; Circle Radius[/color][/i]

 [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=#a52a2a]"_:L"[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED](([/color][/b][b][color=#009900]0[/color][/b] [b][color=DARKRED].[/color][/b] [b][color=#a52a2a]"POINT"[/color][/b][b][color=RED]))))[/color][/b]
   [b][color=RED]([/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]lambda[/color][/b] [b][color=RED]([/color][/b] i [b][color=BLUE]/[/color][/b] e el [b][color=RED])[/color][/b]
       [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]ssname[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] i [b][color=RED]([/color][/b][b][color=BLUE]1+[/color][/b] i[b][color=RED]))))[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] el [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] e[b][color=RED]))[/color][/b]
         [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b]
           [b][color=RED]([/color][/b][b][color=BLUE]entmakex[/color][/b]
             [b][color=RED]([/color][/b][b][color=BLUE]apply[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]append[/color][/b]
               [b][color=RED]([/color][/b][b][color=BLUE]subst[/color][/b] [b][color=BLUE]nil[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]50[/color][/b] el[b][color=RED]))[/color][/b]
                 [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]list[/color][/b]
                   [b][color=RED]([/color][/b][b][color=BLUE]append[/color][/b]
                     [b][color=RED]([/color][/b][b][color=BLUE]subst[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]0[/color][/b] [b][color=#a52a2a]"CIRCLE"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]0[/color][/b] el[b][color=RED])[/color][/b] el[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]40[/color][/b] rad[b][color=RED]))[/color][/b]
                   [b][color=RED])[/color][/b]
                 [b][color=RED])[/color][/b]
               [b][color=RED])[/color][/b]
             [b][color=RED])[/color][/b]
           [b][color=RED])[/color][/b]
           [b][color=RED]([/color][/b][b][color=BLUE]entdel[/color][/b] e[b][color=RED])[/color][/b]
         [b][color=RED])[/color][/b]
       [b][color=RED])[/color][/b]
     [b][color=RED])[/color][/b]
     [b][color=#009900]-1[/color][/b]
   [b][color=RED])[/color][/b]
 [b][color=RED])[/color][/b]

 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b]
[b][color=RED])[/color][/b]

 

Also I would advise to check that the creation of the circle was successful before deleting the point from the drawing. :)

 

Just some constructive criticism :)

Posted

Hi Tharwat,

Nice work :)

 

I would be more inclined to use something like this to retain the layer/linetype/lineweight etc properties of the original points:

 

Also I would advise to check that the creation of the circle was successful before deleting the point from the drawing. :)

 

Just some constructive criticism :)

 

Thank you Lee.

 

But how to retain the layer/linetype/lineweight since that you did not use the (cdr (assoc 8 el)) to get that come true ?

 

To check for the creation of Circles before deleting points that's really a very good idea . I like it.

 

Your way of using the (apply 'append (subst .... within the entmakex is really shows a very deep understanding of codes. It's wonderful franckly.

 

Tharwat

Posted
But how to retain the layer/linetype/lineweight since that you did not use the (cdr (assoc 8 el)) to get that come true ?

 

The code uses the values that are already present in the DXF data of the points - just replacing the necessary parts to make the DXF data into that which could represent a Circle.

 

Your way of using the (apply 'append (subst .... within the entmakex is really shows a very deep understanding of codes. It's wonderful franckly.

 

Thanks Tharwat, but I cannot take all the credit - the use of (subst nil ...) is a technique to remove a list item without using Visual LISP functions that I have seen used elsewhere in the past and so applied it to this situation - I might usually use vl-remove-if, or vl-remove :)

Posted

The code uses the values that are already present in the DXF data of the points - just replacing the necessary parts to make the DXF data into that which could represent a Circle.

 

Suppose that the current layer is not the same Layer which points are laying on , so the created Circles would be

created under the current Layer Name. Am I right ? :)

Posted
Suppose that the current layer is not the same Layer which points are laying on , so the created Circles would be

created under the current Layer Name. Am I right ? :)

 

In your code: yes.

 

In my code: no, the circle inherits the layer of the point.

Posted

Oh yeah , I guess that was due to the use of function *subst*.

 

You are right .:)

 

Thank you

Posted

If you have civ3d as you posted its a pain in the backside but you could create a point style that just matches a block etc but you can not explode them, our survey points have trees, valves, covers 100+ symbols etc it part of the point group properties to attach a block to a point. Why re-invent no dis-respect to the lisp programs provided.

Posted
Why re-invent no dis-respect to the lisp programs provided.

 

Definitely - in-built functionality should take priority over LISP in 99% of cases - else the user is demonstrating a lack of knowledge of the program (I know I have in the past...)

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...