Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Nov 21, 2014
71
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
 
Replies continue below

Recommended for you

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

Top