DS-precast Posted January 27, 2014 Posted January 27, 2014 (edited) Hello All I have a simple iLogic Rule which converts the Mass (kg) iProperty into a Custom iProperty measured in tonnes, to 2 decimal places. [color=#800080][b]iProperties[/b][/color][color=#000000].[/color][color=#800080][b]Value[/b][/color][color=#000000][b]([/b][/color][color=#008080]"[/color][color=#008080]Custom[/color][color=#008080]"[/color][color=#000000], [/color][color=#008080]"[/color][color=#008080]Weight (T)[/color][color=#008080]"[/color][color=#000000][b])[/b][/color][color=#000000][b]=[/b][/color][color=#800080][b]Round[/b][/color][color=#000000][b]([/b][/color][color=#800080][b]iProperties[/b][/color][color=#000000].[/color][color=#800080][b]Mass[/b][/color][color=#ff0000][b]/[/b][/color][color=#000000][b]1000[/b][/color][color=#000000],[/color][color=#000000][b]2[/b][/color][color=#000000][b])[/b][/color] The problem I have is that the iProperty value seems to remove trailing zeroes, (ie. it will display '0.8' when I require it to display '0.80'. Could anybody please indicate how to overcome this issue? Many thanks Edited January 27, 2014 by DS-precast Quote
Bishop Posted January 29, 2014 Posted January 29, 2014 I've got a similar iLogic / iProperty setup in my part and assembly templates, but I went at it a slightly different way. I bring iProperties.Mass in as a parameter, mark it for export, and then in the Custom Property Format window I specify how many decimal places I want, and there's checkboxes for leading & trailing zeroes. Here's the code I use: [color=#800080][b]InventorVb[/b][/color][color=#000000].[/color][color=#800080][b]DocumentUpdate[/b][/color][color=#000000][b]()[/b][/color] [color=#800080][b]Parameter[/b][/color][color=#000000][b]([/b][/color][color=#008080]"[/color][color=#008080]partmass[/color][color=#008080]"[/color][color=#000000][b])[/b][/color][color=#000000][b]=[/b][/color][color=#800080][b]iProperties[/b][/color][color=#000000].[/color][color=#800080][b]Mass[/b][/color] [color=#800080][b]InventorVb[/b][/color][color=#000000].[/color][color=#800080][b]DocumentUpdate[/b][/color][color=#000000][b]()[/b][/color] [b] [/b] Quote
DS-precast Posted February 2, 2014 Author Posted February 2, 2014 Thanks for the reply Bishop. I will try your solution and compare with the way I have done it, to see the merits or otherwise of each approach. Since posting, I found another solution to the problem which I will post here to help others with the same or similar issues. I found that using the vba FORMAT command, along with the ROUND command seems to produce the results I'm looking for. My code now reads : [color=#800080][b]iProperties[/b][/color][color=#000000].[/color][color=#800080][b]Value[/b][/color][color=#000000][b]([/b][/color][color=#008080]"[/color][color=#008080]Custom[/color][color=#008080]"[/color][color=#000000], [/color][color=#008080]"[/color][color=#008080]Weight (T)[/color][color=#008080]"[/color][color=#000000][b])[/b][/color][color=#000000] [/color][color=#000000][b]=[/b][/color][color=#000000] [/color][color=#800080][b]Format[/b][/color][color=#000000][b]([/b][/color][color=#800080][b]Round[/b][/color][color=#000000][b]([/b][/color][color=#800080][b]iProperties[/b][/color][color=#000000].[/color][color=#800080][b]Mass[/b][/color][color=#ff0000][b]/[/b][/color][color=#000000][b]1000[/b][/color][color=#000000],[/color][color=#000000][b]2[/b][/color][color=#000000][b])[/b][/color][color=#000000], [/color][color=#008080]"[/color][color=#008080]0.#0[/color][color=#008080]"[/color][color=#000000][b])[/b][/color] Thanks for the assistance. Quote
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.