Jump to content

change point to line (0 lengths) and block reference to text???


Recommended Posts

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • fuccaro

    11

  • lifeis

    9

  • tuti

    5

  • eldon

    1

Top Posters In This Topic

Posted Images

Helo Tuti, welcome in the forum!

 

To convert all the points in a drawing you should use a Lisp routine. As for replacing blocks: what text should appear in the drawing? The block name? or maybe an attribute?

Please provide more info.

Link to comment
Share on other sites

It should appear block name. Problem with 0 lengths lines was MicroStation problem not Acad, and I solved it in Microstation.

 

Thanks

Link to comment
Share on other sites

This should replace the blocks with their names:

(defun c:blnames()
 (setq ss (ssget "X" (list (cons 0 "INSERT"))))
 (repeat (setq i (sslength ss))
   (setq b1 (ssname ss (setq i (1- i)))
  poz (cdr (assoc 10 (setq bl (entget b1))))
  name (cdr (assoc 2 bl))
  )
   (entmake (list (cons 0 "TEXT") (cons 1 name) (cons 10 poz) (cons 40 2)))
   (entdel b1)
   )
 )

In the FAQ section you can get help for runing Lisp routines

Link to comment
Share on other sites

  • 4 weeks later...

Hi fuccaro

 

is it posible to change code, that lisp replace blocks to text only in corrent layer and not in all layers?

 

Thanks

Link to comment
Share on other sites

Yes, it is possible -but only after two days. I am at home. If until that nobody else helps you, I will change the Lisp for you.

Link to comment
Share on other sites

Try this. It is not tested -but it should work.

(defun c:blnames()
 (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 8 (getvar "CLAYER")))))
 (repeat (setq i (sslength ss))
   (setq b1 (ssname ss (setq i (1- i)))
  poz (cdr (assoc 10 (setq bl (entget b1))))
  name (cdr (assoc 2 bl))
  )
   (entmake (list (cons 0 "TEXT") (cons 1 name) (cons 10 poz) (cons 40 2)))
   (entdel b1)
   )
 )

Link to comment
Share on other sites

  • 1 year later...

I know that this thread is really old and is totally dead, but I really need help and I cannot find the answer anywhere plus this saves me creating a new thread.

My problem is exactly the same as above (with having to convert Block Attributes to Text) this is so I can to a SrxTEXT lisp on the drawing. But I need the new Text value to be the Attribute, not the Block Name.

Eg. 'Name' - 'myname'

'SecondName' - 'mysecondname'

I would want the 'myname' and 'mysecondname' to be changed to text on the drawing, not the Block Name.

Hope you understand what I mean.

Please help if you could guys, its greatly appreciated.

Thanks!

Edited by lifeis
Link to comment
Share on other sites

Anyone?

Please guys, I have been trying to find an answer to this simple question for days now on every Forum I can find.

I would really appreciate any help if you could.

Thanks guys.

Link to comment
Share on other sites

Does AutoCAD 2010 have the BURST command? It does mainly what you expect: it explodes the blocks and replaces the attributes with their text value.

It is not hard at all to start new threads in this forum.

You just signed in and you are so hurry! Let us to have a deep breath before we try to answer you :)

 

Welcome in the forum!

Link to comment
Share on other sites

Thanks!

Sorry about being in a hurry, I have been just trying to talk to someone for days and days, I stayed up late last night and finnished looking up all 5000 tags on the drawing one at a time by hand.

Still want to find the answer though for the future, as we have to do this job quite alot at my work.

AutoCAD2010 does have the BURST command. I have ran it now, and it worked!

I think that what I really want is impossible though, ill try to explain:

The drawings have these blocks which I need converted to text (just exactly like the Burst command does) although, the Blocks consist of two lines of text, eg:

TT

6634

 

I wanted each block to be converted to text in one. But BURST obviously converts each single line to text, meaning I cant search for the Tag using SrxText, as I can only search for the top line OR bottom line, not both.

Could this be possible by writing a script or something?

Thanks alot for the reply. I really appreciate your help.

Craig

Link to comment
Share on other sites

Here is a small section of one of the Drawings so you can see what I mean:

 

drawingtags.JPG

 

I need to search the drawing above (all text) for some names which are stored in an Access Database file. I got a script called 'SrxText' which can search and do a find replace for names which are in an Excell spreadsheet. So I copied the Access Table into Excell and just replicated the collum with the values twice (so the script replaces each word with the same word - not deleting anything) and then I could look through the log to check if it was successfull for each, if it was, then it means the tag exists, if it wasn't then it means it doesnt and I can look over the ones which didnt work myself.

 

I figured that the script I got was the best way to go about doing this, but if you have another suggestion then im all for it. Only problem that I didnt see coming was the fact that each Tag on the drawing is a Block with Attributes, and Burst works fine, only it converts each line of text seperately, meaning that my idea wont work.

I hope I have explained all that well enough, I make it sound very confusing. Im not very good at all of this.

Thanks again for all your time and help.

Craig

Link to comment
Share on other sites

So, to make the long story short: you wish to quickly locate the block containing the attributes say RS and 1090. Or just to find out if such a block exists in the drawing. Did I understand your problem?

Link to comment
Share on other sites

Like this?

(defun c:FindTwo()
;| Searches for blocks having two specific attributes
   Fuccaro Miklos
   2010.12 |;
 (setq ss (ssget "X" (list '(0 . "INSERT") '(66 . 1))))
 (setq a1 (getstring "\n1st attribute to search for ")
   a2 (getstring "\n2nd attribute to search for ")
   found 0
   )
 (repeat (setq i (sslength ss))
   (if (check (ssname ss (setq i (1- i))) a1 a2) (setq found (1+ found)))
   )
 (strcat " ---> " (itoa found) " block(s) found")
 )
(defun check (en a1 a2)
 (setq hit 0 a0 (cdr (assoc 0 (setq el (entget en)))))
 (while (/= a0 "SEQEND")
   (if (= a0 "ATTRIB") (if (member (cdr (assoc 1 el)) (list a1 a2)) (setq hit (1+ hit))))
   (setq a0 (cdr (assoc 0 (setq el (entget (setq en (entnext en)))))))
   )
 (= hit 2)
 )

Link to comment
Share on other sites

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