Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have this code that sets a color to a hole in a sketch, if the hole is 2, 3 or 4 mm in diameter.
What i would want to do is to check if the hole is made with H7 tolerance, and give it a color if it is, and do not give it color if it is not.
Is there a way to check hole tolerance?
I have tried something like this:
dim a as string = oHole.HoleDiameter.Tolerance
if a = "H7"
//give color//
end if
But i cant get it to work and oHole.HoleDiameter.Tolerance returns nothing.
Is there a way to make it work?
Right now i use the code below:
Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Wybierz rzut")
Dim oTO As TransientObjects = ThisApplication.TransientObjects
For Each oCurve As DrawingCurve In oView.DrawingCurves
Try
Dim oEdge As Edge = oCurve.ModelGeometry
For Each oFace As Face In oEdge.Faces
If oFace.CreatedByFeature.Type = ObjectTypeEnum.kHoleFeatureObject
Dim oHole As HoleFeature = oFace.CreatedByFeature
Select Case oHole.HoleDiameter.Expression
Case "2 mm"
oCurve.Color = oTO.CreateColor(0, 255, 0)
Case "3 mm"
oCurve.Color = oTO.CreateColor(0, 0, 255)
Case "4 mm"
oCurve.Color = oTO.CreateColor(255, 0, 0)
End Select
End If
Next
Catch
End Try
Next
Solved! Go to Solution.