×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro to obtain the limit planes of a pad
2

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

Tiago Figueiredo
Tooling Engineer

RE: Macro to obtain the limit planes of a pad

2
Hi

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 Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Macro to obtain the limit planes of a pad

(OP)
Thanks Ferdo,

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 Sub 

Tiago Figueiredo
Tooling Engineer

RE: Macro to obtain the limit planes of a pad

(OP)
And if i want to know which plane, is a reference of an offset plane?

Tiago Figueiredo
Tooling Engineer

RE: Macro to obtain the limit planes of a pad

I would encourage you to record a macro of changing the reference of an existing feature in a CATPart. That should get you a long way towards your end goal. Reference elements(points/lines/planes) along with wire frame and surface features are recorded better than most other features. Generally you will get 80-90% of the code you require just by recording these activities. The Help Docs and/or V5Automation.chm in the CATIA installation path will also help to determine which properties and methods to use when attempting to access certain data within a CATIA model.

--Doug

RE: Macro to obtain the limit planes of a pad

(OP)
you are right, but I've already that planes drawn in my part. But I want to know which plane is the reference of my offset plane. I only have found how to create it, not how to see which is its reference.

Tiago Figueiredo
Tooling Engineer

RE: Macro to obtain the limit planes of a pad

Quote (you)

And if i want to know which plane, is a reference of an offset plane?

can you explain what you looking for?

Eric N.
indocti discant et ament meminisse periti

RE: Macro to obtain the limit planes of a pad

(OP)
When i select plane.2, I whant that macro tells me that the reference plane is plane.1

Tiago Figueiredo
Tooling Engineer

RE: Macro to obtain the limit planes of a pad

My mistake, I completely misunderstood what you were asking.

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

(OP)
Can you show how? I haven't found how to do it?

"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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources