Jump to content

Inserting the same Block to multiple points in drawing


Recommended Posts

Posted

I want to insert a block called "Valveblock22" on a layer called "Valve22" I have approximately 4,000 points that this block needs to be added to. Is there a way I can do this easily? A lisp progaram or something? Any help will be much appreciated.

Posted

I can't actually help although there are plenty around who can but it is relatively easy using LISP or VBA provided your points are available in a sensible format. What format do you have them in?

Posted

Do you have the points as a xyz text file ? You could just do a script use search replace and create as below I have previously mentioned using ^p with MS word.

script would be

insert myblock x,y,z 1 1 0

ie

insert myblock 12,25,0 1 1 0

insert myblock 42,34,0 1 1 0

etc

 

It should only take a couple of minutes here is an example using word to change

47,993.846, 5015.394, 0

46,987.285, 5022.663, 0

45,937.182, 5040.847, 0

44,949.015, 5040.7, 0

43,961.301, 5038.069, 0

42,972.357, 5033.287, 0

41,978.957, 5029.282, 0

 

load into word do the following

find replace ^p with ^pinsert myblock

find replace ^p with 1 1 0^p

 

You will need to edit first line then save as a script please note its hard here to show but watch out for extra spaces they react as if you pressed the enter key see spaces between x & y need to be removed search for ", " replace ","

 

insert myblock 993.846,5015.394,0 1 1 0

insert myblock 987.285,5022.663,0 1 1 0

insert myblock 937.182,5040.847,0 1 1 0

insert myblock 949.015,5040.7,0 1 1 0

note also removed the point number you can vertically delete in word put mouse to top left hold alt key and window via mouse then delete

Posted

If you legitimately have points on your drawing and need blocks there then you could go with something simple like this.

 

(defun c:bins ( / )
 (setq drac 0
   ss (ssget "X" (list (cons 0 "POINT")))
   )
 (setvar "cmdecho" 0)
 (while (< drac (sslength ss))
   (setq pnt (cdr (assoc 10 (entget (ssname ss drac)))))
   (command "-insert" "Valveblock22" pnt 1 1 0)
   (setq drac (1+ drac))
   )
 (setvar "cmdecho" 1)
 )

Posted

I was able to generate a x,y,z point list and followed the steps and it worked fine. Although I needed to take off the last "1" in the sequence. (must be the way I have my insert button set up.)

 

Thanks for the help!

  • 1 year later...
Posted
If you legitimately have points on your drawing and need blocks there then you could go with something simple like this.

 

(defun c:bins ( / )
 (setq drac 0
   ss (ssget "X" (list (cons 0 "POINT")))
   )
 (setvar "cmdecho" 0)
 (while (< drac (sslength ss))
   (setq pnt (cdr (assoc 10 (entget (ssname ss drac)))))
   (command "-insert" "Valveblock22" pnt 1 1 0)
   (setq drac (1+ drac))
   )
 (setvar "cmdecho" 1)
 )

 

 

Hey i have try your LISP for my blocks ( in Civil 3d 2011) and block have showd on one point not on multiple points :(

Posted

Is there any possibility that i can choose block which i wish to insert?:?

  • 11 years later...
Posted

Tried the "Bins" lisp contained in this string....  worked like a dream on 2,973 autocad points - thanks!!!!!!!

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