- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You could use ilogic routine to create a text parameter for each body, with a linking naming convention (i.e NameOfBody = PartNumber and NameOfBodyParameter = NameOfBody. We do something similar when working in the MB Parts for weldments, but we use this to push meta data out to the individual parts when we make components, and link geometry parameters like plate thickness from the MB to its derived component and so forth to Stock names and part numbers.
The problem of course is those parameters are not visible to the BOM, unless you actually go and eventually make the parts prior to doing a drawing. So you need further scripting to drill into the part and get the faux part numbers and document them in some way.
So I guess the short answer is totally doable, but only really useful, if you ultimately get the data back out again by either more scripting or doing the thing that others seem to be suggesting, which is use make components command to push all the bodies to an assembly.
Hope this is of some help.
Below is pasted code, (somewhat in progress) for assigning part numbers and descriptions to bodies. The next step, (still working on) is sending that data to the eventually created parts. It is, I will warn you, shamelessly cribbed from many other sources and cobbled together for my purposes. It is also under commented at the moment and not yet finished. When it is better shaped up I will repost if anyone finds it remotely useful.
M
'CODE BEGINS
Dim oDoc as Document
Dim oPartDoc as PartDocument
Dim oPartCompDef as PartComponentDefinition
Dim oParams as Parameters
Dim oUserParams As UserParameters
Dim oBody as SurfaceBody
Dim strBName as String
Dim strSubID as String
Dim strSubSubID as String
Dim strPartID as String
Dim oSet as HighlightSet
Dim oSelected as ObjectCollection
'Dim oParameter as Parameters
oDoc = ThisDoc.Document
oRedColor = oDoc.Assets("Red")
oPlateColor = oDoc.Assets("Plate")
'oUserParams=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
'check document is a part
'if not an assembly go to end of rule
If oDoc.DocumentType = kPartDocumentObject Then
oPartDoc = oDoc
oPartCompDef = oPartDoc.ComponentDefinition
oParams=oPartCompDef.Parameters
oSet = oPartDoc.CreateHighlightSet
oUserParams=oParams.UserParameters
strSubID = iProperties.Value("Custom", "SubID")
strSubSubID = iProperties.Value("Custom", "SubSubID")
strPartID = iProperties.Value("Custom", "PartID")
strID = strSubID & "-" & strSubSubID & "-" & strPartID
'msgBox (strID)
'oSet = Nothing
For Each oBody In oPartDoc.ComponentDefinition.SurfaceBodies
'oSet = Nothing
'oSet.AddItem (oBody)
oBody.Appearance = oRedColor
strBName = oBody.Name
intNameL = Len(strBName)
strBPart = Right(strBName,intNameL-1)
strPartName = strSubID & "-" & strSubSubID & "-" & strBPart
'msgBox (strPartName)
strPName = strBName & "Description"
Try
paramcheck = oUserParams.Item (strPName)
strCurrent = paramcheck.Value
strDescription = InputBox ("Change " & strBName & " Description?" & VbCrLf & "CURRENTLY:" & VbCrLf & strCurrent & VbCrLf & "Leave blank to keep current.")
If Not strDescription = "" Then
paramcheck.Value = strDescription
End if
'msgBox (strCurrent)
Catch
strDescription = InputBox (" Enter " & strBName & " Description")
strDescription = iProperties.Value("Project","Description") & ", " & strDescription
oParameter= oUserParams.AddByValue(strPName, strDescription,UnitsTypeEnum.kTextUnits)
End Try
oBody.Appearance = oPlateColor
Next
'CODE ENDS