muck Posted April 25, 2017 Share Posted April 25, 2017 Is there a way to extract text to a variable that is embeded in a block by picking the text in a block insert. I am not interest in extracting attributes. I am looking for something that will extract autocad text (not necessary Mtext). Just AutoCAD text. I would look at something extracts mtext from a block. I am looking for something in Lisp, or VB.net or C# net. I Guess any programming language usable with AutoCAD. Any solutions to this. Thank you, Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 26, 2017 Share Posted April 26, 2017 Here is an old one by Lee-mac, I created a two line text block ; by lee-mac ([color=blue]defun[/color] get-block-entities ( blk [color=blue]/[/color] ent lst ) [color=green];; Define the function, declare local variables[/color] ([color=blue]if[/color] [color=green];; If the following returns a non-nil value[/color] [color=green];; i.e. if the block exists in the drawing[/color] ([color=blue]setq[/color] ent ([color=blue]tblobjname[/color] [color=maroon]"block"[/color] blk)) [color=green];; get the BLOCK entity[/color] ([color=blue]while[/color] ([color=blue]setq[/color] ent ([color=blue]entnext[/color] ent)) [color=green];; Step through the entities in the block definition[/color] ([color=blue]setq[/color] lst ([color=blue]cons[/color] ent lst)) [color=green];; Construct a list of the block components[/color] ) [color=green];; end WHILE[/color] ) [color=green];; end IF[/color] ([color=blue]reverse[/color] lst) [color=green];; Return the list[/color] ) [color=green];; end DEFUN[/color] I then did (entget (nth 0 lst)) ((-1 . <Entity name: 7ffffb4cd60>) (0 . "TEXT") (330 . <Entity name: 7ffffb4cd20>) (5 . "129EE") (100 . "AcDbEntity") (67 . 0) (8 . "DEFAULT") (100 . "AcDbText") (10 -0.930106 -5.26808 0.0) (40 . 2.5) (1 . "bbbb") (50 . 0.0) (41 . 0.7) (51 . 0.0) (7 . "hfs_simplex") (71 . 0) (72 . 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0)) ; look for assoc 0 is "Text" 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.