Add custom property to each element in the assembly, but skipping read-only (content center or library) parts

Add custom property to each element in the assembly, but skipping read-only (content center or library) parts

sanil_heartbeats
Contributor Contributor
294 Views
1 Reply
Message 1 of 2

Add custom property to each element in the assembly, but skipping read-only (content center or library) parts

sanil_heartbeats
Contributor
Contributor

I am looking to read the total quantity value of each individual part present in an assembly from the BOM and add it as a custom property to that part. I am having trouble editing the STD items which is in the library or the content center. So i need to check that particular item and skip those items if  the ISMODIFIABLE property if false. how can i add that condition to the code?? here is my current code

 

Dim result As DialogResult = MessageBox.Show("Override / Update Qty value of all Dependant Parts in Assy??" & vbCrLf & vbCrLf & "Please Confirm", "Quantity Update Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)

If result = DialogResult.Yes Then
  Try
  For Each invBomRow In invPartOnlyView.BOMRows
    invPart = invBomRow.ComponentDefinitions.Item(1).Document

***** I am having problem adding this here.******
If invPart.IsModifiable = False Then Next
*************************************************

                                If invPart.ComponentDefinition.BOMStructure = BOMStructureEnum.kNormalBOMStructure Then

                                    invPartQty = invBomRow.TotalQuantity.ToString
                                    ' Get the user defined (custom) property set.
                                    invUDPropSet = invPart.PropertySets.Item("Inventor User Defined Properties")

                                    Try
                                        ' Attempt to get an existing custom property named "Qty".
                                        invQtyProp = invUDPropSet.Item("Qty")
                                        invQtyProp.Value = invPartQty
                                    Catch ex As Exception
                                        Call invUDPropSet.Add(invPartQty, "Qty")
                                    End Try

                                End If
                            Next
                        Catch ex As Exception
                            MsgBox(ex.Message)
                        End Try
                    End If

 

 

0 Likes
Accepted solutions (1)
295 Views
1 Reply
Reply (1)
Message 2 of 2

sanil_heartbeats
Contributor
Contributor
Accepted solution

I got it.

 

If invPart.IsModifiable = False Then Continue For

0 Likes