Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations pierreick on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia V5 MBD - Selecting Large Number of Same Size Holes

Status
Not open for further replies.

mwessel

Mechanical
Aug 29, 2006
12
I am working solid models in Catia V5, which will be dimensioned by Model Based Definition (MBD). In the “Functional Tolerancing and Annotation” function of Catia, I’ll select all holes of the size to be dimensioned to highlight when dimension is selected. No problem when a few holes. I have a part now with seriously 200 same size holes. Any ideas for selecting the faces? To manually add each face to the associated faces connected to the dimension obviously takes a long time. I tried the search and select faces, but can’t find a way to use it while associating it to the dimension. I tried creating a “selection set”, but can’t seem to use it in associating the faces. Any ideas?
 
Replies continue below

Recommended for you

hi mwessel. I'd start by performing a search for "faces" in the model: "Topology.Face;all"
this will yield waaaay too many hits, but now within this try to find the ones with "hole" within the name.
here is a working code (provided you already have a pmi-view defined) that creates a dimension between two reference surfaces, see if something similar could be used to attach additional surfaces to the existing Hole-SurfaceNode...
Code:
Sub catmain()
Dim oSel
Set oSel = CATIA.ActiveDocument.Selection
Dim part1 As part
Set part1 = CATIA.ActiveDocument.part

Dim ref1 As Reference
Set ref1 = oSel.item(1).Value
Dim ref2 As Reference
Set ref2 = oSel.item(2).Value
Set userSurfaces1 = part1.UserSurfaces
Set userSurface1 = userSurfaces1.Generate(ref1)
Set userSurface2 = userSurfaces1.Generate(ref2)
Set userSurfComboNode = userSurfaces1.MakeUserSurfaceNode(userSurface1, userSurface2)
Set annotationSet1 = part1.AnnotationSets.item(1)
Set AnnotationFactory = annotationSet1.AnnotationFactory
Set PMI = AnnotationFactory.CreateNonSemanticDimension(userSurfComboNode, 5, 0)
oSel.Clear
oSel.Add (PMI)
CATIA.StartCommand ("Force Horizontal Dimension in View")
End Sub

regards,
LWolf
 
Along those lines...
from all the B-rep references I am checking for those having a "Hole" reference in the first part of the name.
And then create a NonSemanticDimension on the UserSurface Combo Node, [where (1,1) references to Diameter--check the documentation]
Code:
Option Explicit

Sub CATMain()
Dim oSel, i
Set oSel = CATIA.ActiveDocument.Selection
Dim part1 As part
Set part1 = CATIA.ActiveDocument.part

Dim selString: selString = "Topology.Face;all"
oSel.Search selString

Dim userSurfaces1
Set userSurfaces1 = part1.UserSurfaces
Dim ref1 As Reference
Dim userSurface1 As UserSurface
ReDim arrayofsurf(0)
For i = 1 To oSel.Count
    Set ref1 = oSel.item(i).Value
    If InStr(Split(ref1.name, ";")(0), "Hole") > 0 Then
        Set userSurface1 = userSurfaces1.Generate(ref1)
        Set arrayofsurf(UBound(arrayofsurf)) = userSurface1
        ReDim Preserve arrayofsurf(UBound(arrayofsurf) + 1)
    End If
Next
Dim userSurfComboNode, annotationSet1, AnnotationFactory, PMI
Set userSurfComboNode = userSurfaces1.MakeUserSurfaceNode2(arrayofsurf)
Set annotationSet1 = part1.AnnotationSets.item(1)
Set AnnotationFactory = annotationSet1.AnnotationFactory
Set PMI = AnnotationFactory.CreateNonSemanticDimension(userSurfComboNode, 1, 1)

oSel.Clear
oSel.Add (PMI)
CATIA.StartCommand ("Force Horizontal Dimension in View")
End Sub

regards,
LWolf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor