Link Parameters After Component/Part Name Change in Assembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an assembly drawing where I will place a wheel and axle shaft. After placing the parts, I have a name change for the wheel and axle, then save as a new file in a specified folder. This all works great, many thanks to the ones who contributed in the code. My issue is after the component name change my link parameters do not work. How can I use a wild card or change the code to reflect the new component names?
This is the code to insert the wheel and axle. Axle not coded yet. This code runs perfect.
'Insert Wheel Dim componentA = Components.Add("R10S WHEEL:1", "Z:\ENGINEERING\CAD\MFG. DRAWINGS\ROCKENG\2 - 3D WHEEL MODELS\10in FORGINGS\R10S WHEEL.ipt", position := Nothing, grounded := True, visible := True, appearance := Nothing) ' Get current location of where you want the search area to be. Dim ExportPath As String = (”Z:\ENGINEERING\CAD\MFG. DRAWINGS\ROCKENG”) ' Define folder browse dialog Dim Dialog = New FolderBrowserDialog() ' Set options for folder browser dialog Dialog.SelectedPath = ExportPath Dialog.ShowNewFolderButton = True Dialog.Description = "Choose Folder for Export..." ' Show dialog box If DialogResult.OK = Dialog.ShowDialog() Then ' User clicked 'ok' on dialog box - capture the export path ExportPath = Dialog.SelectedPath & "\" Else ' User clicked 'cancel' on dialog box - exit Return End If Dim Path As String = ExportPath MessageBox.Show(Path, "Directory path") InvDoc = ThisDoc.Document Dim refDocs As DocumentsEnumerator = InvDoc.AllReferencedDocuments Dim refDoc As Document Dim PartN As String = "FileName" PartN = InputBox("Prompt", "Title", PartN) For Each refDoc In refDocs 'MessageBox.Show(refDoc.DisplayName) If refDoc.DisplayName.EndsWith("R10S WHEEL.ipt") = True Then NewFileName = PartN & " WHEEL.ipt" refDoc.SaveAs(Path & NewFileName, False) ElseIf refDoc.DisplayName.EndsWith("STUB AXLE.ipt")= True Then NewFileName = PartN & " AXLE.ipt" refDoc.SaveAs(Path & NewFileName, False) End If Next ThisDoc.Document.SaveAs(Path & PartN & ".iam", False) iLogicVb.UpdateWhenDone = True
This is my parameter link code. How do I get the R10S WHEEL changed to the new file name?
Parameter("R10S WHEEL", "WheelGage") = WheelGage Parameter("R10S WHEEL", "WheelWidth") = WheelWidth Parameter("R10S WHEEL", "WheelBore") = WheelBore Parameter("R10S WHEEL", "WheelFlangeWidth") = WheelFlangeWidth Parameter("R10S WHEEL", "WheelFlangeOffset") = WheelFlangeOffset Parameter("R10S WHEEL", "WheelFlangeDia") = WheelFlangeDia Parameter("R10S WHEEL", "HubCapOffset01") = HubCapOffset01 Parameter("R10S WHEEL", "HubCapDiaBore") = HubCapDiaBore Parameter("R10S WHEEL", "RetainerRingWidth") = RetainerRingWidth Parameter("R10S WHEEL", "RetianerRingOffset") = RetianerRingOffset Parameter("R10S WHEEL", "RetainerRingDia") = RetainerRingDia Parameter("R10S WHEEL", "AlemiteOffset01") = AlemiteOffset01 Parameter("R10S WHEEL", "AlemiteOffset02") = AlemiteOffset02 Parameter("R10S WHEEL", "AlemiteOffset03") = AlemiteOffset03 Parameter("R10S WHEEL", "AlemiteCBoreDia") = AlemiteCBoreDia Parameter("R10S WHEEL", "AlemiteCBoreDepth") = AlemiteCBoreDepth Parameter("R10S WHEEL", "AlemiteAngle") = AlemiteAngle Parameter("R10S WHEEL", "WheelWidth") = WheelWidth Parameter("R10S WHEEL", "BoreType") = BoreType
My original wheel name is R10S WHEEL.
This is the new file name and changed component name change.
This is before running the rules.
Thank you,
Samantha
Inventor 2022.2