×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Assembling parts in Product with macro

Assembling parts in Product with macro

Assembling parts in Product with macro

(OP)
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

RE: Assembling parts in Product with macro

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources