Jump to content

AutoLISP to convert text to block


Recommended Posts

Posted

Ok I searched around but apparently there is no right way to word this. Basically I have current AL to work with current blocks. I have a new customer who provides me with information I would normally have put into the block myself. What I would like to have happen is for something involving AutoLISP to take a piece of text and put that information into the current block, or something similar that the current AutoLISP can work with, so I can still gain the benefit of the customer providing me with this info now regards

Posted

mr. tony hotchkiss got at TEXT2ATT.LSP have a look at cadalyst.com

Posted

Wisman, Thats a great start and thanks for the lead. That actually does a lot of what I need it to do. It looks exactly what i need to look like as well. The existing block has three attributes and this has one. Basically my current block has street name (which is derived by selecting the block of a current street name) and then the address and number of units. What I would like to do is select the street name, then a range of addresses (currently in text) and then have all this information placed in a block for each piece of text which would resemble my current block so that i can use yet another LISP on it. thanks

Posted

stephen could you please post a sample drawing with your block with attributes. so that guys here can take a look at your goal.

  • 2 years later...
Posted
What are you trying to achieve cadplayer?

 

I think it would be very nice to convert text in blocks with attribut. I doesn´t find this tool on cadalyst.

Posted
I think it would be very nice to convert text in blocks with attribut. I doesn´t find this tool on cadalyst.

 

Use BEDIT on the block, then use this to convert Text to Attribute Definitions:

 

[color=GREEN];;-------------------=={ Text 2 Attribute }==-----------------;;[/color]
[color=GREEN];;                                                            ;;[/color]
[color=GREEN];;  Converts single-line text to an attribute definition.     ;;[/color]
[color=GREEN];;------------------------------------------------------------;;[/color]
[color=GREEN];;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;[/color]
[color=GREEN];;------------------------------------------------------------;;[/color]

([color=BLUE]defun[/color] c:txt2att ( [color=BLUE]/[/color] el i ss st ) ([color=BLUE]vl-load-com[/color])
 
 ([color=BLUE]if[/color] ([color=BLUE]setq[/color] ss ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"TEXT"[/color]))))
   ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] ss))
     ([color=BLUE]setq[/color] el ([color=BLUE]entget[/color] ([color=BLUE]ssname[/color] ss ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i))))
           st ([color=BLUE]vl-string-translate[/color] [color=MAROON]" "[/color] [color=MAROON]"_"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 1 el)))
     )
     ([color=BLUE]if[/color]
       ([color=BLUE]entmakex[/color]
         ([color=BLUE]append[/color] '((0 . [color=MAROON]"ATTDEF"[/color]))
           ([color=BLUE]vl-remove-if[/color] '([color=BLUE]lambda[/color] ( pair ) ([color=BLUE]member[/color] ([color=BLUE]car[/color] pair) '(0 100 73))) el)
           ([color=BLUE]list[/color]
             ([color=BLUE]cons[/color] 70  0)
             ([color=BLUE]cons[/color] 74 ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 73 el)))
             ([color=BLUE]cons[/color]  2 st)
             ([color=BLUE]cons[/color]  3 st)
           )
         )
       )
       ([color=BLUE]entdel[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] -1 el)))
     )
   )
 )
 ([color=BLUE]princ[/color])
)

Posted

yes this is very good. Is it possible to do attributs in a block.

That means to convert text in attribut and paste in a block.

Posted

I assume you're asking for the reverse of what I have just provided? Yes, it would be possible, following the same method as I have in my previous code.

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