ramis Posted September 2, 2008 Share Posted September 2, 2008 Good morning, I have checked on the forum if there's an existing thread for this but i haven't find one. I have a little question concerning AutoCAD. Is it possible to easily put a point for each block of a type. for example, I have some blocks with name 'WPI2 601' on a layer 'WPI 26'. Is there a way to select all theses type of blocks and for each blocks to put a point at the coordinates of the blocks... I have many different blocks and many blocks (and also many files) so i can't do it manually. It will take too much time... and i can forget some of them. Thanks for your help, Ramis Quote Link to comment Share on other sites More sharing options...
fuccaro Posted September 2, 2008 Share Posted September 2, 2008 To put a point? How would you use this information? How about a text file containing a list with name, ins point and layer for each block in the drawing? It can be done with Lisp. Also it can be set to batch process all the drawing in a directory. You could open that file in Excel and reorder it as you wish. Would that help you? Quote Link to comment Share on other sites More sharing options...
ramis Posted September 2, 2008 Author Share Posted September 2, 2008 The AutoCAD will be put in a software to convert the information in an other format. But for the convertion to be good, the point object has to be set as point on the dxf file. The block are not conveted. But on my file, these objects are drawing with a block to have a more understandable chart. That's why I want to select each types of block to put a point for them to be converted. I maybe try to do this with a lisp but i am not very familiar with that language... I only use AutoCAD to prepare and reorganise the dxf files to have the best convertion possible with the maximum object converted to minimise the work then... I don't know if my explanations and my English are clear... Quote Link to comment Share on other sites More sharing options...
e.mounir Posted September 2, 2008 Share Posted September 2, 2008 I have lisp maybe help you but it will put the coordinate point in table and will starting by point No e.g N E P1 323213215 998655566 P2 326665832 996586223 starting the lisp with TH Settingoutfinal.lsp Quote Link to comment Share on other sites More sharing options...
ramis Posted September 2, 2008 Author Share Posted September 2, 2008 Thank you for your lisp function. But this function seems made the points manually. I am searching a way to do this automatically... I think that I have to filter all the block of the same type to select them and then, draw a point at their coordinates. I have here a lisp function that should work but I don't know how to select the block correctly. The problem comes from this line (setq ss (ssget '((0 . "BLOCK")(8 . "WPI26")))) where the selection is said to be nil. But when i am clicking on a block, it's this layer WPI26 that appears and the name of the block is WPI2 601... (defun c:bck2pt () (princ "\nSelect blocks: ") (setq ss (ssget '((0 . "BLOCK")(8 . "WPI26")))) (setq Item 0) (repeat (sslength ss) (setq Ename (ssname ss Item)) (setq CtrPt (cdr (assoc 10 (entget Ename)))) (command "._point" CtrPt) (setq Item (+ 1 Item)) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
RobDraw Posted September 2, 2008 Share Posted September 2, 2008 Here's a way to do it without lisp. Create a block out of a point. Then use "blockreplace". You can then "convert" those blocks to points by exploding them. Quote Link to comment Share on other sites More sharing options...
ramis Posted September 2, 2008 Author Share Posted September 2, 2008 I think that it will be easier for me to use a lisp because i have other things to do on the files so i will include this into a script... I can select the block of the type that i want using (setq ss (ssget "_x" '((0 . "INSERT")(8 . "WPI26")))) here, the selection is not empty... but when i run the lisp function with (setq ss (ssget '((0 . "INSERT")(8 . "WPI26")))) it is said " ; error: bad argument type: lselsetp nil " this lisp function was originally to draw a point at the center of a circle, selecting the circle with the command (setq ss (ssget '((0 . "CIRCLE")(40 . 7.5)))) maybe there is something to change in the rest of the lisp function to get the coordinates of the block... Quote Link to comment Share on other sites More sharing options...
ASMI Posted September 2, 2008 Share Posted September 2, 2008 Try this: (defun c:b2p(/ sBl cLay bSet) (if(and (setq sBl(entsel "\nPick sample block > ")) (setq cLay(cdr(assoc 8(entget(car sBl))))) (setq bSet(ssget "_X" (list '(0 . "INSERT")(cons 8 cLay)))) ); end and (progn (princ(strcat "\n"(itoa(sslength bSet)) " blocks found. ")) (sssetfirst nil bSet) (initget 1 "Yes No") (setq cAns(getkword "\nAdd points? [Yes/No]: ")) (if(= "Yes" cAns) (mapcar '(lambda(x)(command "_.point" (cdr(assoc 10(entget x))))) (vl-remove-if 'listp (mapcar 'cadr(ssnamex bSet)))) ); end if ); end progn ); end if (princ) ); end of c:b2p Quote Link to comment Share on other sites More sharing options...
e.mounir Posted September 3, 2008 Share Posted September 3, 2008 GOOD JOB WELL DONE Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.