Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been trying to create a custom iProperty in a Virtual Component (via iLogic) and have hit the wall. I know how to change the standard VC iProperties and create iProperties in a standard part via iLogic, but cant do it in a VC.
Here is a simpler version of my test code: Can anyone helpp me? I believe the issue is this part of the code below: "customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")", as this is setting the value in the assembly level by definition, not the VC.
'--------------------------------------Start of iLogic '--------------------------------------Check that we are in an Assembly oDoc = ThisDoc.ModelDocument If oDoc.DocumentType = kPartDocumentObject Then MessageBox.Show("You must be in an Assembly to run this rule!") Return End If Dim oAssDef As AssemblyComponentDefinition oAssDef = oDoc.ComponentDefinition Dim oMatrix As Matrix oMatrix = ThisApplication.TransientGeometry.CreateMatrix NameOfVirtualPart = "TEST" '--------------------------------------Add one virtual occurrence Dim oNewOcc As ComponentOccurrence oNewOcc = oAssDef.Occurrences.AddVirtual(NameOfVirtualPart, oMatrix) Dim oCVirtualCompDef As VirtualComponentDefinition oCVirtualCompDef = oNewOcc.Definition '--------------------------------------Standard iProperties Populated iProperties.Value(oCVirtualCompDef, "Project", "Description") = GoExcel.CellValue("AutoCAD Attributes.xls", "Summary", "B2") '--------------------------------------Define Variable to Shorten Code Text Length customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") '--------------------------------------Check for Custom iProperties and add them if not found '--------------------------------------Define iProperty Names as a String Dim PropertyName1 As String = "FAMILY" '--------------------------------------Adding Custom "CISCO_PART_\U+0023_FOR_ERP" iProperty Try prop = customPropertySet.Item(PropertyName1) Catch customPropertySet.Add("", PropertyName1) End Try ''--------------------------------------Populate "FAMILY" iProperty iProperties.Value(NameOfVirtualPart, "Custom", "NUMB") = "TEST" 'GoExcel.CellValue("AutoCAD Attributes.xls", "Summary", "E2")
Solved! Go to Solution.