Structure Detail Design |
Creating Standard Openings |
|
|
This macro shows you how to create standard
openings on an SDD Plate. Here we will use “Rect” profile and MidDist-MidDist
Strategy.
|
|
|
CAASddMidDist_MidDist
is launched in CATIA [1]. Some documents are needed.
|
|
|
CAASddCreateOpening includes five steps:
PrologThe 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 ReferencesUse 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
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:
|
|
|
[Top]
This use case has shown how to create standard openings using the MidDist-MidDist strategy.
[Top]
| [1] | Replaying a Macro |
| [Top] | |
Copyright © 2010, Dassault Systèmes. All rights reserved.