Jump to content
Developer Wiki and Function Reference Links ×

umlauts - change all Letters form ? to ?


3jalex

Recommended Posts

Hi

Ok. Here a start. How do i find out the rest?

*****************************

Procedure umlaut;

{change letters to others}

{? to ?}

{? to ?}

{? to ?}

{? to ?}

{? to ?}

{February 21, 2012}

Begin

If ...=...(...);

End;

Begin

If ...=...(...);

End;

Run(umlaut);

*******************************

Thanks Alex

Link to comment

I think we need more information about what you are actually trying to do.

Do you want to select a text block and change the letters in the block? Do you want to change every block of text on a layer? In the entire drawing?

Do you want to do just text blocks or do you need to handle other objects like call outs? What about text in records?

This could get to be very complicated if you need all of the above.

The following is very simply tested code. Use at your own risk.

This will change all the occurences of a single character in a selected text block.

Procedure ChangeChar;
{Replaces every occurence of a character in a text block with a new}
{character. Edit this file and change the characters in OldChar and NewChar}
{to be the character to replace and the replacement character}

{February 21, 2012}
{? 2012, Coviana, Inc - Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}

Var	CharArray	:DynArray of Char;
TextBlock	:Handle;
OldChar		:Char;
NewChar		:Char;
CharOffset	:Integer;

Begin
OldChar := '?';
NewChar := '?';

TextBlock := FSActLayer;
CharArray := GetText(TextBlock);

CharOffset:=Pos(OldChar,CharArray);
While CharOffset <> 0 do
	Begin
		Delete(CharArray,CharOffset,1);
		Insert(NewChar,CharArray,CharOffset);
		CharOffset:=Pos(OldChar,CharArray);
	End;
SetText(TextBlock,CharArray);

End;

Run(ChangeChar);

Link to comment

Dear Pat Stanford and community board

Thank you for the script. It is almost wath I am looking for.

Somehow it does not work on my pc.

It may have to do how the Arial is definded on the pc?s.

When I import a AutoCAD.dwg into Vectorworks.vwx some character will be changed.

The script shall simply change them back without selecting anything. Like Text>Search and change>Text?

Here you can only chane one character at the time. The script can do more character at the time. The character are:

OldChar := '?? to NewChar := '??

OldChar := '?? to NewChar := '??

OldChar := '?? to NewChar := '??

OldChar := '?? to NewChar := '??

OldChar := '? to NewChar := '?

OldChar := '?? to NewChar := '??

On any class or layer.

Some character may not apear in the drawing.

Thank you so much.

Link to comment

OK, try this one. Change the characters in the Const section to be the ones you want. There must be a 1:1 match between the OldChars and NewChars strings.

It will replace all of the characters in Text Blocks. It will not do anything to other types of objects.

I recommend that you completely replace OldChars and NewChars. It is possible that the Mac I am on has different character codes than the PC you are on.

Procedure ChangeAllChars;
{Replaces every occurence of characters in the OldChars sring in all text block with}
{the corresponding character from the NewChars string. Edit this file and change the}
{characters in OldChar and NewChar to be the character to replace and the replacement character}

{Change the OldChars and NewChars strings in the Const section to be the characters to}
{be replaced. There must be a 1:1 match between the two strings.}
{February 25, 2012}
{? 2012, Coviana, Inc - Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}

const	OldChars = '?S';
	NewChars ='?Z';

Var	CharArray	:DynArray of Char;
TextBlock	:Handle;
OldChar		:Char;
NewChar		:Char;
CharOffset	:Integer;
OldCharsLength : Integer;

Procedure ProcessTextBlock(H1:Handle);

var	CharCount : Integer;

Begin
	TextBlock := H1;
	CharArray := GetText(TextBlock);

	For CharCount := 1 to OldCharsLength do
		Begin
			OldChar := Copy(OldChars,CharCount,1);
			NewChar := Copy(NewChars,CharCount,1);

			CharOffset:=Pos(OldChar,CharArray);
			While CharOffset <> 0 do
				Begin
					Delete(CharArray,CharOffset,1);
					Insert(NewChar,CharArray,CharOffset);
					CharOffset:=Pos(OldChar,CharArray);
				End;
			SetText(TextBlock,CharArray);		
		End;
End;

Begin
OldCharsLength := Len(OldChars);
ForEachObject(ProcessTextBlock,((T=TEXT)));
End;

Run(ChangeAllChars);

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