ilogic partnumber change in assembly and mass unit change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all.
I've got an assembly with parts. I need to change the PN of each part to be the same as the filename as well as the unit of mass should be kg instead of lbppounds.
I managed to change globally the lbpounds of the parts to kg. The bom was also updated.
But I need to add a rule in order this change is permanent. (I use the parts in other projects).
With the rule (under) : it works only once. When I reopen the assembly with all the parts, the unit is again lb pounds.
Specific question. I need to have the kg unit for each part. Permanently stored in the properties of the individual part. as well as the partnumber should be the filename. For the partnumber change for each part, I tried a code but it doesnt work. Any suggestions please?
code for mass unit change. (only works for the assembly bom, I need to have it work for each part permanently)
SyntaxEditor Code Snippet
'get input from user oUnit = InputRadioBox("Select a unit of measure type", "Metric", "Imperial", False, "ilogic") If oUnit = True Then 'set to millimeter oUOM_1 = UnitsTypeEnum.kMillimeterLengthUnits 'set to kilogram oUOM_2 = UnitsTypeEnum.kKilogramMassUnits Else 'set to inch oUOM_1 = UnitsTypeEnum.kInchLengthUnits 'set to pounds mass oUOM_2 = UnitsTypeEnum.kLbMassMassUnits End If 'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document 'Look at all of the files referenced in the open document Dim docFile As Document For Each docFile In openDoc.AllReferencedDocuments 'look at only part files If docFile.DocumentType = kPartDocumentObject Then 'set mass units docFile.unitsofmeasure.MassUnits = oUOM_2 'rebuild to update the display docFile.Rebuild End If Next iLogicVb.UpdateWhenDone = True
Thank you for helping me.
The fault code for the partnumber change
SyntaxEditor Code Snippet
'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document 'Look at all of the files referenced in the open document Dim docFile As Document For Each docFile In openDoc.AllReferencedDocuments 'look at only part files If docFile.DocumentType = kPartDocumentObject Then 'set mass units docFile.unitsofmeasure.MassUnits = oUOM_2 'set partnumber docfile.iProperties.Value("Project", "Part Number")=docfile.FileName(False) 'rebuild to update the display docFile.Rebuild End If Next iLogicVb.UpdateWhenDone = True