Jump to content
Developer Wiki and Function Reference Links ×

Line text to text block


hong

Recommended Posts

Hi Hong,

One simple script to merge blocks is the following:

code:

procedure mergetext;

const

CR = chr(13);

var

texthandle : handle;

list : handle;

counter : integer;

FUNCTION merge_text(h:HANDLE):BOOLEAN;

begin

if counter = 1 then

texthandle := h

else

begin

SetText(texthandle,concat(GetText(texthandle),CR,GetText(h)));

delobject(h);

end;

counter := counter+1;

merge_text := false;

end;

begin

texthandle := NIL;

counter := 1;

{cycle through selected objects}

ForEachObjectInList(merge_text,2,1, list);

end;

run(mergetext);
[/code]

In simple words, select the text blocks you want to merge, then launch this script.

It should copy the content of each text block into the first of the list deleting the no more needed blocks.

Note 1. The order (in the stack of objects) in the DWG you converted may be reversed, so if your final text results upside-downed, simply exchange the two members in the concatenation expression.

Note 2. The constant CR (carriage return) is set to chr(13) for the Mac side of the world. If you are a Window user, you should use something like chr(10)+chr(13) to get the carriage return.

If you want no carriage return at all, simply set CR to ' ' (one space) or '' (nothing).

Hope this helps you,

bye

Link to comment

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