Structure Detail Design

Editing Standard Openings


Target Icon This macro shows you how to edit existing standard opening on an SDD plate. Here the macro will first create several standard Openings using Offset-Offset Strategy. The same macro will then edit the last created standard Opening, by modifying its contour parameters, offsets from references etc

Starting Part

Information Icon CAASddOffset_Offset is launched in CATIA [1]. Some documents are needed.
  • CAASddOffset_Offset.CATScript is located in the CAAScdSddUseCases module. Execute macro (Windows only).
  • The document Product1.CATProduct is located in the CAAScdSddUseCases module in the samples directory. Design_Unit_002.CATPart is linked to the previous document and it contains data required for the macro.
  • The CATPart containing the section is located in the samples directory.
CAASddOffset_Offset includes six steps:
  1. Prolog
  2. Prepare U and V References List
  3. Define Contour Parameters
  4. Define Position Strategy and Create Standard Opening
  5. Edit Contour Parameters and Redefine Them
  6. Edit Position Parameter Data

Prolog

Set documents1 = CATIA.Documents
Set PartDocument1 = documents1.Item("Design_Unit_002.CATPart")
Set Part1 = PartDocument1.Part
Set plate = Part1.FindObjectByName("Deck_002")
Set plateref = Part1.CreateReferenceFromObject(plate)

'Get the Factory and Managers

Dim Factory As SfmFunctionFactory
Set Factory = Part1.GetCustomerFactory("SfmFunctionFactory")

Dim ObjSfmContourMgr As SfmOpeningContoursMgr
Set ObjSfmContourMgr = Factory.GetOpeningMgr(Part1, "SfmOpeningContoursMgr")
 
Dim ObjSfmPosStrategyMgr As SfmPositioningStrategyManager
Set ObjSfmPosStrategyMgr = Factory.GetOpeningMgr(Part1,"SfmPositioningStrategyManager")

Prepare U and V References List

'Prepare a List of U & V Reference
 Dim UrefList As SfmReferences
 Dim Uref1 As Reference
 Set Uref1 = Part1.FindObjectByName("CROSS.95")
 Set Uref2 = Part1.FindObjectByName("CROSS.50")
 Set Uref3 = Part1.FindObjectByName("CROSS.25")
 Set Uref4 = Part1.FindObjectByName("CROSS.40")
 Set UrefList = Factory.SfmReferences
 UrefList.Add Uref1
 UrefList.Add Uref2
 UrefList.Add Uref3
 UrefList.Add Uref4
 
 Dim VrefList As SfmReferences
 Dim Vref1 As Reference
 Set Vref1 = Part1.FindObjectByName("LONG.0")
 Set VrefList = Factory.SfmReferences
 VrefList.Add Vref1

 
 Dim NbofURef As Long
 NbofURef = UrefList.Count
 
 Dim NbofVRef As Long
 NbofVRef = VrefList.Count

Define Contour Parameters

'Define the Contour
 Dim oListContourNames() As Variant
 ObjSfmContourMgr.GetAvailableStdOpeningContours oListContourNames
 Dim NbOfContour As Long
 NbOfContour = UBound(oListContourNames)

 'Select Contour from List
 Dim oListCkeParms As SfmStandardContourParameters
 Set oListCkeParms = ObjSfmContourMgr.GetStdOpeningContourParams("Sfm_Rect")

'Display List of Parameters for Selected Contour
 Dim NbOfParam As Long
 NbOfParam = oListCkeParms.Count
 Dim ContourParam As Parameter
 Dim ContourParamName As String
 For i = 1 To NbOfParam
  Set ContourParam = oListCkeParms.Item(i)
  ContourParamName = oListCkeParms.Item(i).Name

'Set Contour Parameter Values
  If ContourParamName = "Sfm_Width" Then
    ContourParam.ValuateFromString ("1500mm")
    End If
  If ContourParamName = "Sfm_Height" Then
    ContourParam.ValuateFromString ("2000mm")
     End If
  If ContourParamName = "Sfm_CornerRadius" Then
    ContourParam.ValuateFromString ("10mm")
     End If
 Next

Define Position Strategy and Create Standard Opening

'Define the Position Strategy

Dim PositionStrategyParms As SfmStandardPosStrategyParameters
Set PositionStrategyParms = ObjSfmPosStrategyMgr.GetPositioningStrategyParams("CATSfmPosOffsetOffset")


Dim StdOpening As SfmStandardOpening

Dim URefListint As SfmReferences
Set URefListint = Factory.SfmReferences

For nUrefCnt = 1 To NbofURef
     URefListint.Add UrefList.Item(nUrefCnt)
     PositionStrategyParms.SetPosParamData "CATSfmPosOffsetOffset", 20, URefListint, 1, VrefList, 2
     Set StdOpening = Factory.CreateStandardOpening("FunctionalOpening", "Sfm_Rect", oListCkeParms, "CATSfmPosOffsetOffset", PositionStrategyParms, plateref)
     URefListint.ClearList
     Part1.Update
     
Next

Edit Contour Parameters and Redefine Them

  1. StdOpening in the last step will have information related to last standard opening created.
  2. On this last opening, use method “GetContour” to get the Contour Parameter name and it’s corresponding value.
  3. Run a for loop, and modify the corresponding contour parameters.
  4. In this case, we have set “sfm_Rect” as contour, which has three parameters. The FOR loop will run for three times and will now take new values, that are set.
Dim GetName As String
Dim GetParam As SfmStandardContourParameters

‘Use GetContour Method on stdOpening to get Contour Params for last Opening
StdOpening.GetContour GetName, GetParam

Dim Nb As Long
Nb = GetParam.Count

Dim ParamName1 As String
Dim ParamValue1 As Parameter


For i = 1 To Nb
Set ParamValue1 = GetParam.Item(i)
ParamName1 = ParamValue1.Name


If ParamName1 = "Sfm_Width" Then
    ParamValue1.ValuateFromString ("1000mm")
    End If
  If ParamName1 = "Sfm_Height" Then
    ParamValue1.ValuateFromString ("1000mm")
     End If
  If ParamName1 = "Sfm_CornerRadius" Then
    ParamValue1.ValuateFromString ("25mm")
     End If
 Next

Edit Position Parameter Data

  1. StdOpening will have information related to last standard opening created.
  2. On this last opening, use method “GetPositioningStrategy” to get the StrategyName and StrategyParms.
  3. Create an intermediate list for URefListint1.
  4. Add to this list new cross plane CROSS.70, which will replace CROSS.40.
  5. Set the “SetPosParamData” on StarategyParams with new URef, modified angle, U offset and V offset values. Re-Generate the Standard Opening.
Dim pName As String
Dim pStrategyParams As SfmStandardPosStrategyParameters

‘Get the Current Strategy Name and StrategyParams using GetPositioningStrategy
StdOpening.GetPositioningStrategy pName, pStrategyParams

Dim UrefNew As Reference
Set UrefNew = Part1.FindObjectByName("CROSS.70")

Dim URefListint1 As SfmReferences
Set URefListint1 = Factory.SfmReferences
URefListint1.Add UrefNew 

pStrategyParams.SetPosParamData "CATSfmPosOffsetOffset", 40, URefListint1, 25, VrefList, 30

StdOpening.SetPositioningStrategy pName, pStrategyParams

part1.Update
  End Icon

[Top]


In Short

This use case has shown how to edit standard openings.

[Top]


References

[1] Replaying a Macro
[Top]

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