Dialga1
Mechanical
- Jan 1, 2023
- 15
Anyone can try my code on catia for me?
And I can excapt any help for my code
And I can excapt any help for my code
Code:
Sub TransparentizeComponents()
Dim productDocument As ProductDocument
Set productDocument = CATIA.ActiveDocument
If Not productDocument Is Nothing Then
Dim product As Product
Set product = productDocument.Product
Dim selection As Selection
Set selection = productDocument.Selection
selection.Clear
' Delikleri işaretlemek için filtre tanımlanır
Dim filter As String
filter = "CATDrillingOperation"
selection.Search "CATIAFiltersOnly=" & filter, False, False
Dim drillingOp As DrillHole
For Each drillingOp In selection
Dim hole As Hole
Set hole = drillingOp.ReferenceProduct
If Not hole Is Nothing Then
If hole.Type = catCounterboredHole Then
' Counterbored delikler mavi renkte olacak ve şeffaf olmayacak
hole.Color = RGB(0, 0, 255)
hole.SetRenderStyle "catRealistic"
Else
' Diğer delikler sarı renkte olacak
hole.Color = RGB(255, 255, 0)
End If
End If
Next drillingOp
' Diğer bileşenleri şeffaf hale getirir
Dim productComponents As Products
Set productComponents = product.Products
Dim component As Product
For Each component In productComponents
If TypeName(component) <> "Hole" Then
component.SetRenderStyle "catRealisticWithTransparency"
component.Transparency = 50 ' Şeffaflık değeri (0 - 100 arasında ayarlanabilir)
End If
Next component
CATIA.RefreshDisplay = True
Else
MsgBox "Aktif bir CATIA ürün belgesi bulunamadı!", vbExclamation
End If
End Sub