Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iProperties number formatting differs in German version of Inventor

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
424 Views, 5 Replies

iProperties number formatting differs in German version of Inventor

My addin populates Custom iProperties for parts in Inventor using the API's. It works great in the English version, but in the German Inventor the numbers are formatted differently. I think it has to do with how commas or periods are used for decimal point. Does anything need to be done in the API code for populating numeric values in the German version of Inventor? Is there a setting in Inventor that will set this preference?

5 REPLIES 5
Message 2 of 6
MegaJerk
in reply to: Anonymous

I solved this problem in this post. Please take a look at it, and post back if you don't find the help you need. I hope that this helps! 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 3 of 6
Anonymous
in reply to: MegaJerk

Thank you Megajerk, your suggestion is very helpful but there are still some details that need to be worked out.

I can use the CultureInfo.CurrentCulture to identify the delimeter. When I populate iProperties in German Inventor, I have to submit data as a double type in order for the iProperty to show as a number. 

Unfortunately the value submitted as 10.0 shows in German Inventor as 10,

How can I get rid of the comma? Or is there a different way to show the precision?

Message 4 of 6
MegaJerk
in reply to: Anonymous

Before I start writing code, how are you submitting the data to the iproperty? Is it just being populated via iLogic like 

 

iProperties.Value("Custom", "PropertyName") = ParameterName 

 

Or by some other means (for instance, directly from the iProperty dialog)? 

 

 

One issue that we could run into is that Inventor will attempt to show everything (in a passive way) using the German culture info, which means that we might have to do some magic.

Please submit some code, and tell me more about what it is you're trying to accomplish and hopefully we can work this out. 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 5 of 6
Anonymous
in reply to: MegaJerk

This is done in a C# addin. Here is the piece of code, made it look more explicit, normally variables are used:

CustomPropSet.Add(Convert.ToDouble("10.0"), "Custom Number", Type.Missing);
Message 6 of 6
MegaJerk
in reply to: Anonymous

If you're converting a string into a double and then throwing that to your iproperty, i would attempt to convert the string using a function like the following : 

 

 

Function NumberMuncherUK (IncString As String) As Decimal 

	Dim RetVal As Decimal
	Dim style As NumberStyles
	Dim UKculture As CultureInfo
	'Dim  FRculture As CultureInfo
	'FRculture = CultureInfo.CreateSpecificCulture("fr-FR")
	
	style = NumberStyles.AllowDecimalPoint  	
	UKculture = CultureInfo.CreateSpecificCulture("en-UK")
	
		If Decimal.TryParse(IncString, style, UKculture, RetVal) = False 
			RetVal = -1.0
		End If 
		
	Return RetVal
	
End Function

 

 

to return (hopefully) a culture specific value. 

I suppose that if that doesn’t work then Inventor is doing some conversion elsewhere, and you may have to either try throwing the value of your iproperty through a culture conversion / set culture info for your plugin from the get go (which is also explained in that thread) / or maybe write in a means of detecting the global culture info of the computer that  the plugin is running on, so that you can handle input from one culture, convert it, and then use it later on in your code.

Perhaps when I get home I will see about changing my computer over to German Language to see if it will have any effect on inventor. Because I don’t have a copy of Ger-Inventor, I may not be able to really get a proper look into the problem sadly.

(Last note : The code is iLogic and not C# as I have yet to properly become acquainted with it L)  

 

I look forward to seeing the results of this conversion test. 

 

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub

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

Post to forums  

Autodesk Design & Make Report