Structure Design

Modifying Cutouts


Target Icon

This macro shows you how to edit existing cutout on Structure Objects.

This macro replaces the contour and direction used for creating existing cutout.

Starting Product

Information Icon

CAAStrEditCutout is launched in CATIA [1]. Some documents are needed.

  • You have to run CreateCutout.CATScript macro before running this macro.
  • CAAStrEditCutout.CATScript is located in the CAAScdStrUseCases module. Execute macro (Windows only).
  • The document Product1.CATProduct is located in the CAAScdStrUseCases module in the samples directory. Grid.CATPart is linked to the previous document and it contains the grid, sketches and surfaces used by the macro.
  • The CATPart containing the section is located in the samples directory.
Scenario Icon

CAAStrEditCutout includes three steps:

  1. Prolog
  2. Retrieving Existing Cutout
  3. Modifying the Cutout

Prolog

Dim doc As Document

Dim StrWorkbench As StrWorkbench
Dim strFactory As StrObjectFactory

Set doc = CATIA.ActiveDocument

Dim rootProduct As Product
Set rootProduct = doc.Product
   
Set StrWorkbench = doc.GetWorkbench("StrWorkbench")
    
Dim strPlates As strPlates
Set strPlates = rootProduct.GetTechnologicalObject("StructurePlates")

Retrieving Existing Cutout

The Existing cutout can be searched by using the search method on selection.”StrCutout.1” is searched for in the entire product.

We will modify the first cutout retrieved.

Dim selection1 As Selection
Set selection1 = doc.Selection

selection1.Search "Name='StrCutout.1',all"

Dim CutoutToEdit As StrCutoutFeature
Set CutoutToEdit = selection1.Item(1).Value

Modifying the Cutout

Replace the existing contour of the cutout with a new one and also change the direction.

'Get the Cutout Type
Dim FormingMode As String
FromingMode = CutoutToEdit.CutoutType

'Get the Current Contour
Dim CurrentContour As Reference
Set CurrentContour = CutoutToEdit.Contour

'Get the Current Direction Element
Dim CurrentDirElement As Reference
Set CurrentDirElement = CutoutToEdit.DirectionElement

'Set the New Direction Element

Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("Grid.CATPart")
Set part1 = partDocument1.Part

Set Newdir = part1.FindObjectByName("Sketch.4")
Set NewDirElement = part1.CreateReferenceFromObject(Newdir)
CutoutToEdit.DirectionElement = NewDirElement

'Set the New Contour
Dim NewContour As Reference
Set NewContour = rootProduct.CreateReferenceFromName("Product1/Grid/!Sketch.2")
CutoutToEdit.Contour = NewContour

End Sub

End Task Icon

[Top]


In Short

This use case has shown how to edit Cutouts on structure Objects.

[Top]


References

[1] Replaying a macro
[Top]

Copyright © 1999-2010, Dassault Systèmes. All rights reserved.