cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Finding central axis of surface using VB API

ptc-6493023
1-Newbie

Finding central axis of surface using VB API

[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


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
0 REPLIES 0
Top Tags