Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

XYZ point locations on a drawing 2

Status
Not open for further replies.

Jimmyv44

Automotive
May 10, 2012
10
US
Does anyone know of a company that writes GRIP programs or Journal files? My company needs a program to label XYZ point locations on a drawing. We are using the drawing for electrode locations so we also want it to label the component that the points belong to on the drawing. I know it is possible, but I'm not sure of the best way to do it. We currently copy and paste from the listing window, but it is very time consuming and errors get made too often. Any suggestions would be greatly appreciated.
 
Replies continue below

Recommended for you

Frank,
There was nothing in the .zip file. Can you please try it again? Thanks.
 
Thanks Frank. It is a good start. BTW, We are running 7.5.5.4.
I don't understand why the leader goes out in space when you place the numbers on a drawing though. I think it is something to do with the view? I think we also want to add a line for the trode name.
 
As the program stands it works as a demonstration program for the following limiting conditions.

The selected point cannot be selected using the often normally used inferred point option. This is because with the inferred method we get the drawing view and not the model view. Since we need model point data this could give us errors. It also gives us an error in terms of the label attachment point since here we need to convert the model data to drawing data since the label is placed on the drawing. If you take care to use a point selection method which ensures it is a point on the model then it should work OK.

Having said this I should have you check the nx8 version of the program which I have attached. In this case I needed to expand the drawing view to select the model point. I typically dont worry about release updates which may be part of the answer.

I dont know what "trode name" is but it would be simple to add an additional line.

Regards

Frank Swinkels
 
 http://files.engineering.com/getfile.aspx?folder=5ec7015b-a526-4638-8d7f-7112eb7249ca&file=xyzlabelsNX8.zip
Thanks Frank,
The Trode name is actually the component name. Do I need programing software to add that line? What software would I need?
 
What I meant when I said add an extra line I was referring to an extra line for the boxed label. That is the program would need to get the component name, determine a new length for the boxed label, resize the exising box and add the extra line (for the component name text). Now I think this should be done off-line. However as I understand it I cannot display my email address.

Regards

Frank Swinkels
 
Here is your program revised. It only contained one error. I also made some changes so that it reads better (I feal). I have also made a change and left the equivalent code commented out.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module pointsInfo_fbs1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim ufs As UFSession = UFSession.GetUFSession()
        Dim response2 As Selection.Response = Nothing
        Dim pnt2() As Double = {0.0, 0.0, 0.0}
        Dim selectedObjects As NXObject() = Nothing

        theSession.ListingWindow.Open()
Start1:
        response2 = selectPoints(selectedObjects)
        If response2 = Selection.Response.Cancel Then GoTo End1

        Dim info As String = "Number of selected objects = "
        info = String.Concat(info, selectedObjects.Length)
        theSession.ListingWindow.WriteLine(info)
        For Each sda As Point In selectedObjects
            theSession.ListingWindow.WriteLine("X= " & sda.Coordinates.X.ToString("N4") & _
                                               " Y= " & sda.Coordinates.Y.ToString("N4") & _
                                               " Z= " & sda.Coordinates.Z.ToString("N4"))
        Next

        'For Each sda As Point In selectedObjects
        '    ufs.Curve.AskPointData(sda.Tag, pnt2)
        '    theSession.ListingWindow.WriteLine("X= " & pnt2(0).ToString("N4") & " Y= " & pnt2(1).ToString("N4") & " Z= " & pnt2(2).ToString("N4"))
        'Next

        GoTo Start1 ' Continue selecting points 

End1:
    End Sub

    Function selectPoints(ByRef selectedObjects As NXObject()) As Selection.Response
        Dim ui As UI = ui.GetUI()
        Dim mask(0) As Selection.MaskTriple
        With mask(0)
            .Type = UFConstants.UF_point_type
            .Subtype = UFConstants.UF_point_subtype
            .SolidBodySubtype = 0
        End With

        Try

            Dim resp As Selection.Response = _
            ui.SelectionManager.SelectObjects("Select Points", "Select Points", _
                Selection.SelectionScope.AnyInAssembly, _
                Selection.SelectionAction.ClearAndEnableSpecific, _
                False, False, mask, selectedObjects)

            If resp = Selection.Response.Cancel Or _
               resp = Selection.Response.Back Then
                Return Selection.Response.Cancel
            Else
                Dim info As String = "Number of selected objects = "
                info = String.Concat(info, selectedObjects.Length)
                System.Diagnostics.Trace.WriteLine(info)
                Return Selection.Response.Ok
            End If

        Catch e As Exception
            System.Diagnostics.Trace.WriteLine("Problems selecting objects.")
            System.Diagnostics.Trace.WriteLine(e.ToString)
        End Try
    End Function


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

End Module


Regards

Frank Swinkels
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top