Hi,
I would like to know, is it possible to make a rule, which will multiplicate part quantity on drawing by some defined number, "n"? I have different number of ass'ys for different orders and I will manually set parts quantities for one ass'y and then save it as a copy and then run rule for quantity multiplication. Any advices?
Greetings
Solved! Go to Solution.
Solved by rhasell. Go to Solution.
_ORDER ASSEMBLY.iam
- General Assembly
- SubAsm1
- Part 1
- Part 2
- etc.
In the BOM of _ORDER ASSEMBLY, override the quantity of the 1 general assembly.
Enjoy having the functionality of a working structured/parts only list instead of just a dumb overridden static parts list.
Hi
You need to create a multiplier in the same manner you would when calculating the total mass.
Create another qty column in the Parts List, and then use it as a multiplier, that way you can specify the qty required for each assembly, and it will multiply the quantity required by the number you specified.
Create Two new properties in the parts list
1 - Total
Rename this one to QTY if you wish
2 - Multiplier, (mine is called something else, but it gets blocked when I write it on the forums.)
Then follow my storyboard to get it running.
If you are happy with this solution, I can supply the iLogic code to speed it up.
Hope this makes sense to you.
Hi
I have edited and tested my ilogic code.
All you need to do is change the column heading to suit your column label. (Highlighted in red)
' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oPartList As PartsList '''--------------------- 'The next line is if you have more than one parts list on your drawing. oPRTL = InputBox("Choose the Parts List", "Parts List Filter", "1") '''--------------------- 'define custom property collection oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") Try 'set property value oProp = oCustomPropertySet.Item("ASSQTY") Catch ' Assume error means not found so create it oCustomPropertySet.Add("", "ASSQTY") End Try '''----------------------- ' Set a reference to the first parts list on the active sheet. 'expand the parts list oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(oPRTL) oPartList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Parts List") oASSQTY = InputBox("Enter Quantity of Assemblies Required", "iLogic",iProperties.Value("Custom", "ASSQTY") ) iProperties.Value("Custom", "ASSQTY") = oASSQTY ' Iterate through the contents of the parts list. Dim i As Long For i = 1 To oPartList.PartsListRows.Count oCell = oPartList.PartsListRows.Item(i).Item("ASS") 'write to the target cell oCell.Value = iProperties.Value("Custom", "ASSQTY") Next MessageBox.Show("All Done", "BOM QTY")
Thanks a lot, I found it helpful. Until now, I used to make ass'y with number of subass'ys needed for production order and make parts/only BOM, but it was a bit uncomfortable. One more question, is it possible, to change automatically QTY on single part drawing title block, (lowest in structure), considering the result I got with your method?
Not 100% sure I understand your question, but if you are asking if it will work with a parts list of a single part (.IPT) then yes it will still work.
Well, I have one .idw with multiple sheets. And I stick to the sequence : main assembly drawing (with BOM)-> subassembly drawings (with BOM)-> single part drawings (which goes to the workshop with Qty in title block). And I wonder if its possible, to change quantity on details drawings with the numbers received in main assembly BOM.
By the way, thank you very much for your help.
Hi
I don't know. I have not used Mutisheet drawings for about 7 years now, so none of my work takes that into consideration. I have found that everything is easier with single sheet drawings. (I use mutisheet for padding with sheet numbers, but nothing else (eg: sheet 2 of 3))
I ran a quick test to see if everything works on multiple sheets, and each parts list is handled independently, but I will have to revisit the code, to update all sheets at the same time. (Honestly, my skills do not extend to that level, and I would have to search the forums for something similar, and modify it to suit my needs)
I will try and find/write something, but I make no promises, perhaps someone has already done the work for multisheet files and can step in here?
Well, it's not up to me- I had to adapt to this style and was just wondering if it's possible to make things a bit easier and faster. However, thanks for Your help.
Hello
I have a similar question.
Is there a way to get the prompt box that is linked with the quantity on drawing as soon as we open .idw?
For example: at this point in order to change the part quantities on the drawing I manually input the number in the title block.
Any help would be appreciated.
Thank you
Hi
As long as the "ASSQTY" iProperty exists, then you can update the value and run the code.
So a prompted entry in the title block will update the value, and then update the parts list.
I tested using an iLogic trigger, but it was painful, as the code ran every time a property change was made.
So in a nutshell, I don't have a smooth working solution for you just yet, the quickest option I have for the moment is placing the rule on the ribbon.
Perhaps some of the gurus can help with the auto run of the rule without it getting too irritating.
I have taken some of the prompts out of the above listed rule, to allow it run without user input.
Hope this helps a little.
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oPartList As PartsList
'''---------------------
'The next line is if you have more than one parts list on your drawing.
'''oPRTL = InputBox("Choose the Parts List", "Parts List Filter", "1")
'''---------------------
'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
Try
'set property value
oProp = oCustomPropertySet.Item("ASSQTY")
Catch
' Assume error means not found so create it
oCustomPropertySet.Add("", "ASSQTY")
End Try
'''-----------------------
' Set a reference to the first parts list on the active sheet.
'expand the parts list
'oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(oPRTL)
oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
oPartList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Parts List")
'''oASSQTY = InputBox("Enter Quantity of Assemblies Required", "iLogic",iProperties.Value("Custom", "ASSQTY") )
'''iProperties.Value("Custom", "ASSQTY") = oASSQTY
' Iterate through the contents of the parts list.
Dim i As Long
For i = 1 To oPartList.PartsListRows.Count
oCell = oPartList.PartsListRows.Item(i).Item("ASS")
'write to the target cell
oCell.Value = iProperties.Value("Custom", "ASSQTY")
Next
'MessageBox.Show("All Done", "BOM QTY")
Hi There,
I do not get that, but have similar issue. I was testing previous Rules- did not work
I have an Assembly with parts and subassemblies, I'd like to have Rule that will multiply all parts in Part List by a "N" number. That can work only in Drawing file
E.G. Lets say need to make "N" = 5 Units, (My BOM Shows quantity of each part for 1 Unit)
was hoping to add a column that will multiply each quantity value by the "N" =5
Thank You for our help
Hi There,
I do not get that, but have similar issue. I was testing previous Rules- did not work
I have an Assembly with parts and subassemblies, I'd like to have Rule that will multiply all parts in Part List by a "N" number. That can work only in Drawing file
E.G. Lets say need to make "N" = 5 Units, (My BOM Shows quantity of each part for 1 Unit)
was hoping to add a column that will multiply each quantity value by the "N" =5
Thank You for our help
Hi
This particular method only work in the drawing environment.
You have to make a new column, I renamed the column I created from "TOTAL" to "QTY" I then removed the visibility of the original QTY column and replaced it with the new qty column.
The "TOTAL/QTY" column is updated with the multiplier
So in your case you just need to show both columns in the BOM.
The default "QTY" column as well as the "TOTAL" column.
Been a while since I worked on this one, but I will gladly assist you in getting yours working.
Something like this?
'Make custom iProperties TTL and TotalUnits
'Run rule in assembly or make form. Library and CC parts are exluded.
Sub Main On Error Resume Next Dim openDoc As Document openDoc = ThisDoc.Document Dim docFile As Document Dim oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") If iProperties.Value("Custom", "TotalUnits") = 0 Then iProperties.Value("Custom", "TotalUnits") = 1 End If Dim Total_Units = iProperties.Value("Custom", "TotalUnits") '**** FOR TESTING PURPOSES - place a ' in front of the next line to skip it ' MessageBox.Show("TotalUnits = " & Total_Units, "iLogic") If openDoc.DocumentType = 12291 Then For Each docFile In openDoc.AllReferencedDocuments Dim propertyName As String = "TTL" Dim propertyValue As Integer = 1 customPropertySet = docFile.PropertySets.Item("Inventor User Defined Properties") ' Try ' prop = customPropertySet.Item("TTL") ' Catch ' ' Assume error means not found ' customPropertySet.Add(1, "TTL") ' End Try Dim FNamePos As Long Dim docFName As String FNamePos = InStrRev(docFile.FullFileName, "\", -1) docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) -FNamePos) If docFile.IsModifiable = True Then Dim assemblyDoc As AssemblyDocument Dim assemblyDef As AssemblyComponentDefinition Dim partQty As ComponentOccurrencesEnumerator assemblyDoc = openDoc assemblyDef = assemblyDoc.ComponentDefinition partQty = assemblyDef.Occurrences.AllReferencedOccurrences(docFile) If IsNumeric(partQty.Count) = True Then iProperties.Value(docFName, "Custom", "TTL") = partQty.Count * Total_Units '**** FOR TESTING PURPOSES - place a ' in front of the next 3 lines to skip it ' MessageBox.Show(docFName _ ' & vbLf & " Part Qty = " & partQty.Count _ ' & vbLf & " TTL = " & iProperties.Value(docFName, "Custom", "TTL"), "iLogic") End If End If Next Else MessageBox.Show("You must have a valid Assembly document open before using this code!", "File Type Mismatch!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If End Sub
Thank You very much. I like that the rule will work in drawings,
Where I can get the code?/ rule
Thank You for your help
Can't find what you're looking for? Ask the community or share your knowledge.