Tworzenie i modyfikowanie złożeń
Creating and Manipulating Assemblies
Pokazuje, jak utworzyć złożenie, dodać do niego części oraz powielić i przesunąć części.
*Umieść na pulpicie plik części dostępny pod poniższym łączem (lub utwórz własny plik części i zmień jego ścieżkę oraz nazwę pliku w wierszu 4 skryptu.
https://help.alibre.com/resources/Storage/Downloads/PartA.AD_PRT
„Kopiuj” (Copy) kod Python
# create a new empty assemblyAsm = Assembly("Test");# add an existing part, located at the origin, replace path with your ownNewPart1 = Asm.AddPart(r'C:\Users\Brian\Desktop\PartA.AD_PRT', 0, 0, 0, 0, 0, 0, True)# duplicate the part, translate it to x = 5, y = 10, z = 15 and rotate it x 30 deg, y 40 deg, z 50 degNewPart2 = Asm.DuplicatePart(NewPart1, 5, 10, 15, 30, 40, 50, True)# duplicate the part, rotate it x 30 deg, y 40 deg, z 50 deg and translate it x = 5, y = 10, z = 15NewPart3 = Asm.DuplicatePart(NewPart1, 5, 10, 15, 30, 40, 50, False)# anchor the original partAsm.AnchorPart(NewPart1);# get the part (this is an 'assembled part')P = Asm.GetPart(NewPart1.Name)# show the faces on the partprint P.FacesOryginał: Creating and Manipulating Assemblies