Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MakeName() Failing

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
justinrice
560 Views, 4 Replies

MakeName() Failing

Has anyone experienced this while using the MakeName Function.  When I run the following in the immediate window:
MakeName("Test" & char(160) & "String")
I get this error:

MakeName Error.png


It appears MakeName as a problem with converting the ascii Character 160.

 

Engineering Intent
JustinRice@EngineeringIntent.com
4 REPLIES 4
Message 2 of 5
JackGregory
in reply to: justinrice

This is an interesting error message, but MakeName needs to have a legal Name in the string it is given, and char(160) is not a legal name character.  160 is Unicode 00A0, which is a non-breaking space, which is considered whitespace, and these are not legal in identifiers.  I agree the error message could be a lot more clear, but that is the bottom line.

 

The workaround is to use a legal name character.  The rules for names and identifiers are in the help.

Message 3 of 5
ebachrach
in reply to: justinrice

Perhaps for your needs you could use char(32), which is supported?

Elly


--
Autodesk
Elly Bachrach
ETO/CTO Solutions Designer
Intelligent Configuration Solutions
Mobile +1 (773) 401-6980
elly.bachrach@gmail.com

************************************************************************************
If this post helps, please click the "thumbs up" to give kudos
If this post answers your question, please click "Accept as Solution"
************************************************************************************
Message 4 of 5
justinrice
in reply to: ebachrach

Thanks Elly that is exactly what I did:

 

<%%Category("CustomFunctions")> _
Function CustomMakeName( str As String) As Name
	Dim s_ModStr As String = NoValue
	If str.contains(Char(160)) Then 
		 s_ModStr = StringReplace(str, Char(160), Char(32))
	Else
		s_ModStr = str
	End If
	
	Return MakeName(s_ModStr)
 
End Function

 

Engineering Intent
JustinRice@EngineeringIntent.com
Message 5 of 5
JackGregory
in reply to: justinrice

Since MakeName is documented to replace "illegal" characters with an underscore, I have entered a defect DE2116 to get it fixed.

 

In addition, based on this question, we discovered that the Name datatype had been left out of the documentation!  That too, is getting fixed.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report