Make a part count as 0,5

Make a part count as 0,5

mike.krudt
Participant Participant
1,859 Views
16 Replies
Message 1 of 17

Make a part count as 0,5

mike.krudt
Participant
Participant

Hi,

 

I have this part in my library that I use in alot of assamblies. When i buy these parts i get them two and two. 

Therefore I need my part to count as 0,5 in my assembly so i dont get double of sets. 

 

 

0 Likes
1,860 Views
16 Replies
Replies (16)
Message 2 of 17

mslosar
Advisor
Advisor

Offhand, i'm not sure you can.

 

I think it might be best if you explained the part more so people can give you better ideas.

 

I think the quantity field is an integer, therefore you can't set it to .5, only integers (1,2,3, 7234, etc).

 

If you buy a part in quantities of 2,  you may want to write an ilogic script to run to override the the quantity value.

 

Divide the quantity of the item by 2. If that number is divisible by 2, let it stand, otherwise, add 1 to even out the total.

0 Likes
Message 3 of 17

brad
Enthusiast
Enthusiast

1. Manual override in BOM/parts list

 

2. 

Prep work (only do once)

a. make a copy of this part, name it "part phantom" or something meaningful

b. make the default BOM structure setting of "part phantom.ipt" to "Phantom" ***

c. make an assembly, insert one "real" version of this part, and one "phantom" version, name this assembly  "part pair.iam" or something meaningful to you

d. make the default BOM structure of "part pair.iam" to "Phantom"

 

Project work (do every time you need these parts)

a. insert "part pair.iam" into your main assembly

b. make "part pair.iam" flexible

c. constrain the parts as needed and work as you normally do

 

Result: everything works per normal, except only half of these parts will show up in your BOM.

 

***Setting the BOM structure of a part to "Phantom" will keep it out of your BOM.  It will still display normally, and still factor in mass calculations as normal.

0 Likes
Message 4 of 17

mslosar
Advisor
Advisor

I read it as he buys the part in quantities of 2, but uses them in quantities of 1.

 

Therefore when he places the part, it's buying 2, or half the amount they have to purchase. Even though he only places 1.

 

Honestly, it sounds more of an ERP/Purchasing issue than an inventor issue. But if it has to be done in inventor, the only automated way of doing it is likely ilogic. That will override the BOM to correct it, which isn't necessarily a good thing - but you can trigger the script to update every time you save the file so it shouldn't get out of sync which is the risk when overriding.

 

 

0 Likes
Message 5 of 17

johnsonshiue
Community Manager
Community Manager

Hi Guys,

 

There is actually a backdoor workaround to bypass the limitation. Here is what you get a half unit of something.

 

1) In the part or assembly, create a user parameter in length unit (mm or inch). Check export status.

2) Go to Tools -> Doc Settings -> BOM -> select the parameter as the Base Quantity.

3) Go back to the Parameters dialog -> change the unit to the user parameter to Unitless -> set the value to 0.5 ul.

4) Repeat step2. You will see the Base Quantity becomes 0.5.

 

Try it out it should work.

Many thanks!

 

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 6 of 17

jtylerbc
Mentor
Mentor

@brad's method is pretty reasonable, but I would suggest a slight change to it.  Instead of setting the parts as Phantom, set the assembly as Purchased.  End result in the parts list will be the same, but it better reflects what is really happening.

 

@johnsonshiue - I've wanted to do that several times to deal with something that comes in multiples, but it doesn't let you select unitless parameters.  It never occurred to me to make a length parameter first and then change it to unitless.  When I tried your method, it changed the Base Quantity exactly as you say, but put some weird number into the Unit Quantity field.  When I add the part into an assembly, the quantity I get is a multiple of the weird Unit number, not the Base number. 

 

I think the weird number is a unit conversion from inches to centimeters.  If I use it to come up with an adjusted parameter value, I can get the Unit Quantity to be the desired value instead of the Base Quantity.  Is this quirk a consequence of something specific to my file, or is it the normal behavior (and thus something that @mike.krudt will have to deal with if he uses your method)? 

 

If I correctly understand what I'm seeing, the only way to use your method without adjusting the number is if the part units are in centimeters.  Still, even with that unit quirk, this could be a handy trick to know.

0 Likes
Message 7 of 17

johnsonshiue
Community Manager
Community Manager

Hi John,

 

I forgot to mention that you need to click on the Edit Parameters button in the BOM tab in Doc Setting -> check/uncheck Export status in Parameters dialog. Then it will clear out the Base Unit. It will become UL. The weird values will not appear. You can save it as a special template for future usage.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 8 of 17

jtylerbc
Mentor
Mentor

That's weird, but it works.  Pretty neat trick.  Wish I was working on something now where I needed it - hopefully I won't forget about this solution by the time I need it again.

0 Likes
Message 9 of 17

johnsonshiue
Community Manager
Community Manager

Hi John,

 

This trick works pretty much for any "unsupported" unit. Things like area (inch^2) or volume (m^3). As long as the units are accepted by Parameters, this trick should work.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 10 of 17

Yashasvi23481
Collaborator
Collaborator

Hi Johnson,

 

  Is it possible to add new unit of measurement say pair ? Alternatively, we can just write a note in drawing saying item XX comes in pair of 2. Qty noted is pair ? I believe what modelling cant explain, simple text or note in idw can do the trick. 

 

   The way we work, we don't put BOM on the drawings just balloons as its managed by SAP. We issue SAP bom to suppliers as well so there is 1 point of contact for BOM. 

 

Just a suggestion. I never come across this issue as per above reason. 

 

Thanks and Regards,

Yash

0 Likes
Message 11 of 17

johnsonshiue
Community Manager
Community Manager

Hi Yash,

 

Long time no see! Happy New Year! Unfortunately, it is not available. The trick only works for supported units in Parameters dialog. You cannot assign an arbitrary unit.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 12 of 17

Yashasvi23481
Collaborator
Collaborator

Hi Johnson,

 

    yes I know been long time. Happy new year to you as well ! I was away for month of Dec and Since Jan working on AutoCAD only. Hence the silence in forum from my end :). 

 

I had 1 issue but I figured out way around it. When I export from inventor, the AutoCAD had lot of internal lines and beizer curves. I just had to remove tangent edges, interference edges and thread feature and I got much clear AutoCAD lines. I was spending lot of time clearing lines and tangenet edges but this method of unticking 3 boxes in main view of idw resolved it. 

 

Regards,

Yash

0 Likes
Message 13 of 17

pball
Mentor
Mentor

@johnsonshiue 

Do you think it would be possible to apply this work around with the API? Using a template file with this pre-applied would be of limited us as most multi pack parts we deal with here are purchased and imported from step files. As I understand imported files use the default template. So a separate template wouldn't help there, but if a script could apply this it'd be awesome. I haven't played with the API relating to BOM stuff much yet.

Also everyone please vote up this idea and any other related ones.

https://forums.autodesk.com/t5/inventor-ideas/part-unit-quantity-ability-to-enter-fractional-or-deci...

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
Message 14 of 17

pball
Mentor
Mentor

Whoops can't edit previous post. I threw some code together and got close but I can't get the Unit Quantity to update properly without manually opening the parameters and closing them from the Document Settings.

 

If there is a way to emulate opening the parameters from the dialog below in code, this should work.

image.png

Public Sub bomqty()
    Dim oPart As PartDocument
    Set oPart = ThisApplication.ActiveEditDocument
    Dim oCompDef As PartComponentDefinition
    Set oCompDef = oPart.ComponentDefinition

    Dim Qty As Double
    temp = InputBox("Enter the Qty", "Quantity", "1")

    If Not IsNumeric(temp) Then
        MsgBox ("Please enter a number")
        Exit Sub
    Else
        Qty = temp
    End If
    
    On Error Resume Next
    
    If Qty = 1 Then
        Call oCompDef.BOMQuantity.SetBaseQuantity(kEachBOMQuantity)
        oCompDef.Parameters.UserParameters.Item("qty").Delete
    Else
        Dim oUserParam As UserParameter
        Set oUserParam = oCompDef.Parameters.UserParameters.Item("qty")
        
        'update qty param if exist
        oUserParam.Value = Qty * 2.54
        oUserParam.Units = "in"
        
        'create qty param if not exists
        If (Err.Number <> 0) Then Set oUserParam = oCompDef.Parameters.UserParameters.AddByValue("qty", Qty * 2.54, "in")
        
        'set qty param as base quantity
        Call oCompDef.BOMQuantity.SetBaseQuantity(kParameterBOMQuantity, oUserParam)
        
        'change qty param units and update value
        oUserParam.Units = "ul"
        oUserParam.Value = Qty
                
        oUserParam.ExposedAsProperty = True
        oPart.Update
    End If
End Sub
Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
Message 15 of 17

johnsonshiue
Community Manager
Community Manager

Hi Guys,

 

You know iLogic and VB much better than I do. I am sorry I don't know if there is a programmatic way to do that. The Parameter dialog (uncheck/recheck Export) trick may help reset the parameter unit for some reason. Is there an automated alternative? If you do that in an iLogic rule, does it help?

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 16 of 17

jtylerbc
Mentor
Mentor

I'm merely a dangerous dabbler in iLogic/VBA, but I actually have done that before.  It is possible to mark (or unmark)a parameter for Export via iLogic, so that just might work.  It would look something like:

 

oUserParams("QTY_PARAMETER_NAME").ExposedAsProperty = True
oUserParams("QTY_PARAMETER_NAME").ExposedAsProperty = False

   

I use similar lines of code in a couple of rules that help format part descriptions, except that in that application I"m only turning the Export mark on, not turning it back off.

0 Likes
Message 17 of 17

pball
Mentor
Mentor

Unfortunately I tried toggling the export parameter in my testing, I only have export set to true in the code I posted though. I'm going to make a post in the customization forum and link to this thread. Hopefully a few more coders will see this over there.

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
0 Likes