Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assembling parts in Product with macro

Status
Not open for further replies.

HarunMusic

Computer
Joined
Nov 21, 2014
Messages
71
Location
BA
Hi, i need macro who will assemble for example 10 instances of the same part in product in different places. Before that i had created axis System for each Location, so i ll have only one constraint in assembly, coincidence between created axis and axis in part.

1. Open part for Assembling
2. select Axis for instances(this will be in one part already inside the product)
3. Assembled

any hints and idea pls
 
i ll try this but i have problems wit reference :(
Sub CATMain()

Dim productDocument1 As Document
Set productDocument1 = CATIA.ActiveDocument

Dim product1 As Product
Set product1 = productDocument1.Product

Dim constraints1 As Collection
Set constraints1 = product1.Connections("CATIAConstraints")
'-----------------------------------------------------------------------------------------
'this is for coincidence
'-----------------------------------------------------------------------------------------
Dim InputObjectType(0)
Dim InputDocType(0)

InputDocType(0) = "Part"
Set ActiveDoc = CATIA.ActiveDocument
Set osel = ActiveDoc.Selection

InputObjectType(0)= "AxisSystem"
Result = osel.SelectElement2(InputObjectType, "Select a Axis System ", False)

If Result = "Cancel" Then
MsgBox ("Command Canceled")
Exit Sub
End If

Dim reference1 As Reference
reference1=osel.item(1).name

Dim reference2 As Reference
Set reference2 = product1.CreateReferenceFromName("PRODUCT1/PART2.2/!PART2/Absolute Axis System")

Dim constraint1 As Constraint
Set constraint1 = constraints1.AddBiEltCst(2, reference1, reference2)

product1.Update
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top