Machining

Generating an HTML Documentation from a Tool List


This macro CAAMaiToolListDocumentation shows you how to generate an HTML document from a list of Tools used in one or more Manufacturing Programs.

It creates an HTML document by retrieving the process document, scanning the list of Manufacturing Activities, and reading Tools and Tool Assemblies used in the Program.

 

CAAMaiToolListDocumentation is launched in CATIA. A Process document with a completed Manufacturing Program is needed.

CAAMaiToolListDocumentation.CATScript is located in the CAAScdMaiUseCases module. 

You can also use the VB Macro ToolList.CATScript located in startup\Manufacturing\Documentation.

 

CAAMaiToolListDocumentation includes five  steps:

  1. Create the HTML file for the documentation
  2. Retrieve the active document
  3. Retrieve the current Process of the active document
  4. Retrieve the list of activities of the current Process
  5. Have a look at the generated documentation

Create the HTML file for the documentation

...
'--------------------------------------------------------------- 
' Create the HTML file 
'---------------------------------------------------------------
Dim aFileSyst As FileSystem 
Set aFileSyst = CATIA.FileSystem 
Dim theHTMLFile As File 
Dim aTextStream As TextStream 
Set theHTMLFile = aFileSyst.CreateFile(HtmlFilesPath & OutIndex, True) 
Set aTextStream = theHTMLFile.OpenAsTextStream("ForWriting")
...

Create the HTML file and open it as a Text Stream in order to set data for documentation.

Retrieve the active CATProcess document

...
'---------------------------------------------------------------
' Retrieve the active document
'---------------------------------------------------------------
 Dim MfgDoc1 As Document
 set MfgDoc1 = CATIA.ActiveDocument
 ...

Retrieves the active document and set it in the variable MfgDoc1.

Retrieve the current Process of the active document

...
'--------------------------------------------------------------- 
' Retrieve the current Process 
'--------------------------------------------------------------- 
Set aProcess = MfgDoc1.GetItem("Process")
...

The current Process is retrieved as an Item of the active document. 

Retrieve the list of activities and read Tool Assemblies and Tools

...
For i = 1 To quantity 
	Set CurrentSetup = childs.Item(i) 
	If (CurrentSetup.IsSubTypeOf("ManufacturingSetup")) Then 
 
	'--------------------------------------------------------------- 
	' Read the Programs of the current Setup 
	'--------------------------------------------------------------- 
	Set ProgramList = CurrentSetup.Programs 
	NumberOfProgram = ProgramList.Count 
	
	For J = 1 To NumberOfProgram 
	
		Set CurrentProgram = ProgramList.GetElement(J) 
 
		'--------------------------------------------------------------- 
		' Read the Activities of the current Program 
		'--------------------------------------------------------------- 
		Set ActivityList = CurrentProgram.Activities 
		NumberOfActivity = ActivityList.Count 
	
		For K = 1 To NumberOfActivity 
	
			Set CurrentActivity = ActivityList.GetElement(K) 
			ActivityName = CurrentActivity.Name 
			ActivityType = CurrentActivity.Type 
			
			'--------------------------------------------------------------- 
			' Read the Activity Type 
			' If the Activity is a tool Change -> Add to the document 
			'--------------------------------------------------------------- 
			If (ActivityType = "ToolChange" Or ActivityType = "ToolChangeLathe") Then 
			
				... 
				Set CurrentAssembly = CurrentActivity.ToolAssembly 
				AssemblyNumber = CurrentAssembly.Number 
				...
				Dim Attribut As Parameter 
				Set Attribut = CurrentAssembly.getAttribute("MFG_NAME") 
				AssemblyName = Attribut.Value 
 
				Set CurrentTool = CurrentActivity.Tool 
				ToolNumber = CurrentTool.Number 
				ToolName = CurrentTool.Name
				
				 ...
			End If
			...
		Next
		...
	Next
	...
Next

Retrieve the list of activities to scan in the current Process. Then scan the setup and Program list to retrieve Manufacturing Activities such as Tool Changes.

Finally read the Tool Assemblies and Tools information to be written in the HTML output file.

Have a look at the generated documentation 

Sample of the generated documentation for the Tool List

[Top]


In Short

This use case has shown how to generate an HTML documentation from a Tool List

[Top]


References

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

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