Machining

Inserting Axial Tool Motion in a Point To Point Activity


This macro CAAMaiInsertAxialToolMotion shows you how to create a Point To Point activity and insert tool motions inside this activity.

 

CAAMaiInsertAxialToolMotion is launched in CATIA. Open the file 'Part_ToolMotion.CATPart' located in the CAAScdMaiUseCases module, go to the Prismatic Manufacturing Programmer workbench and run the macro.

CAAMaiInsertAxialToolMotion .CATScript is located in the CAAScdMaiUseCases module. 

 

CAAMaiInsertAxialToolMotion includes 7 steps:

  1. Retrieve the open body of the CATPart
  2. Retrieve the  tool motions geometry.
  3. Retrieve the active process and current setup
  4. Retrieve the Manufacturing Program
  5. Insert a Point To Point activity and assign its tool
  6. Insert a Point tool motion and set its geometry
  7. Insert a Position tool motion and assign its geometry
  8. Insert a Delta tool motion and assign an offset and a reference line

Retrieve the open body of the CATPart

...
 
	'*******************************************************************************************
	'*** Retrieve the Open body of the part
	'*******************************************************************************************

	Set documents1 = CATIA.Documents
	Set partDocument1 = documents1.Item("Part_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 motions geometry

...
 
	'*******************************************************************************************
	'*** Retrieve the tool motion's geometry
	'*******************************************************************************************

	Set Plane1 = hybridShapes1.Item("Plane.1")
	Set Line1 = hybridShapes1.Item("Line.1")
	Set Point1 = hybridShapes1.Item("Point.1")
	Set Point2 = hybridShapes1.Item("Point.2")
	Set Point3 = hybridShapes1.Item("Point.3")
	Set Plane2 = hybridShapes1.Item("Plane.2")
	Set Line2 = hybridShapes1.Item("Line.2")
	Set Line3 = hybridShapes1.Item("Line.3")
 
...

.Retrieves the geometry used for 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

...
 
	'*******************************************************************************************
	'*** Retrieve current Program
	'*******************************************************************************************

	set ProgramList = Setup1.Programs
	Set PartMachined = SetUp1.Product
	Set Program1 = ProgramList.GetElement(1)	
 ...

.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.

Insert a Point To Point activity and assign its tool

...
 
	'*******************************************************************************************
	' Creation axial sequential operation
	'*******************************************************************************************

	Dim Mo As ManufacturingOperation 	
	Set Mo = Program1.AppendOperation("PointToPoint",1)
	Mo.SetTool("T3 End Mill D 10")

...

Inserts a Point To Point sequential operation in the program "Program1" and assigns to it an End Mill tool.

Insert a Point tool motion and set its geometry

...
 
	'*******************************************************************************************
	' Creation of point tool motion
	'*******************************************************************************************

	Dim Tm1 as ToolMotion
	Set Tm1 = Mo.InsertToolMotion("MfgSeqMotionPoint",1)
	Call Tm1.SetGeometry("PointSite",Point3, PartMachined, 0)
 
...

Inserts a Point tool motion ("MfgSeqMotionPoint") 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.

Assigns the geometry using the SetGeometry method  using one point from the geometry we retrieved (Point3) and the product which contains this geometry (PartMachined) as second argument. Use ("0") as last argument for a Point tool motion.

For a Point tool motion, uses the geometry type "PointSite" as first argument.

Insert a Position tool motion and assign its geometry

...
 
	'*******************************************************************************************
	' Creation of position tool motion
	'*******************************************************************************************

	Dim Tm2 as ToolMotion
	Set Tm2 = Mo.InsertToolMotion("MfgSeqMotionPosition",2)

        Call Tm2.SetGeometry("Parts", Plane1, PartMachined, 0)
   	Call Tm2.SetGeometry("FirstRelimitingElement", Line2, PartMachined, 0)
   	Call Tm2.SetGeometry("Drives",Line3 , PartMachined, 0)

	'*******************************************************************************************
	' Modification of Position on check parameter
	'*******************************************************************************************
	Dim CheckMode As Variant
        Set CheckMode = Tm2.GetAttribute("MfgCheckStopMode")
        CheckMode.ValuateFromString ("MfgPast")
...

Inserts a Position tool motion by using the type "MfgSeqMotionPosition", creates it at the second position ("2") of the tool motion's list.

To assign the object Plane1 as Part element, use SetGeometry and "Parts" as geometry type, "0" as last argument.

To assign a Check element, use "FirstRelimitingElement" as geometry type, to assign a Drive element use "Drives".

Modifies the position on the check element (Past instead of To) by reading the attribute "MfgCheckStopMode" in variable CheckMode, then modifying its value ("MfgPast").

 

Insert a Delta tool motion and assign an offset and a reference line

...
 
'*******************************************************************************************
	' Creation of delta tool motion 
	'*******************************************************************************************
	Dim Tm3 as ToolMotion
	Set Tm3 = Mo.InsertToolMotion("MfgSeqMotionDelta",3)
   	Set CheckMode = Tm3.GetAttribute("MfgPtDeltaMode")
    	CheckMode.ValuateFromString ("MfgPtDeltaParallelLine")
    	Call Tm3.SetGeometry("GuidingElements", Line2, PartMachined, 0)
	Dim OffsetValue As Variant
   	Set OffsetValue = Tm3.GetAttribute("MfgPtDeltaDistance")
    	OffsetValue.Value = 15

	'*******************************************************************************************
	' get the list of tool motions and reading each tool motion 
	'*******************************************************************************************
	Dim TMList2 As MfgToolMotions
	Set TMList2 = MO.GetListOfToolMotions
	NbMo = TMList2.Count
	Dim Test2 As ManufacturingToolMotion
	Set Test2 = TMList2.GetElement(1)
...

Inserts a Delta tool motion using the type "MfgSeqMotionDelta".  Reads the mode of the tool motion ("MfgPtDeltaMode") and sets it in variable CheckMode. Sets the mode "Parrallel to line " by valuating CheckMode to "MfgDeltaParallelLine" .

To assign Line2 as reference line in a Delta tool motion, use the geometric type "GuidingElements" .

Retrieve the offset "MfgPtDeltaDistance" in the variable OffsetValue, and set it to 15 .

Retrieves the list of tool motions and set it to the variable TMList2, the method GetElement(number) enables to get the tool motion located at position "number" in a variable of  "MfgToolMotions" type (list of tool motion).

 

 

[Top]


In Short

This use case has shown how to create a Point To Point activity, how to insert tool motion inside, and how to assign geometry to these tool motions.

[Top]


References

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

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