- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
to "crack" a content center profile in an assembly i have this ilogic routine:
Sub Main() Dim asmDoc As AssemblyDocument = ThisDoc.Document BU2Each(asmDoc) End Sub Sub BU2Each(ByVal asm As AssemblyDocument) For Each oRefDoc As Document In asm.AllReferencedDocuments If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject AndAlso asm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc).Count > 0 If oRefDoc.PropertySets.PropertySetExists("ContentCenter") Try oRefDoc.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kEachBOMQuantity) Catch End Try End If End If Next End Sub
but now i want another one - with the same function - but instead of "each" there should be the variable "B_L"
can someone pls. tell me how this value needs to be??
thx in advance
TC
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In order for a parts list row to show up, its value has to be in the custom properties tab
This can be done manually in the 'Parameters' > check the box 'Export Parameter' > right click to customize
Replace this code with the one in your try/catch:
Dim paramBL As Inventor.Parameter paramBL = oRefDoc.ComponentDefinition.Parameters.Item("B_L") paramBL.ExposedAsProperty = True 'paramBL.CustomPropertyFormat.PropertyType = kTextPropertyType 'parambl.CustomPropertyFormat.ShowUnitsString = False 'paramBL.CustomPropertyFormat.PropertyType = kNumberPropertyType
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
you mean this??
Sub Main() Dim asmDoc As AssemblyDocument = ThisDoc.Document BU2Each(asmDoc) End Sub Sub BU2Each(ByVal asm As AssemblyDocument) For Each oRefDoc As Document In asm.AllReferencedDocuments If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject AndAlso asm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc).Count > 0 If oRefDoc.PropertySets.PropertySetExists("ContentCenter") Try Dim paramBL As Inventor.Parameter paramBL = oRefDoc.ComponentDefinition.Parameters.Item("B_L") paramBL.ExposedAsProperty = True 'paramBL.CustomPropertyFormat.PropertyType = kTextPropertyType 'parambl.CustomPropertyFormat.ShowUnitsString = False 'paramBL.CustomPropertyFormat.PropertyType = kNumberPropertyType Catch End Try End If End If Next End Sub
I´m sorry but it does not work..... ![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I know it already exists but in order to pass it to the custom iproperties tab and then to a parts list/BOM you have to export it. If you want to use "G_L" you wouldn't need to use any code unless you want to get rid of the unit string or change the dimension to fractions.
There are two ways to add "G_L" to the parts list...
1. Change parts lists through style editor
Styles Editor > Parts List > Column Chooser > New > 'G_L'
Then save the style editor and do Yes to 'Save to Library?'
This way it will always show up in parts lists you create
2. You can manually add it by by double clicking on the parts list and following the same steps above
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all!
thx for everything - but i have the solution
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
Dim oOcc As ComponentOccurrence
For Each oOcc In oDoc.ComponentDefinition.Occurrences
oPartDoc = oOcc.Definition.Document
Try
'try to get the value of the parameter
Dim sName As String
sName = "G_L"
oValue = oPartDoc.ComponentDefinition.Parameters.Item(sName).Value
'i = MessageBox.Show(oValue, "Mein iLogic-Dialogfeld", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
p = oPartDoc.ComponentDefinition.Parameters.UserParameters.Item(sName)
oPartDoc.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kParameterBOMQuantity, p)
Catch
End Try
Next
Thx for everything
Tom