NaWin55
Mechanical
- Mar 21, 2020
- 98
hi Everyone
i want to select and change the radius or length or angle of any feature(hybridshape Especially)
i crated this code but i can only change parameters of hybridshpaes that are from specific geosets not from any geosets
here is the code
Private Sub SelectFeature_Click()
On Error Resume Next
Set oSelFeature = CATIA.ActiveDocument.Selection
oSelFeature.Clear
Dim featureFilter(0) As Variant
featureFilter(0) = "AnyObject"
Dim featureStatus As String
featureStatus = oSelFeature.SelectElement2(featureFilter, "Select Anyobject", False)
If (featureStatus = "Cancel") Then
MsgBox "User cancelled"
Else
CATIA.StartCommand "Formula"
Set hybBody1 = hybBodys.Item("UDU_Selected Direction_3mm_Dia")
Set hybShapes = hybBody1.HybridShapes
Set hybCylinder = hybShapes.Item(oSelFeature.Item(1).Value.Name)
End If
If (featureStatus = "Cancel") Then
MsgBox "User cancelled"
Else
Set hybBody2 = hybBodys.Item("UDU_Normal to Surface_3mm_Dia")
Set hybShapes2 = hybBody2.HybridShapes
Set hybCylinder = hybShapes2.Item(oSelFeature.Item(1).Value.Name)
End If
End Sub
Private Sub UpdateBtn_Click()
Dim radius As Length
Set radius = hybCylinder.radius
hybCylinder.radius.Value = CylinderDia.Value
Set oSelFeature = CATIA.ActiveDocument.Selection
opart.Update
End Sub
Private Sub delet_Click()
oSelFeature.Delete
End Sub
In above u can see 4 geo sets are there
i can only change parameters of hybridshapes that are in "UDU_Normal to Surface_3mm_Dia" and "UDU_Selected Direction_3mm_Dia" but not from "UDU_Angled Surface_3mm_Dia"
here is the user from i created
when i select cylinder from any geoset i should be able to change its dia
but i cant find logic for this
i need help
thanks
i want to select and change the radius or length or angle of any feature(hybridshape Especially)
i crated this code but i can only change parameters of hybridshpaes that are from specific geosets not from any geosets
here is the code
Private Sub SelectFeature_Click()
On Error Resume Next
Set oSelFeature = CATIA.ActiveDocument.Selection
oSelFeature.Clear
Dim featureFilter(0) As Variant
featureFilter(0) = "AnyObject"
Dim featureStatus As String
featureStatus = oSelFeature.SelectElement2(featureFilter, "Select Anyobject", False)
If (featureStatus = "Cancel") Then
MsgBox "User cancelled"
Else
CATIA.StartCommand "Formula"
Set hybBody1 = hybBodys.Item("UDU_Selected Direction_3mm_Dia")
Set hybShapes = hybBody1.HybridShapes
Set hybCylinder = hybShapes.Item(oSelFeature.Item(1).Value.Name)
End If
If (featureStatus = "Cancel") Then
MsgBox "User cancelled"
Else
Set hybBody2 = hybBodys.Item("UDU_Normal to Surface_3mm_Dia")
Set hybShapes2 = hybBody2.HybridShapes
Set hybCylinder = hybShapes2.Item(oSelFeature.Item(1).Value.Name)
End If
End Sub
Private Sub UpdateBtn_Click()
Dim radius As Length
Set radius = hybCylinder.radius
hybCylinder.radius.Value = CylinderDia.Value
Set oSelFeature = CATIA.ActiveDocument.Selection
opart.Update
End Sub
Private Sub delet_Click()
oSelFeature.Delete
End Sub

In above u can see 4 geo sets are there
i can only change parameters of hybridshapes that are in "UDU_Normal to Surface_3mm_Dia" and "UDU_Selected Direction_3mm_Dia" but not from "UDU_Angled Surface_3mm_Dia"
here is the user from i created
when i select cylinder from any geoset i should be able to change its dia

but i cant find logic for this
i need help
thanks