×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SW API vertex coordinates (GetPoint)

SW API vertex coordinates (GetPoint)

SW API vertex coordinates (GetPoint)

(OP)
The below code finds all visible edges in a specified drawing view. From those edges, it determines start and end points and attepts to get the xyz coordinated of those points. It does not appear to be getting the correct coordinates b/c it fails on vertex reselection.

My goal is to collect coordinate data in an array which will be used to determine top, bottom, left, and right verticies on which dimensions will be placed (overall dimensions).

Any ideas why this is not pulling the correct coordinates?




'Get all visible components
vComps = swView.GetVisibleComponents
 
'Print name of first visible component
Debug.Print vComps(0).Name2
 
For comp = 0 To UBound(vComps)

    ' Get all edges on the first visible component
    vEdges = swView.GetVisibleEntities(vComps(comp), swViewEntityType_Edge)

        'Iterate through and select all edges on the first visible component
        Set swSelData = swSelMgr.CreateSelectData
        swSelData.View = swView
        
        For itr = 0 To UBound(vEdges)
        
            Set swEnt = vEdges(itr)
        
            'boolstatus = swEnt.Select4(True, swSelData)
            
            ' Get and select the "Start" vertex
            Set startVertexObj = swEnt.GetStartVertex
            boolstatus = startVertexObj.Select4(True, swSelData)
            
            ' Get xyz corrdinates of selected "Start" vertex
            startPt = startVertexObj.GetPoint
            
            ' Get and select the "End" vertex
            Set endVertexObj = swEnt.GetEndVertex
            boolstatus = endVertexObj.Select4(True, swSelData)
            
            ' Get xyz corrdinates of selected "End" vertex
            endPt = endVertexObj.GetPoint
            
            swModel.ClearSelection2 True
            
            ' Reselect "Start" and "End" verticies using coordinates
            boolstatus = swModel.Extension.SelectByID2("", "VERTEX", startPt(0), startPt(1), startPt(2), False, 0, Nothing, 0)
            boolstatus = swModel.Extension.SelectByID2("", "VERTEX", endPt(0), endPt(1), endPt(2), True, 0, Nothing, 0)
            
            ' Place dimension
            Dim Annotation As Object
            Set Annotation = swModel.AddDimension2(0.340726, 0.157093, -0.03995)
            
        Next itr
Next comp

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources