 |
CAAMaiInsertLatheToolMotion includes 7 steps:
- Retrieve the open body of the CATPart
- Retrieve the tool motions geometry.
- Retrieve the active process and current setup
- Retrieve the Manufacturing Program and create a
lathe machine
- Insert a lathe sequential activity and assign its
tool
- Create a Go Standard tool motion and set its
geometry
- Creation of Go Go tool motion on line D1 and D2
- Creation of Indirv tool motion on line D3 and
D4
- Creation of Delta tool motion on point PT2 and PT3
- Creation of Go Go tool motion on line D5 and D6
- Creation of Delta tool motion on line D5
- Creation of Go Standard tool motion on line
D6
- Creation of Follow on line D7
- Creation of a PP Word
Retrieve the open body of the CATPart
...
'*******************************************************************************************
'*** Retrieve the Open body of the part
'*******************************************************************************************
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("PartLathe_ToolMotion.CATPart")
Set part1 = partDocument1.Part
Set hybridBodies1 = part1.HybridBodies
Set hybridBody1 = hybridBodies1.Item("Open_body.1")
Set hybridShapes1 = hybridBody1.HybridShapes
...
|
Retrieves the open body and sets it in the variable hybridShapes1.
...
'*******************************************************************************************
'*** Retrieve the tool motion's geometry
'*******************************************************************************************
Set PT1 = hybridShapes1.Item("PT1")
Set PT2 = hybridShapes1.Item("PT2")
Set PT3 = hybridShapes1.Item("PT3")
Set D1 = hybridShapes1.Item("D1")
Set D2 = hybridShapes1.Item("D2")
Set D3 = hybridShapes1.Item("D3")
Set D3 = hybridShapes1.Item("D3")
Set D4 = hybridShapes1.Item("D4")
Set D5 = hybridShapes1.Item("D5")
Set D6 = hybridShapes1.Item("D6")
Set D7 = hybridShapes1.Item("D7")
...
|
.Retrieves the geometry used to define the tool motions, using their
names in the open body.
Retrieve the active process and current setup
...
Set MfgDoc1 = CATIA.ActiveDocument
'*******************************************************************************************
'*** Retrieve current Process Root
'*******************************************************************************************
Set ActivityRef = MfgDoc1.GetItem("Process")
'*** Retrieve current SetUp
'***
If (ActivityRef.IsSubTypeOf("PhysicalActivity")) Then
Set childs = ActivityRef.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 Setup1 = child
NumberOfPO = NumberOfPO +1
Exit For
End If
Next
End If
...
|
Retrieves the Manufacturing Setup and sets it in the variable
Setup1 .
Retrieve the Manufacturing Program and create a
lathe machine
...
'*******************************************************************************************
'*** Retrieve current Program
'*******************************************************************************************
set ProgramList = Setup1.Programs
Set PartMachined = SetUp1.Product
Set Program1 = ProgramList.GetElement(1)
'*******************************************************************************************
' Create lathe horizontal machine
'*******************************************************************************************
Dim Machine1 As ManufacturingMachine
Set Machine1 = SetUp1.CreateMachine("MfgHorizontalLatheMachine")
...
|
.Retrieves the Manufacturing Program and sets it in the variable
Program1. Retrieves the product linked to the Setup and sets it in the
variable "PartMachined", the variable will be useful to assign
geometry on the activity.
Creates a machine of type "MfgHorizontalLatheMachine".
Insert a lathe sequential activity and assign its
tool
...
'*******************************************************************************************
' Creation lathe sequential operation
'*******************************************************************************************
dim Mo1 As ManufacturingOperation
Set Mo1 = Program1.AppendOperation("MfgLatheSequentialOperation",1)
MO1.SetTool("T1 External Tool")
...
|
Inserts a lathe sequential operation in the program
"Program1" and assigns to it an External tool.
Create a Go Standard tool motion and set its
geometry
...
'*******************************************************************************************
' Creation of gostd tool motion and geometry assignment
'*******************************************************************************************
Set Tm1 = Mo1.InsertToolMotion("MfgSeqMotionLatheGoStd", 1)
Call Tm1.SetGeometry("Parts", PT1, PartMachined, 0)
...
|
Inserts a Go standard tool motion ("MfgSeqMotionLatheGoStd")
at the first position("1") in the tool motion list, use
("0") as second argument to create a tool motion at the end of
the tool motion's list without specifying its position.
Assigns the first check geometry using the SetGeometry method. We are
using one point (PT1), from the geometry we retrieved at step 2,as
second argument and the product which contains this geometry
(PartMachined) as third argument. Use ("0") as last argument .
Defines the first check element of a Go Standard motion by using the
geometry type "Parts" as first argument in SetGeometry method.
Create a Go Go tool motion on line D1 and line D2
...
'*******************************************************************************************
' Creation of Go GO tool motion
'*******************************************************************************************
Set Tm2 = Mo1.InsertToolMotion("MfgSeqMotionLatheGoStd",2)
Call Tm2.SetGeometry("Parts", D2, PartMachined, 0)
Call Tm2.SetGeometry("SecondRelimitingElement", D1, PartMachined, 0)
...
|
Inserts a Go Go tool motion ("MfgSeqMotionLatheGoStd") ,
creates it at the second position ("2") of the tool motion's
list.
To assign the first check (D2) of Go Std or Go GO, uses SetGeometry
with "Parts" as geometry type, "0" as last argument.
To assign the second check (D1) of a Go Go tool motion , uses
"SecondRelimitingElement" as geometry type.
Create an Indirv tool motion on line D4 and line
D3
...
'*******************************************************************************************
' Creation of Indirv tool motion
'*******************************************************************************************
Set Tm3 = Mo1.InsertToolMotion("MfgSeqMotionLatheIndirv",3)
Call Tm3.SetGeometry("Parts", D4, PartMachined, 0)
Call Tm3.SetGeometry("FirstRelimitingElement", D3, PartMachined, 0)
...
|
Inserts an Indirv tool motion ("MfgSeqMotionLatheIndirv") ,
creates it at the third position ("3") of the tool motion's
list.
To assign the first check (D4) of the Indirv tool motion , uses
"Parts" as geometry type.
To assign the drive (D3) of Indirv tool motion, uses SetGeometry with
"FirstRelimitingElement" as geometry type, "0" as last
argument.
Create a Delta tool motion using point PT2 and
PT3
...
'*******************************************************************************************
' Creation of Delta tool motion
'*******************************************************************************************
Set Tm4 = Mo1.InsertToolMotion("MfgSeqMotionLatheDelta", 4)
Dim DeltaMode As Variant
Set DeltaMode = Tm4.GetAttribute("MfgLatheEODeltaCheckMode")
DeltaMode.ValuateFromString ("MfgLatheDeltaPtPt")
Call Tm4.SetGeometry("FirstRelimitingElement", PT2, PartMachined,1)
Call Tm4.SetGeometry("FirstRelimitingElement", PT3,PartMachined, 2)
...
|
Inserts a Delta tool motion ("MfgSeqMotionLatheDelta") ,
creates it at the fourth position ("4") of the tool motion's
list.
The attribute Delta Check Mode ("MfgLatheEODeltaCheckMode")
is set in variable DeltaMode . This delta
tool motion uses the "Distance between two points" mode, so
DeltaMode contains the value "MfgLatheDeltaPtPt".
In the distance between two point mode, by the SetGeometry
method, we assign the first point (PT2) using
"FirstRelimitingElement" as geometry type, and "1" as
last argument. Which means that PT2 is stored in first position. We assign
the second point (PT3) using "FirstRelimitingElement" as
geometry type, and "2" as last element, to store it in second
position in the same container.
When using "Line and Distance" as Delta check mode, you will
have to store a line using SetGeometry with
"FirstRelimitingElement" as geometry type and "0" as
last argument.
Create a Go Go tool motion on line D6 and line
D5
...
'*******************************************************************************************
' Creation of Go GO tool motion
'*******************************************************************************************
Set Tm5 = Mo1.InsertToolMotion("MfgSeqMotionLatheGoStd",5)
Call Tm5.SetGeometry("Parts", D6, PartMachined, 0)
Call Tm5.SetGeometry("SecondRelimitingElement", D5, PartMachined, 0)
...
|
Inserts a Go Go tool motion ("MfgSeqMotionLatheGoStd") ,
creates it at the fifth position ("5") of the tool motion's
list. We could have used "0" as last argument to create it at
the end of current list.
To assign the first check (D6) of Go Std or Go GO, uses SetGeometry
with "Parts" as geometry type, "0" as last argument.
To assign the second check (D5) of the Go Go tool motion , uses
"SecondRelimitingElement" as geometry type.
Create a Delta tool motion on line D5
...
'*******************************************************************************************
' Creation of Delta tool motion
'*******************************************************************************************
Set Tm6 = Mo1.InsertToolMotion("MfgSeqMotionLatheDelta", 6)
Set DeltaMode = Tm6.GetAttribute("MfgLatheEODeltaCheckMode")
DeltaMode.ValuateFromString ("MfgLatheDeltaLineDist")
Call Tm6.SetGeometry("FirstRelimitingElement", D5, PartMachined, 0)
Dim DeltaValue as Variant
Set DeltaValue = Tm6.GetAttribute("MfgLatheEOValueDistance")
DeltaValue.Value = 10
...
|
Inserts a Delta tool motion ("MfgSeqMotionLatheDelta") ,
creates it at the sixth position ("6") of the tool motion's
list.
The attribute Delta Check Mode ("MfgLatheEODeltaCheckMode")
is set in variable DeltaMode . This delta
tool motion uses the "Line and Distance" mode, so DeltaMode is
valuated by "MfgLatheDeltaLineDist".
In the "Line and distance" mode, using the SetGeometry
method, we assign the line (D5) using
"FirstRelimitingElement" as geometry type, and "0" as
last argument.
The Distance attribute ("MfgLatheEOValueDistance") is set in
variable DeltaValue . DeltaValue is set to
"10".
Create a Go Standard tool motion on line D6
...
'*******************************************************************************************
' Creation of gostd tool motion and geometry assignment
'*******************************************************************************************
Set Tm7 = Mo1.InsertToolMotion("MfgSeqMotionLatheGoStd", 7)
Call Tm7.SetGeometry("Parts", D6, PartMachined, 0)
...
|
Inserts an Go Standard tool motion ("MfgSeqMotionLatheGoStd"
with only one check element) , creates it at the seventh position
("7") of the tool motion's list.
Assigns the first check geometry using the SetGeometry method. We are
using one line (D6) from the geometry we retrieved at step 2.
To assign the drive (D6) of Go Standard tool motion, uses SetGeometry
with "Parts" as geometry type, "0" as last argument.
Create a Follow tool motion on line D7
...
'*******************************************************************************************
' Creation of Follow tool motion and geometry assignment
'*******************************************************************************************
Set Tm8 = Mo1.InsertToolMotion("MfgSeqMotionLatheFollow", 8)
Call Tm8.SetGeometry("Parts", D7, PartMachined, 0)
...
|
Inserts an Follow tool motion ("MfgSeqMotionLatheFollow") ,
creates it at the eightth position ("8") of the tool motion's
list.
To assign the first check (D7) of the Follow tool motion , uses
"Parts" as geometry type.
Create a PP Word tool motion
...
'*******************************************************************************************
' Creation of PP Word tool motion and geometry assignment
'*******************************************************************************************
Set Tm5 = Mo1.InsertToolMotion("MfgSeqMotionPPWord",9)
Dim TMList As MfgToolMotions
Set TMList = MO1.GetListOfToolMotions
NbMo = TMList.Count
'msgbox NbMo
Dim Test As ManufacturingToolMotion
Set Test = TMList.GetElement(1)
...
|
Inserts an PP Word tool motion ("MfgSeqMotionPPWord") ,
creates it at the nineth position ("9") of the tool motion's
list.
Retrieves the list of tool motions and sets it to the variable TMList,
the method GetElement(number) enables to get the tool motion located at
position "number" in a variable of
"MfgToolMotions" type (list of tool motion). Count property
enables to retrieve the number of elements of this tool motions list.
|