Structure Design |
Modifying Cutouts |
|
|
This macro shows you how to edit existing cutout on Structure Objects. This macro replaces the contour and direction used for creating existing cutout.
|
|
|
CAAStrEditCutout is launched in CATIA [1]. Some documents are needed.
|
|
|
CAAStrEditCutout includes three steps: PrologDim 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 CutoutThe 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 CutoutReplace 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
|
![]()
[Top]
This use case has shown how to edit Cutouts on structure Objects.
[Top]
| [1] | Replaying a macro |
| [Top] | |
Copyright © 1999-2010, Dassault Systèmes. All rights reserved.