Macro to obtain the limit planes of a pad
Macro to obtain the limit planes of a pad
(OP)
I'm trying to find the limit planes of a pad by a macro.

In this case by selec the pad, I want that my macro gives me that the limites are Plane.1 and Plane.2

In this case by selec the pad, I want that my macro gives me that the limites are Plane.1 and Plane.2
Tiago Figueiredo
Tooling Engineer





RE: Macro to obtain the limit planes of a pad
CODE --> CATScript
Sub CATMain() Dim varSelection As Variant Set varSelection = CATIA.ActiveDocument.Selection Dim InputFilter(0) As Variant InputFilter(0) = "Pad" Dim SelStatus As String SelStatus = varSelection.SelectElement2(InputFilter, "Select Pad object", True) Dim objPad As Pad Dim objFirstLimit As Limit Dim dblFirstLimit As Double If (SelStatus = "Normal") Then Set objPad = varSelection.Item2(1).Value Set objFirstLimit = objPad.FirstLimit dblFirstLimit = objFirstLimit.Dimension.Value MsgBox "First limit length: " & CStr(dblFirstLimit) End If End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Macro to obtain the limit planes of a pad
I've made a change to this, to obtain the plane name, and it worked like a rocket
CODE --> CATScript
Sub CATMain() Dim varSelection As Variant Set varSelection = CATIA.ActiveDocument.Selection Dim InputFilter(0) As Variant InputFilter(0) = "Pad" Dim SelStatus As String SelStatus = varSelection.SelectElement2(InputFilter, "Select Pad object", True) Dim objPad As Pad Dim objFirstLimit As Limit Dim dblFirstLimit As String If (SelStatus = "Normal") Then Set objPad = varSelection.Item2(1).Value Set objFirstLimit = objPad.FirstLimit dblFirstLimit = objFirstLimit.LimitingElement.DisplayName MsgBox "First limiting element is: " & dblFirstLimit End If End SubTiago Figueiredo
Tooling Engineer
RE: Macro to obtain the limit planes of a pad
Tiago Figueiredo
Tooling Engineer
RE: Macro to obtain the limit planes of a pad
--Doug
RE: Macro to obtain the limit planes of a pad
Tiago Figueiredo
Tooling Engineer
RE: Macro to obtain the limit planes of a pad
can you explain what you looking for?
indocti discant et ament meminisse periti
RE: Macro to obtain the limit planes of a pad
Tiago Figueiredo
Tooling Engineer
RE: Macro to obtain the limit planes of a pad
What about using the DisplayName property of the Reference object you are retrieving from the Pad feature? You could then use the Selection object's Search function to retrieve the object by it's name and object type. This method wouldn't be bullet proof but should handle most situations well. Once you retrieve the HybridShapePlaneOffset object from the previous step, you can get it's planar reference with the Plane property and use the DisplayName property as you did with the Pad's limit.
--Doug
RE: Macro to obtain the limit planes of a pad
"Once you retrieve the HybridShapePlaneOffset object from the previous step, you can get it's planar reference with the Plane property and use the DisplayName property as you did with the Pad's limit."
With pad it was simple to found the reference plane. But with the offset plane, i haven't found it.
Tiago Figueiredo
Tooling Engineer