Hi. I would love to use Alibre to generate and export entire family of parts and to name each exported part uniquely.
For example, I have this 3.81mm pitch shrouded header socket modeled so that I can define the size and the number of pins through the global parameter file.
I modify the values in the "Current" configuration and update designs to make each size variation, and then export that to a STEP file before repeating the process for the next number of pins and size.
(PositionD is the distance equivalent of the Positions value, expressed as "mm" so that the body width of Nx3.81+1.0 can be generated)
For now, I've manually created 2, 3, 4, 5 and 6 pin versions in green and in black. I would love to automate the process so it'll generate 2 through 12 pin versions (and to do that over multiple color selections - green, black, blue, orange, red, etc), creating the export filename to match.
Thank you.
Hello
@Toybuilder can you break it down into steps?
The program should:
- create new configuration
- create new and/or update parameter or equation
- export to step
Have you tried the part library system? Just curious.
Name: Constituent search
What it does: Searches the file system for assemblies then searches those assemblies for a particular constituent.
Things it should consider:
I've tried to write something like this, but it is really slow, loading and rendering each assembly.
Rather than searching for a constituent, maybe just list the contents of each assembly to a text file.
I use Everything app to find ad_asm or ad_prt files:
I export the result list to a json, csv or text file and then pass that file to my tools. Everything does the hard work of finding the files:
Here is the input:
C:\donetoolkit\linqpad\queries\main\-0-Support-Files-And-Content\TopPiece.AD_ASM
C:\donetoolkit\tool-dev\e.AD_ASM
C:\donetoolkit\tool-dev\importing-exporting-data.AD_ASM
C:\donetoolkit\tool-dev\AlibreDesignToDynamoR&D\FromADToDyn.AD_ASM
C:\git\24817-post-168214\layout.AD_ASM
G:\04-12-2023\0_Alibre_Shaver_Assembly\0_Main_Shaver_Assembly.AD_ASM
G:\04-12-2023\0_Alibre_Shaver_Assembly\BladeAssemblyTop.AD_ASM
G:\04-12-2023\0_Alibre_Shaver_Assembly\BladeHouse.AD_ASM
G:\04-12-2023\0_Alibre_Shaver_Assembly\ShaverInterior.AD_ASM
G:\04-12-2023\0_Alibre_Shaver_Assembly\TopPiece.AD_ASM
G:\By-Date\8-12-2021\8-4-2021.AD_ASM
Here is the output:
Code:
C:\donetoolkit\linqpad\queries\main\-0-Support-Files-And-Content\TopPiece.AD_ASM
8C45FC46-DC31-4BFB-BC66-30AC233B7118
67552739-EA6B-44BB-AD9B-75734197EA3E
F963A5D9-9BFC-425A-9594-917983AE246C
68BC1673-841F-463D-8617-62EBFB813241
19C44F1A-D331-46D8-B62B-0055D6C9AE23
GrayHolster.AD_PRT
Spring.AD_PRT
Twister.AD_PRT
TwisterButton.AD_PRT
../../../Users/Midas/AppData/Local/Temp/PackageTempFolder0/
../../../Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:\donetoolkit\tool-dev\e.AD_ASM
1027A775-7614-4412-9B2C-FAD549116DF9
6095A15D-91D6-489F-A0F8-8D5767AB74CA
e.AD_PRT
C:\donetoolkit\tool-dev\importing-exporting-data.AD_ASM
CD973FCE-0302-45F2-A4CA-6402DC9301F6
B3D55B16-18A6-4773-86A0-472BCAC3DBDF
e3.AD_PRT
C:\donetoolkit\tool-dev\AlibreDesignToDynamoR&D\FromADToDyn.AD_ASM
8EFF53B2-05A2-4FC1-A961-CA9A11A4C477
32BF71B7-D17D-47CE-AFAA-4A26B3FAB219
profileA.AD_PRT
C:\git\24817-post-168214\layout.AD_ASM
14E60174-164C-48E7-AD9E-2457E5C26B2C
E331F84A-0694-4AA0-9941-1533B74FB264
sketch-0.AD_PRT
G:\04-12-2023\0_Alibre_Shaver_Assembly\0_Main_Shaver_Assembly.AD_ASM
596CF356-89C2-4B6C-BCB9-3ED2F808B0A2
CCA77DD2-711F-40D1-AEC7-635D67D0B18E
CB2BBBD8-A242-4FE7-9D32-3C79D6789EEE
ShaverInterior.AD_ASM
BladeAssemblyTop.AD_ASM
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
G:\04-12-2023\0_Alibre_Shaver_Assembly\BladeAssemblyTop.AD_ASM
CB2BBBD8-A242-4FE7-9D32-3C79D6789EEE
85902F23-0094-4D58-8210-7C5CFD73A390
AB06C94C-3F58-48B5-B4D0-268DE45CF24A
BladeHouse.AD_ASM
ShinyTop.AD_PRT
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
G:\04-12-2023\0_Alibre_Shaver_Assembly\BladeHouse.AD_ASM
85902F23-0094-4D58-8210-7C5CFD73A390
EA090FEE-7FDE-4427-AAA7-6CA225C6415E
01569738-2A6C-4B74-8EC0-6766C1B6D38D
5CD85257-0BB9-46B9-8AF5-55987543C45D
BladeHousing.AD_PRT
New Part (1).AD_PRT
New Part (2).AD_PRT
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
G:\04-12-2023\0_Alibre_Shaver_Assembly\ShaverInterior.AD_ASM
CCA77DD2-711F-40D1-AEC7-635D67D0B18E
8C45FC46-DC31-4BFB-BC66-30AC233B7118
3B195584-EA0C-4291-B8DC-32C753F01C66
EDE5F504-9506-4EFA-9DB3-BCEE80EAACD5
CC2C3A18-F378-450F-816F-3FA79D7DA961
40781210-4527-4142-926C-BC2FE73171C5
2D00C44A-28E6-4377-9D54-1A5FA09F4C0E
42B528FD-D9E2-469A-850E-38557E2BD9DD
0A3B8D4A-A184-4442-984B-D5EBB4D2EB2C
27E645B2-818A-40E0-8C04-CF25671E8DFB
05B9F4D6-26CE-42B6-9A29-60C9A9B21D0E
TopPiece.AD_ASM
SmallGear.AD_PRT
RotorDriver.AD_PRT
ClampPiece.AD_PRT
GearSupport.AD_PRT
MotorHousing.AD_PRT
LargeGear.AD_PRT
Motorlead.AD_PRT
MotorAxle.AD_PRT
Motorbushing.AD_PRT
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
G:\04-12-2023\0_Alibre_Shaver_Assembly\TopPiece.AD_ASM
8C45FC46-DC31-4BFB-BC66-30AC233B7118
67552739-EA6B-44BB-AD9B-75734197EA3E
F963A5D9-9BFC-425A-9594-917983AE246C
68BC1673-841F-463D-8617-62EBFB813241
19C44F1A-D331-46D8-B62B-0055D6C9AE23
GrayHolster.AD_PRT
Spring.AD_PRT
Twister.AD_PRT
TwisterButton.AD_PRT
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
C:/Users/Midas/AppData/Local/Temp/PackageTempFolder0/
G:\By-Date\8-12-2021\8-4-2021.AD_ASM
A18C2D6F-6672-4D7D-9360-CD72CA3613B6
74C43C26-2B8B-4688-BE87-46A377EF8AFE
remote_design_from_3dm.AD_PRT
And here is a stripped-down version of my program:
Code:
Dim Hook As IAutomationHook
Dim Root As IADRoot
Sub Main()
Hook = GetObject(, "AlibreX.AutomationHook")
Root = Hook.Root
GetConstInfo()
Hook = Nothing
Root = Nothing
End Sub
Sub GetConstInfo()
For Each item As String In File.ReadAllLines("C:\Users\steph\Desktop\ad_asm_file_list.txt")
Console.WriteLine(item)
Dim constituentGuids As Object = Nothing
Dim constituentNames As Object = Nothing
Dim constituentRelativeFilePaths As Object = Nothing
Dim guid As String = Nothing
Root.GetGuidAndConstituentInformation(item, guid, constituentGuids, constituentNames, constituentRelativeFilePaths)
Console.WriteLine(guid)
For Each constituentGuid As String In constituentGuids
Console.WriteLine(constituentGuid)
Next
For Each constituentName As String In constituentNames
Console.WriteLine(constituentName)
Next
For Each constituentRelativeFilePath As String In constituentRelativeFilePaths
Console.WriteLine(constituentRelativeFilePath)
Next
Next
End Sub
The output is hard to read because I have a structure that's not included in the example program.
I've tried to write something like this, but it is really slow, loading and rendering each assembly.
To work with GetGuidAndConstituentInformation() you don't need to have any files open only the home window (Alibre Design.exe is running).
Rather than searching for a constituent, maybe just list the contents of each assembly to a text file.
This is an option but will take more time if it is a batch process, headless mode would be faster.