Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Select Hybridshape regardless of geoSet

Status
Not open for further replies.

NaWin55

Mechanical
Mar 21, 2020
97
0
0
IN
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

select_cylinder_ugzvi2.jpg


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
form_jp77w1.jpg


but i cant find logic for this

i need help
thanks
 
Replies continue below

Recommended for you

remove the line that lets errors pass by... then you will be able to see what it is wrong
i.e 'On Error Resume Next

regards,
LWolf
 
this is the error

Error_rscbej.jpg


because the cylinder hybridshape that i selected is in diffrent geoset not the geoset that is in scrip

as you can see in code "UDU_Angled Surface_3mm_Dia"

is not present so

there sre many geosets are there but i cant code to individual geoset
i need a logic that i am not able write
what is the solution for this
 
you need to find the set from the selection provided.
basically, set define_in_work on the selected feature... that will put define in work on the geometrical set.

regards,
LWolf
 
Dim oHybridBody As HybridBody
part1.InWorkObject = oSelFeature.Item(1).Value
Set oHybridBody = part1.InWorkObject

regards,
LWolf
 
Status
Not open for further replies.
Back
Top