Get bom quantity from iam to drawings

Get bom quantity from iam to drawings

Anonymous
Not applicable
775 Views
3 Replies
Message 1 of 4

Get bom quantity from iam to drawings

Anonymous
Not applicable

Hi,

 

when we are ordering laser parts we always create a individual drawing (multiple sheets in one idw) of the part, including partsnumber, quantity and so on. I created a custom title block to draw these informations out of the ipt's. 

 

BUT: I always type the quantity into a custom iPropertie in my ipt, which I know, is wrong. I did create a .iam with all the needed parts for 1 order and I will duplicate them as needed. 

 

Is it somehow possible to get the quantitys and maybe even the position of each part into the title block of my drawing sheets automatically? 

 

 

This is what my title block looks like

image.png

 

Greetz,

Daniel

0 Likes
Accepted solutions (1)
776 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

I hope you are aware of the risks writing this BOM infos to a part file. You should run the rule before save.

Dim oAssDoc As AssemblyDocument = ThisDoc.Document 
Dim oBOM As BOM = oAssDoc.ComponentDefinition.BOM

oBOM.PartsOnlyViewEnabled = True

Dim oBOMView As BOMView
For Each oBOMView In oBOM.BOMViews
    If oBOMView.ViewType = kPartsOnlyBOMViewType Then Exit For
Next

If oBOMView Is Nothing Then
    Call MsgBox("Error getting Parts only BOM view", , "iLogic Write Qty To Prop")
    Exit Sub
End If
    
Dim oBOMRow As BOMRow
Dim sQty As String
Dim sItem As String
Dim oCompDef As PartComponentDefinition
Dim oPartDoc As PartDocument
Dim oPropSet As PropertySet
For Each oBOMRow In oBOMView.BOMRows
    sQty = oBOMRow.TotalQuantity
    sItem = oBOMRow.ItemNumber
    oCompDef = oBOMRow.ComponentDefinitions(1)
    oPartDoc = oCompDef.Document
    oPropSet = oPartDoc.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
    Try
    	Call oPropSet.Add(sQty, "Qty")
    Catch
        oPropSet.Item("Qty").Value = sQty
    End Try
    Try
    Call oPropSet.Add(sItem, "Item")
    Catch
        oPropSet.Item("Item").Value = sItem
    End Try
Next

 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 4

Anonymous
Not applicable

works really well!

thank you!

0 Likes
Message 4 of 4

Anonymous
Not applicable

Is it somehow possible to scale all my parts on every sheet automatically and place them on "Top" view by default? 

 

I found this code

 

Skalierung = Skalierung


ActiveSheet.View("ANSICHT1").Scale = Skalierung

x = Skalierung

While ActiveSheet.View("ANSICHT1").Width > 100
	
x = x - 0.01

ActiveSheet.View("ANSICHT1").Scale = x
Parameter("Skalierung") = x

End While 

Scaling works for the first part on sheet 1, which is named "ANSICHT1", but not on the second part "ANSICHT2" and so on..

0 Likes