- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
You can use the same name or something completely different. You don't transfer a variable, you (simplified) transfer an object. This object can be transferred itself (ByRef) so any change in you subroutine changes the original or you can transfer a copy (ByVal) where changes doesn't impact the original.
Here's an ultra primitive example. The only diffenrence between i and j is the way they are transferred to the subroutine ByRef/ByVal.
Private Sub Main
Dim i As Integer = 1
Dim j As Integer = 1
Subroutine(i,j)
MsgBox("i: " & i & vbCrLf & "j: " & j)
End Sub
Private Sub Subroutine(ByRef i As Integer, ByVal j As Integer)
i = + 10
j = + 10
End Sub
In addition, you can create a shared variable in iLogic for use in different rules, especially for use between different documents. Let's say you open document A and capture a current parameter value. Save it to the shared variable and close Document A. Now open document B and there's a OnOpenDocument triggered rule that checks for the shared variable and takes the value to do something.
Shared variables need to be handled more carefully. They are destroyed when Inventor is closed, not when a rule is finished. So it's up to you control that a shared variable is deleted when no longer used.
Access levels in VB.Net --> Link
A function without any access level is a private function. It is possible to not explicitly write this, but your code would be better readable and interpretable for yourself and others. Another shortening is the Dim statement. "Dim" without any access level means "Dim private".
Don't use the componentoccurrences collection. You would need
- to take care of the BOMstructure (purchased, inseparable, phantom...) by yourself
- check for manual qty. overrides in the BOM
- ... something BOM structure changing more I forgot
Your way will only work if none of them is used. Otherwise you will get a lot of wrong information and there's no blinking light noticing you. If your supplier is not able to read the qty. from a parts list and use the corresponding drawing, get another supplier? Remember, it's your fault if the ordered qty. (on your pdf, dwg, jpg) is wrong. There's a real big potential to burn a huge amount of money.
I think it would be easier to traverse the BOM (model view), set all assembly and part rows to phantom which are irrelevant to the supplier. This would assume there's an unique identifier for the weld assemblies. the resulting structured BOM view with all levels can be exported to an Excel file.
From this structured view it should also be possible to easily get your quantity info "part per weld assembly" and "weld assembly per main assembly", cause all other levels are "phantomized".
R. Krieg
RKW Solutions
www.rkw-solutions.com