Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
[Edit]
I've found a workaround using the Coordinate system and origin of the surface instead of working with Axis.
[Original message]----------------------------------------------------------------
Hello everyone!
I'm working on a project for automated model comparison and I am currently stuck. I am trying to find the central axis of cylindrical and conic surfaces but my code is not working properly. I would be very grateful if someone can help me solve my issue.
First things first, I am using wildfire 4.0 and this is my first time coding in VBA so there might be stupid mistakes.
I am using the following code:
_______________________________
For Each Axis In AllAxis_
On Error Resume Next
For Each axis_surf In Axis.Surf.ListSameSurfaces
If Not Err.Number = 0 Then
GoTo forend 'This is to prevent the code to crash when the axis has no linked surface
End If
If axis_surf.ID = surface.ID Then
SurfTable_(i).CentralAxis = Axis
FoundFlag = True
Exit For
End If
Next
'End If
If FoundFlag Then
FoundCount += 1
Sel.CreateModelItemSelection(surface, Nothing).Highlight(2) 'Highlight in white if surface axis is found
Exit For
End If
forend:
Next
If Not FoundFlag Then
NotFoundCount += 1
Sel.CreateModelItemSelection(surface, Nothing).Highlight(1) 'highlight in red if surface axis is not found
End If
_______________________________
I am testing my code on two different model. On one of them, all the central axis are found as expected and on the second one, a few axis are not found.
After comparing the surfaces whose axis was not found with the other one. I noticed they were modeled using the revolve tool and an external sketch while the surfaces that were modeled with internal sketch were not problematic. But, after redefining the problematic surfaces the central axis would still not be detected.
Another strange issue is that if I search for the central axis of all the cylindrical and conic surfaces instead of just the one I am interested in, my code will find some axis he did not find previously but there is still some axis missing.
I would really appreciate if someone can help me with this. I have been stuck on this for a while now.
Jonas