Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatically Calculate Price Based on Weight

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Anonymous
2208 Views, 8 Replies

Automatically Calculate Price Based on Weight

Hi all.  I'm using Inventor 2017, trying to make a custom iProperty for Price for use in a Bill of Materials.  I would like to be able to calculate the price based on the weight and our data for price / pound of material.  Is this possible?  

 

A couple of problems I've run into:

 

I've made a custom BOM iProperty column, but when I use the <Mass> iProperty it shows me the mass in grams rather than lbmass.  Is it possible to change the unit type or will I just have to include a conversion factor into the formula?

 

The bigger problem is I can't do anything to the <Mass> property once it's in the expression dialog.  Typing in "=<Mass> x 2" or "=<Mass> * 2" both simply report the same number as <Mass>.  What am I doing wrong here?  

 

Thanks in advance.  I'm willing to use iLogic if I have to, but I wanted to keep everything within the BOM.  I'm open to other ways of automatically calculating price based on weight.

8 REPLIES 8
Message 2 of 9
jtylerbc
in reply to: Anonymous

Mass showing in the wrong units is due to a setting that is incorrect in either your specific file or your templates, or possibly both.  With the file open, go to Tools, Document Settings, and click on the Units tab.  There you will be able to change the units for Mass from grams to lbmass.

 

For the math, you will likely have to use iLogic.  Although I don't use it much anymore, I have done essentially the same thing you are trying to do.  My code is below.

 

If CostByWeightRun = "True" Then

mass = iProperties.Mass
TotalCost = Costlb * mass
iProperties.Value("Project", "Estimated Cost") = TotalCost

ElseIf CostByWeightRun = "False" Then

End If

 

My code uses a True/False parameter as a switch for whether or not to calculate the cost.  If you don't need that on/off functionality, you can strip the If/Then conditions out of the code and streamline it. 

 

"Costlb" is a unitless User Parameter that allows you to enter the cost per pound in an iLogic form that pops up on initial creation of the part.

Message 3 of 9
Anonymous
in reply to: jtylerbc

Thank you, this is exactly what I was looking for. Now I just need to find a way to run an iLogic rule on several hundred parts without taking dozens of hours.
Message 4 of 9
jtylerbc
in reply to: Anonymous

Look into the iLogic Code Injector.

 

http://beinginventive.typepad.com/being-inventive/2012/08/major-upgrade-to-the-ilogic-code-injector-...

 

May still take some time to process, but you can spend at least some of it at the coffee machine instead of sitting at your desk copying and pasting the same code hundreds of times.

Message 5 of 9
cadman777
in reply to: jtylerbc

Thanx for the code, Tyler.

This will do it for me, except I was hoping to use 'out of the box' functionality.

I too created a custom  iProperty 'price_per_sq_in", but can't get it into the 'Estimated Cost' iProperty b/c there's no way to make a formula in it. Guess I'm once again STUCK using iLogic, right?

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
Message 6 of 9
jtylerbc
in reply to: cadman777

Yes.  My setup for this has been established for quite a while (and as I mentioned earlier in the thread, is now used infrequently anyway).  So my memory on this is slightly rusty.  But I believe there are two issues that complicate it and make iLogic necessary:

 

  1. iProperty expressions can combine text from other properties, but can't do math.  So you can make a description that includes something like "PLATE-<WIDTH> X <LENGTH>", where WIDTH and LENGTH are the properties created from part dimensions or other parameters.  But you can't actually make an iProperty expression multiply those properties to give an area.  In this example, you could solve it by making a User Parameter that does the math, and no iLogic code would be needed. 
  2. Currency is not an available unit type for a parameter, but is built in to the Estimated Cost iProperty.  As a result, there is no way I'm aware of to set up a User Parameter-based solution for the Estimated Cost iProperty that doesn't result in a unit mismatch issue.  iLogic code gets around this issue, as it seems to completely ignore the currency formatting of that property.

 

As far as I am aware, the Estimated Cost property is the only one where the #2 issue exists.  

Message 7 of 9
cadman777
in reply to: jtylerbc

Thanx John.

That's exactly what I discovered.

I want to show a '$' sign at the beginning of the number in the BOM, b/c that's what people need to see.

But there isn't a 'Currency' prefix available in the Parameters dialogue.

Nor is there any way to do calculations w/currency in Inventor like you can in Excel.

So basically I'm forced to use 'Estimated Cost' + iLogic.

I based my rule on your rule.

I HATE coding, b/c if you make one little error, it won't run. And if you fail to know everything that can foul up a piece of code, then you will waste endless hours hunting down the cause...and most of the time it's NOT worth it. For example: My rule based on your rule runs when I RMB>Run. But it won't run at triggered before Saving. Why? Well, I just figured it out. But it took me 2 HOURS. Who knows when I'll need this functionality again?

Anyway, thanx for helping!

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
Message 8 of 9
johnsonshiue
in reply to: Anonymous

Hi Folks,

 

I guess another way is to treat the cost as unitless value. Then at the column header, attach the dollar sign.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 9 of 9
cadman777
in reply to: johnsonshiue

Yes, but that defeats the purpose of having the native Inventor "Estimated Cost" iProperty.
What good is it if it doesn't work like all the iProperties you can use Parameters in?

I just saw a similar problem with the Temperatures Parameter the other day on this forum.

All these years, and still no simple Excel functionality in these not so frequently used Parameters and iProperties.

I recall many years ago I wanted to use my BOM as a cost estimator for all my projects.
But b/c of the limitations I'm being reminded of, I quit trying back then.

We were forced to resort to sending an exported BOM (Excel) to the estimators so they could manually work up a quote on parts and materials. I have to ask WHY waste coding on an iProperty that's useless??

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator

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

Post to forums  

Autodesk Design & Make Report