0% found this document useful (0 votes)
52 views3 pages

Sub CATMain

The document contains VBA code to loop through nodes of a CATIA product structure, retrieve part documents, and select faces of different colors for further processing. It loops through each node, checks if it is a product or part, retrieves the part document if it's a part, and selects thread faces colored yellow, dowel faces colored blue, and free hole faces colored cyan for additional operations.

Uploaded by

Roysten Dsilva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views3 pages

Sub CATMain

The document contains VBA code to loop through nodes of a CATIA product structure, retrieve part documents, and select faces of different colors for further processing. It loops through each node, checks if it is a product or part, retrieves the part document if it's a part, and selects thread faces colored yellow, dowel faces colored blue, and free hole faces colored cyan for additional operations.

Uploaded by

Roysten Dsilva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Sub CATMain()

GetNextNode CATIA.ActiveDocument.Product

End Sub

Sub GetNextNode(oCurrentProduct As Product)

Dim oCurrentTreeNode As Product

Dim I As Integer

Pt = 0

vt = 1

' Loop through every tree node for the current product

For q = 1 To oCurrentProduct.Products.Count

dbc = 0

Set oCurrentTreeNode = oCurrentProduct.Products.Item(q)

If IsProduct(oCurrentTreeNode) = True Then

If oCurrentTreeNode.Products.Count > 0 Then

GetNextNode oCurrentTreeNode

End If

End If

If IsPart(oCurrentTreeNode) = True Then

Dim iname As String

iname = oCurrentProduct.Products.Item(q).Name

'oCurrentProduct.Products.Item (i)

Dim oSelection

Dim documents1 As Documents

Set documents1 = CATIA.Documents


Set partDocument1 = CATIA.Documents.Item(oCurrentProduct.Products.Item(q).PartNumber &
".CATPart")

Dim Measurecircle

Dim ARadius As Double

Dim ARadius1 As Double

Dim ARadius2 As Double

Dim part1 As Part

Set part1 = partDocument1.Part

Dim hybridShapeFactory1 As HybridShapeFactory

Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim bodies1 As Bodies

Set bodies1 = part1.Bodies

Dim body1 As Body

Set body1 = bodies1.Item(1)

Dim hybridBodies1 As HybridBodies

Set hybridBodies1 = part1.HybridBodies

Dim hybridBody1 As HybridBody

Set hybridBody1 = hybridBodies1.Add()

hybridBody1.Name = "Extract features"

part1.Update

pname = partDocument1.Product.PartNumber
Set osel = CATIA.ActiveDocument.Selection

osel.Add oCurrentProduct.Products.Item(q)

Set oSelection = CATIA.ActiveDocument.Selection

Set oselection1 = CATIA.ActiveDocument.Selection

Set Oselection2 = CATIA.ActiveDocument.Selection

Set Oselection3 = CATIA.ActiveDocument.Selection

Set oselection4 = CATIA.ActiveDocument.Selection

Set Oselection5 = CATIA.ActiveDocument.Selection

'search thread faces which is yellow in color

Oselection2.Search "Topology.Face.Color='(255,255,0)',sel"

For I = 1 To Oselection2.Count

Dim threadfaces As New Collection

threadfaces.Add Oselection2.Item2(I).Reference

Next

'search dowel faces which is blue in color

osel.Add oCurrentProduct.Products.Item(q)

Oselection3.Search "Topology.Face.Color='(0,0,255)',sel"

For I = 1 To Oselection3.Count

Dim dowelfaces As New Collection

dowelfaces.Add Oselection3.Item2(I).Reference

Next

'search free hole faces which is cyan in color

osel.Add oCurrentProduct.Products.Item(q)

Oselection5.Search "Topology.Face.Color='(0,175,175)',sel"

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy