Machining

Loading the Machining Workbench and Initializing the Setup Activity


This macro CAAMaiInitializeSetUp shows you how to launch NC Workbench and make an association between the Setup and the Part.

CAAMaiInitializeSetUp is launched in CATIA. Open the file 'Sample.CATPart' located in the CAAScdMaiUseCases module, and run the macro.

CAAMaiInitializeSetUp.CATScript is located in the CAAScdMaiUseCases module.

CAAMaiInitializeSetUp includes five steps:

  1. Retrieving the Active Part Document and the Associated Product
  2. Creating a New Process Document
  3. Starting the Prismatic Machining Workbench 
  4. Retrieving the current Setup of the Existing Process
  5. Associating the Product with the Setup Activity

Retrieving the Active Part Document and the Associated Product

...
Dim thePartDoc As Document
Set thePartDoc = CATIA.ActiveDocument

Dim theProduct As Product
Set theProduct = thePartDoc.Product
...

Retrieves the active Part document and sets it in the variable thePartDoc, then retrieves the associated Product and sets it in the variable theProduct.

Creating a New Process Document

...
CATIA.Documents.Add "Process"
Dim thePPRDoc As Document
Set thePPRDoc = CATIA.ActiveDocument
...

Creates a new Process document and sets it in the variable thePPRDoc.

Starting the Prismatic Machining Workbench

...
Dim theApplication As Application
Set theApplication = thePPRDoc.Application
theApplication.StartWorkbench("ManufacturingProgramWorkbench")
...

Starts the Prismatic Machining Workbench.

Retrieving the Current Setup of the Existing Process

...
Dim theSetup As ManufacturingSetup
If (theProcess.IsSubTypeOf("PhysicalActivity")) Then
  Set childs = theProcess.ChildrenActivities
  quantity = childs.Count
  If quantity <= 0 Then
    Exit Sub
  End If

  NumberOfPO = 0
  For I=1 To quantity
    Set child = childs.Item(I)
    If (child.IsSubTypeOf("ManufacturingSetup")) Then
      Set theSetup = child
      NumberOfPO = NumberOfPO + 1
      Exit For
    End If
  Next
End If
If NumberOfPO <= 0 Then
  Exit Sub
End If
...

Scans the Process activities, searches for the existing Setup and sets it in the variable theSetup.

Associating the Product with the Setup Activity

...
theSetup.Product = theProduct
...

Associates the Product with the Setup activity.

[Top]


In Short

This use case has shown how to launch an NC Workbench and make an association between the Setup and the Part.

[Top]


References

[1] Replaying a Macro
[2] Machining automation objects
[Top]

Copyright © 2002, Dassault Systèmes. All rights reserved.