Assembly Generator to create new part files from part template files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone. I'm working on creating an Assembly Generator that will use part template files to create new part files. Right now my code is using the template files only but I need new files instead of editing the template files. How would I go about doing this? I've read on some topics regarding kparts but I don't know how to implement that into the code. I also don't want the browser names to be "left_channel:1", "right_channel:1" etc but rather be the new part files instead.
Dim ChannelTemplateFolder As String = "C:\_VaultWorkspace\Designs\ETO\Templates\Generators\AVR\" Dim SpacerKitFolder As String = "C:\_VaultWorkspace\Designs\ETO\U numbers\U124\" Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition 'Place Left channel part Dim LeftChannel = Components.Add("Left_Channel:1", ChannelTemplateFolder & "AVR Base Generator (Left Double Channel Design).ipt", position := Nothing, grounded := True, visible := True, appearance := Nothing) 'Place Spacer Kit1 Dim SpacerKit1 = Components.Add("Spacer_Kit:1", SpacerKitFolder & "U124-00001-01.iam", position := Nothing, grounded := False, visible := True, appearance := Nothing) 'Place Right channel part Dim RightChannel = Components.Add("Right_Channel:1", ChannelTemplateFolder & "AVR Base Generator (Right Double Channel Design).ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing) 'Constrain Spacer kit1 Constraints.AddByiMates("Spacer1FaceToLeftChannelFace", "Spacer_Kit:1", "iMate:left_face", "Left_Channel:1", "iMate:left_face") Constraints.AddByiMates("Spacer1FaceToRightChannelFace", "Spacer_Kit:1", "iMate:right_face", "Right_Channel:1", "iMate:right_face") Constraints.AddByiMates("Spacer1FaceToLeftChannelSpacerMounting1", "Spacer_Kit:1", "iMate:spacer_mounting", "Left_Channel:1", "iMate:spacer_mounting1") Constraints.AddByiMates("Spacer1FaceToRightChannelSpacerMounting1", "Spacer_Kit:1", "iMate:spacer_mounting", "Right_Channel:1", "iMate:spacer_mounting1")
I've also I started to create a "link parameters" rule in the Assembly Generator template so that the user parameters of the assembly can drive the model parameters of the part files, but again I'm using the "left_channel:1" etc browser names to communicate but what I really need to use is whatever code the new part names would be instead. Basically I need to get away from editing the template files directly and edit new parts made based off the template files instead. Hope that makes sense lol. Any help would be greatly appreciated 🙂
Parameter("Left_Channel:1", "Holes_Distance_To_Insulator1_C_C") = Holes_Distance_To_Insulator1_C_C Parameter("Right_Channel:1", "Holes_Distance_To_Insulator1_C_C") = Holes_Distance_To_Insulator1_C_C Parameter("Left_Channel:1", "Base_Length") = Base_Length Parameter("Right_Channel:1", "Base_Length") = Base_Length Parameter("Left_Channel:1", "Insulator1_To_Insulator2__C_C") = Insulator1_To_Insulator2__C_C Parameter("Right_Channel:1", "Insulator1_To_Insulator2__C_C") = Insulator1_To_Insulator2__C_C Parameter("Left_Channel:1", "Edge_Of_Channel_To_Center_Of_Bearing_Hole") = Edge_Of_Channel_To_Center_Of_Bearing_Hole Parameter("Right_Channel:1", "Edge_Of_Channel_To_Center_Of_Bearing_Hole") = Edge_Of_Channel_To_Center_Of_Bearing_Hole
Kenny
If this post solved your issue please mark "Accept as Solution". It helps everyone...really!