×
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

Catia VBA multi-fillet?

Catia VBA multi-fillet?

Catia VBA multi-fillet?

(OP)

Hi everyone,

First of all, before anyone replies to this message: Thanks eng-tips! I've learned so much just by browsing through the existing forums. So many talented and generous people around here.

Here's what I'm trying to do.

I have a skin in CATIA that is like a saw-tooth kind of thing.

This skin is composed of about 3000 faces, all of them connected.

I'm trying to apply a fillet on all the top intersecting edges of a user value, and a different fillet on the bottom intersecting edges with another user input value.

Radius is the same for all top edges, and the same for all bottom edges.

I can't for the life of me find a VBA or CATScript way of selecting internal edges, putting them into an array and loop through.

I can for example search and select all edges on a solid and apply a fillet or chamfer via VBA.

Is it even possible to select only the internal edges ?

Any ideas?

RE: Catia VBA multi-fillet?

(OP)
Thats actually a prettty good idea.

So basically I would create a collection with said surfaces using a loop with a step 2 . Within that loop I could do the fillets, then come back, and with another loop do fillet1 + surface5 - apply second fillet - fillet2 + surface8 and so on.

Then third loop, do fillets with the fillets created, join, save.

Something along these lines? Feel free to suggest another approach, as your scripting knowledge is waaaaaaaay more advanced than mine.

RE: Catia VBA multi-fillet?

Don't be so sure about my scripting knowledge, I'm not a professional programmer, I just like to learn more about this subject.

For the time being I don't have another idea, I don't know how was created your geometry, another idea would be maybe you can check if some vertex has same coordinates and get their parents and fillet them?

Or if those lower edges are all of them co-planar...find a way to color them and select them in one shot by color....

I suppose in all cases it would be a long run...

Regards
Fernando

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

RE: Catia VBA multi-fillet?

(OP)

Here's what i came up with:

Waddaya think?

CODE --> CatVBA

Sub CATMain() 

CATIA.ActiveDocument.selection.Clear 


Dim PartDocumentDest As PartDocument 
Set PartDocumentDest = CATIA.ActiveDocument 
Dim PartDest As Part 
Set PartDest = PartDocumentDest.Part 

Dim hybridShapeFactory1 As HybridShapeFactory 
Set hybridShapeFactory1 = PartDest.HybridShapeFactory 

Set hybridBodies_srf = PartDest.HybridBodies 

Set hybridBody_srf = hybridBodies_srf.Add() 

hybridBody_srf.Name = "Fillet_Result" 

BottomRadius = InputBox("Enter Bottom radius", "Enter radius value in mm", 1) 
TopRadius = InputBox("Enter top radius", "Enter radius value in mm", 1) 


'Collect Input_1 

Dim vntTypes2(0) As Variant 
vntTypes2(0) = "BiDim" 


Set catSelectLine1 = CATIA.ActiveDocument.selection 

    catSelectLine1.Clear 

    
Dim strSelectedItem As String 
strSelectedItem = catSelectLine1.SelectElement3(vntTypes2, "Select surfaces.", False, CATMultiSelTriggWhenUserValidatesSelection, False) 

'strSelectedItem = catSelectLine1.Search "('Generative Shape Design'.Surface & Color='Dark Green'),scr" 

If (strSelectedItem = "Cancel") Then 
End 
Else 
            
Dim Line_Coll As New Collection 
        For sCount = 1 To catSelectLine1.Count 
        Line_Coll.Add catSelectLine1.selection.Item(sCount).Value 
        Next 
        
End If 




    
'Loop Bottom Fillet: 

For iInput = 1 To Line_Coll.Count 

Dim ref1 As Object 
Set ref1 = catSelectLine1.Item(iInput).Value 

Dim ref2 As Object 
Set ref2 = catSelectLine1.Item(iInput + 1).Value 


Set rf1 = PartDest.CreateReferenceFromObject(ref1) 
Set rf2 = PartDest.CreateReferenceFromObject(ref2) 

Dim hybridShapeFilletBiTangent1 As HybridShapeFilletBiTangent 
Set hybridShapeFilletBiTangent1 = hybridShapeFactory1.AddNewFilletBiTangent(rf1, rf2, BottomRadius, 1, 1, 1, 0) 

hybridShapeFactory1.GSMVisibility rf1, 0 

hybridShapeFactory1.GSMVisibility rf2, 0 

hybridBody_srf.AppendHybridShape hybridShapeFilletBiTangent1 

hybridShapeFilletBiTangent1.Name = "Fillet_1" 


iInput = iInput + 1 

Set rffil = PartDest.CreateReferenceFromObject(hybridShapeFilletBiTangent1) 
hybridShapeFactory1.GSMVisibility rffil, 0 

Next 


PartDest.Update 
    
    Dim catSelectsurf As selection 
    Set catSelectsurf = PartDocumentDest.selection 
    catSelectsurf.Search "Name=Fillet_1,all" 
    
    
        Dim FillColl As New Collection 
        For sCount2 = 1 To catSelectsurf.Count 
        FillColl.Add catSelectsurf.selection.Item(sCount2).Value 
        Next 
        
        
'Invert Surfaces 


For iAxis = 1 To FillColl.Count 


Set refInv = PartDest.CreateReferenceFromObject(FillColl.Item(iAxis)) 

Set hybridShapeAxisToAxis1 = hybridShapeFactory1.AddNewInverse(refInv, -1) 

hybridBody_srf.AppendHybridShape hybridShapeAxisToAxis1 

PartDest.InWorkObject = hybridShapeAxisToAxis1 

hybridShapeAxisToAxis1.Name = "Inverse_2" 


Next 



PartDest.Update 






        Dim catSelectsurf2 As selection 
        Set catSelectsurf2 = PartDocumentDest.selection 
        catSelectsurf2.Search "Name=Inverse_2,all" 
    
    
        Dim FillColl2 As New Collection 
        For sCount3 = 1 To catSelectsurf2.Count 
        FillColl2.Add catSelectsurf2.selection.Item(sCount3).Value 
        Next 
        
        
'Loop Top Fillet: 


Dim ref3 As Object 
Set ref3 = catSelectsurf2.Item(1).Value 
        
        
On Error Resume Next 
        
For iInput2 = 1 To FillColl2.Count - 1 



Dim ref4 As Object 
Set ref4 = catSelectsurf2.Item(iInput2 + 1).Value 


Set rf3 = PartDest.CreateReferenceFromObject(ref3) 
Set rf4 = PartDest.CreateReferenceFromObject(ref4) 

Dim hybridShapeFilletBiTangent2 As HybridShapeFilletBiTangent 
Set hybridShapeFilletBiTangent2 = hybridShapeFactory1.AddNewFilletBiTangent(rf3, rf4, TopRadius, 1, 1, 1, 0) 

hybridShapeFactory1.GSMVisibility rf3, 0 

hybridShapeFactory1.GSMVisibility rf4, 0 

hybridBody_srf.AppendHybridShape hybridShapeFilletBiTangent2 

Set ref3 = hybridShapeFilletBiTangent2 

Next 

CATIA.ActiveDocument.selection.Clear 
PartDest.Update 

End sub 

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