Continue to Site

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!

Calculate Incidence Angles to a Surface

Status
Not open for further replies.

jmalbright

Aerospace
Sep 26, 2013
4
I have a UG model of a nacelle that icing tests are being performed on. The surface temperature of the nacelle is being monitored by IR cameras. If the incidence angle at which the camera hits the surface of the nacelle exceeds a certain value (say 50 degrees) then the camera reading will be inaccurate. So I have been tasked to find the portions of the nacelle where the incidence angle with the IR camera are greater than 50 degrees.

The incidence angle is calculated by drawing a line from the camera center (known point) to some arbitrary point on the nacelle surface. From that point on the nacelle surface another line that is normal to the surface is drawn. The incidence angle is the angle between those two lines.

Now this is obviously a calculation I can do manually for a bunch of different points, but it becomes tedious very fast when attempting to isolate all surfaces that have an incidence angle greater than 50 degrees. So I was wondering if it is possible to do this in some sort of an automated fashion that would allow me to isolate/extract the surfaces that have an incidence angle greater than 50 degrees.

Thank you for your help!
 
Replies continue below

Recommended for you

I forgot to mention that I'm using NX version 7.5.
 
What version of NX are you using?

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
I am not sure if there is an OOTB however I might have tried it using Knowledge fusion also.
I thought of using Isocline curves too but that will not work in your case as you have to do the calculation based on the point source.
Best Regards
Kapil Sharma
 
Here is a vb journal that creates points on a face at the incident angle of 50 degrees if it exists. I have done it for 8 points but you might be able to follow the logic if you need more points.

Hope it helps.

Frank Swinkels

Code:
' Journal to get limit points 
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI

Module incidentangle50
    Dim s As Session = Session.GetSession()
    Dim ui As UI = ui.GetUI()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Sub Main()
        Dim wp As Part = s.Parts.Work
PointStart:
        ' select a point
        Dim pnt1 As Point = Nothing
        Dim response1 As Selection.Response = Selection.Response.Cancel
        response1 = select_a_Point(pnt1)
        If response1 = Selection.Response.Back Then GoTo End1
        If response1 = Selection.Response.Cancel Then GoTo End1
        Dim coordpnt() As Double = {pnt1.Coordinates.X, pnt1.Coordinates.Y, pnt1.Coordinates.Z}
FaceStart:
        Dim face1 As Face = Nothing
        Dim message1 As String = "Select a face"
        Dim response2 As Selection.Response = Selection.Response.Cancel
        response2 = select_a_Face(message1, face1)
        If response2 = Selection.Response.Back Then GoTo PointStart
        If response2 = Selection.Response.Cancel Then GoTo End1
        Dim response3 As Selection.Response = Selection.Response.Cancel
        ' get limit points for constant u and constant v
        ' first get the normal point
        Dim parm0(1) As Double
        Dim pt0(2) As Double
        Dim pt1(2) As Double
        Dim pt2(2) As Double
        Dim pt3(2) As Double

        Dim parm1(1) As Double
        Dim parm2(1) As Double
        Dim parm3(1) As Double
        Dim ptlimit1(2) As Double
        Dim vec1(2) As Double
        Dim cross1(2) As Double
        Dim angle1 As Double = Nothing
        Dim junk3(2) As Double
        Dim norm1(2) As Double
        Dim junk2(1) As Double
        Dim u0 As Double = Nothing
        Dim u1 As Double = Nothing
        Dim u2 As Double = Nothing
        Dim v0 As Double = Nothing
        Dim v1 As Double = Nothing
        Dim v2 As Double = Nothing
        Dim v3 As Double = Nothing
        Dim n0(2) As Double
        Dim n1(2) As Double
        Dim n2(2) As Double
        Dim n3(2) As Double
        Dim temptag As Tag = Tag.Null
        Dim foundlimitpoint As Boolean = False
        Dim uvminmax(3) As Double
        ufs.Modl.AskFaceUvMinmax(face1.Tag, uvminmax)
        ' point1 
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = uvminmax(0)
        parm1(1) = parm0(1)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If
        ' point2 
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = uvminmax(1)
        parm1(1) = parm0(1)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If
        ' point3
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = parm0(0)
        parm1(1) = uvminmax(2)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If
        ' point4
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = parm0(0)
        parm1(1) = uvminmax(3)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If


        ' point5 
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = uvminmax(0)
        parm1(1) = uvminmax(2)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If
        ' point6 
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = uvminmax(1)
        parm1(1) = uvminmax(2)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If
        ' point7
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = uvminmax(0)
        parm1(1) = uvminmax(3)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If
        ' point8
        ufs.Modl.AskFaceParm(face1.Tag, coordpnt, parm0, pt0)
        parm1(0) = uvminmax(1)
        parm1(1) = uvminmax(3)
        ufs.Modl.AskFaceProps(face1.Tag, parm1, pt1, junk3, junk3, junk3, junk3, n1, junk2)
        ufs.Vec3.Sub(coordpnt, pt1, vec1)
        ufs.Vec3.Cross(vec1, n1, cross1)
        ufs.Vec3.AngleBetween(vec1, n1, cross1, angle1)
        angle1 = convertRadianToDegree(angle1)
        If angle1 > 50.0 Then
            foundlimitpoint = getLimitPoint(face1, coordpnt, pt0, pt1, parm0, parm1, pt3, angle1)
            If foundlimitpoint = True Then
                ufs.Curve.CreatePoint(pt3, temptag)
            End If
        End If
End1:

    End Sub
    Public Function getLimitPoint(ByVal face1 As Face, ByVal p0() As Double, ByVal p1() As Double, ByVal p2() As Double, ByVal parm1() As Double, _
                                  ByVal parm2() As Double, ByRef p3() As Double, ByRef a3 As Double) As Boolean
        Dim junk3(2) As Double
        Dim norm1(2) As Double
        Dim junk2(1) As Double
        Dim aimangle As Double = 50.0 * Math.PI / 180.0

        Dim checkcount As Integer = 0
        Dim tol1 As Double = 0.0001
        Dim n3(2) As Double
        Dim vec1(2) As Double
        Dim delangle As Double = Nothing
        Dim parm3() As Double = {(parm1(0) + parm1(0)) / 2.0, (parm1(1) + parm1(1)) / 2.0}
        Dim cross1(2) As Double
        ufs.Modl.AskFaceProps(face1.Tag, parm2, p3, junk3, junk3, junk3, junk3, n3, junk2)
        ufs.Vec3.Sub(p0, p3, vec1)
        ufs.Vec3.Cross(vec1, n3, cross1)
        ufs.Vec3.AngleBetween(vec1, n3, cross1, a3)
        If a3 < aimangle Then
            Return False
        End If
        delangle = Math.Abs(a3 - aimangle)

        While delangle > tol1
            If a3 > aimangle Then
                ufs.Vec3.Copy(p3, p2)
                ufs.Modl.AskFaceParm(face1.Tag, p1, parm1, p1)
                ufs.Modl.AskFaceParm(face1.Tag, p2, parm2, p2)
            Else
                ufs.Vec3.Copy(p3, p1)
                ufs.Modl.AskFaceParm(face1.Tag, p1, parm1, p1)
                ufs.Modl.AskFaceParm(face1.Tag, p2, parm2, p2)
            End If

            parm3(0) = (parm1(0) + parm2(0)) / 2.0
            parm3(1) = (parm1(1) + parm2(1)) / 2.0
            ufs.Modl.AskFaceProps(face1.Tag, parm3, p3, junk3, junk3, junk3, junk3, n3, junk2)
            ufs.Vec3.Sub(p0, p3, vec1)
            ufs.Vec3.Cross(vec1, n3, cross1)
            ufs.Vec3.AngleBetween(vec1, n3, cross1, a3)
            checkcount += 1
            If checkcount > 20 Then
                Return False
            End If
            delangle = Math.Abs(a3 - aimangle)

        End While
        Return True
    End Function
    Public Function convertRadianToDegree(ByVal angleRadians As Double) As Double
        Dim angledegrees As Double = angleRadians * 180.0 / Math.PI
        Return angledegrees
    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
    Function select_a_Point(ByRef pnt1 As Point) As Selection.Response
        Dim mask(0) As Selection.MaskTriple
        With mask(0)
            .Type = UFConstants.UF_point_type
            .Subtype = 0
            .SolidBodySubtype = 0
        End With
        Dim cursor As Point3d = Nothing
        Dim resp As Selection.Response = _
        ui.SelectionManager.SelectObject("Select point to project from", "Select a Point", _
            Selection.SelectionScope.AnyInAssembly, _
            Selection.SelectionAction.ClearAndEnableSpecific, _
            False, False, mask, pnt1, cursor)
        If resp = Selection.Response.ObjectSelected Or _
           resp = Selection.Response.ObjectSelectedByName Then
            Return Selection.Response.Ok
        Else
            Return Selection.Response.Cancel
        End If
    End Function

    Function select_a_Face(ByVal message As String, ByRef obj As Face) As Selection.Response

        Dim selectionMask_array(0) As Selection.MaskTriple
        With selectionMask_array(0)
            .Type = UFConstants.UF_face_type
            .Subtype = 0
            .SolidBodySubtype = 0
        End With
        Dim cursor As Point3d = Nothing
        Dim resp As Selection.Response = _
        ui.SelectionManager.SelectObject("Face Selection", message, _
            Selection.SelectionScope.AnyInAssembly, _
            Selection.SelectionAction.ClearAndEnableSpecific, _
            False, False, selectionMask_array, obj, cursor)
        If resp = Selection.Response.ObjectSelected Or _
           resp = Selection.Response.ObjectSelectedByName Then
            Return Selection.Response.Ok
        ElseIf resp = Selection.Response.Back Then
            Return Selection.Response.Back
        Else
            Return Selection.Response.Cancel
        End If
    End Function
End Module
 
Thank you so much for the journal Frank Swinkels! I tested it briefly and with a little modification I think this is exactly what I need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor