Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
A.Acheson
in reply to: phani.gampala

If you replace the static occurrence name with "" in AddContentCenterPart this will then automatically assign the name as the part is added therefore adding the index :1,:2,:3 etc.You don't need to deal with creating new/duplicate names.

Next for the constraint replace the static occurrence name with the name linked to the object occurrence added previously. 

Component1 = Components.AddContentCenterPart("","Fasteners:Washers:Plain","SS Flat Washers",
                                                 {"STOCK_TYPE","S","NND","10"},
                                                 position := Nothing, grounded := False, 
                                                 visible := True, appearance := Nothing)
Component2 = Components.AddContentCenterPart("","Fasteners:Washers:Spring","SS Spring Washers",
                                                 {"STOCK_TYPE","S","NND","10"},
                                                 position := Nothing, grounded := False, 
                                                 visible := True, appearance := Nothing)

Constraints.AddMate("", Component1.Name, "Work Axis1", Component2.Name, "Work Axis1",
                    offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference,
                    solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType,
                    biasPoint1 := Nothing, biasPoint2 := Nothing)
Constraints.AddMate("", Component1.Name, "YZ PLANE", Component2.Name, "YZ PLANE",
                    offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference,
                    solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType,
                    biasPoint1 := Nothing, biasPoint2 := Nothing)

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan