Structure Detail Design

Creating Standard Openings


Target Icon This macro shows you how to create standard openings on an SDD Plate. Here we will use “Rect” profile and MidDist-MidDist Strategy.

Starting Part

Information Icon CAASddMidDist_MidDist is launched in CATIA [1]. Some documents are needed.
  • CAASddMidDist_MidDist.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 contains data required for the macro.
  • The CATPart containing the section is located in the samples directory.
CAASddCreateOpening includes five steps:
  1. Prolog
  2. Get the Factory and Two Managers( Contour Manager and Position Strategy Manager)
  3. Select the Contour and Set Contour Parameters
  4. Define the Position Strategy and Prepare Lists for U References and V References
  5. Create Standard Opening by Setting PositionStrategyParms

Prolog

The macro first loads CAASCH_Detail01.CATProduct that contains three schematic component symbols.

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

Get the Factory and Two Managers (Contour Manager and Position Strategy Manager)

First retrieve the Factor from the part. Then retrieve the SfmOpeningContoursMgr and SfmPositioningStrategyManager.

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")

Select the Contour and Set Contour Parameters

'Define the Contour
 Dim oListContourNames() As Variant
 ObjSfmContourMgr.GetAvailableStdOpeningContours oListContourNames

 Dim NbOfContour As Long
 NbOfContour = UBound(oListContourNames)

'Display List of contours
 For i = 0 To NbOfContour
 MsgBox oListContourNames(i)
 Next

 'Set the Required Contour and Set its Contour Parameters
 Dim oListCkeParms As SfmStandardContourParameters
 Set oListCkeParms = ObjSfmContourMgr.GetStdOpeningContourParams("Sfm_Rect")

 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
  'MsgBox ContourParamName

  If ContourParamName = "Sfm_Width" Then
    ContourParam.ValuateFromString ("1000mm")
  End If
  If ContourParamName = "Sfm_Height" Then
    ContourParam.ValuateFromString ("2000mm")
  End If
  If ContourParamName = "Sfm_CornerRadius" Then
    ContourParam.ValuateFromString ("10mm")
   End If
 Next

Define the Position Strategy and Prepare lists for U References and V References

Use ObjSfmPosStrategyMgr to GetPositioningStrategyParams.

Since MidDist-MidDist strategy is selected, you need to prepare List of U References and V References. Both these lists will contain even number of reference Planes

'Define the Position Strategy
Dim PositionStrategyParms As SfmStandardPosStrategyParameters
Set PositionStrategyParms = ObjSfmPosStrategyMgr.GetPositioningStrategyParams("CATSfmPosMidDistMidDist")

'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 Vref2 = Part1.FindObjectByName("LONG.10")
 Set VrefList = Factory.SfmReferences
 VrefList.Add Vref1
 VrefList.Add Vref2
 
 Dim NbofURef As Long
 NbofURef = UrefList.Count
 
 Dim NbofVRef As Long
 NbofVRef = VrefList.Count

Create Standard Opening by setting PositionStrategyParms

  1. An intermediate list for U references is created (URefListint).
  2. Inside the For loop, this intermediate list will hold first two U references. The For loop moves in step of 2.
  3. SetPosParamData Method is called on PositonStrategyParams to set the data.
  4. Create Standard Opening by defining required parameters. It is called on Factory.
  5. Clear the current intermediate list. It will be populated again with next two elements in next loop.
Dim StdOpening As SfmStandardOpening
Dim URefListint As SfmReferences
Set URefListint = Factory.SfmReferences

For nUrefCnt = 1 To NbofURef Step 2
    If (nUrefCnt + 1) $lt;= NbofURef Then
       URefListint.Add UrefList.Item (nUrefCnt)
       URefListint.Add UrefList.Item (nUrefCnt + 1)
       PositionStrategyParms.SetPosParamData "CATSfmPosMidDistMidDist", 20, URefListint, 1, VrefList, 2
       Set StdOpening = Factory.CreateStandardOpening ("FunctionalOpening", "Sfm_Rect", oListCkeParms,     "CATSfmPosMidDistMidDist", PositionStrategyParms, plateref)
     URefListint.ClearList
  End If
Next

Part1.Update

Note: Scripts for creation of Standard Openings using other positioning Strategies are also provided:

  • CAASddHalfHeight_MidDist.CATScript
  • CAASddHalfHeight_Offset.CATScript
  • CAASddMidDist_Offset.CATScript
  • CAASddOffset_Offset.CATScript
  End Icon

[Top]


In Short

This use case has shown how to create standard openings using the MidDist-MidDist strategy.

[Top]


References

[1] Replaying a Macro
[Top]

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