×
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

Do someone know how to use this method without using visual studio

Do someone know how to use this method without using visual studio

Do someone know how to use this method without using visual studio

(OP)
Hi
Do someone know how to use this method without using visual studio ?
using only nx journal

Thank you.

CODE -->

'In Visual Studio, you basically include this module in your project. You also include the
' .dlx file in your project and set the build action for the .dlx to "Embedded Resource".
' You make a small modification to the definition of the .dlx filename
' in your block styler code and the tool take care of the rest.
' 
'The function writeDlxResourceToTemp() loops through all of the resources
' in your project looking for a .dlx. When it finds it, it writes a copy
' to UGII_TMP_DIR, then returns the path to the file that it just wrote.
 
'File is attached. Full instructions are commented in the file and copied
' in the code block below (note that EmbedddedDLX_BS should be
' replaced with the name of your Block Styler Dialog):
' 
'Embedded_DLX.vb - Embed DLX file into application .dll
'
'  History: 
'    18-Oct-2014 / Jim Bernard / created / NX 8.5
'
'  Description:
'    This function will write a .dlx file contained in a project as an embedded
'    resource to a temporary directory. The resulting filename is set as a
'    global variable to be used when a .dll loads a block styler dialog.
'
'    This provides a custom fully qualified name for the .dlx file on any
'    machine that the NX Open .dll is executed on, regardless of the location
'    (pathname) of the .dll. This removes the requirement that the .dlx file
'    be distributed with the .dll and that the .dlx file must reside in a
'    UGII application folder.
'
'  Instructions:
'    1) Add Embedded_DLX.vb to your Visual Studio project
'    2) Add the .dlx file to your Visual Studio project
'         - Set the Build Action to "Embedded Resource"
'    3) Modify the dlx filename definition in your block styler code
'
'             theDlxFileName = "xyz_BS.dlx"
'             If IO.File.Exists(tempDlxFile) Then theDlxFileName = tempDlxFile
'
'    4) Add the following lines to your application code to write the temporary
'         .dlx file prior to launching the dialog and to delete the temporary
'         .dlx file prior to termination
'
'             Sub Main()
'
'                 tempDlxFile = writeDlxResourceToTemp()
'
'                 EmbeddedDLX_BS.Main()
'
'                 IO.File.Delete(tempDlxFile)
'
'             End Sub
'
'
'  Known Issues:
'
Option Strict Off
Imports System
Imports System.IO
Imports System.Reflection

Imports NXOpen

Module Embedded_DLX

    Public tempDlxFile As String = Nothing

    Function writeDlxResourceToTemp() As String

        Try

            Dim dlxResourceName As String = Nothing

            For Each resourceItem As String In Assembly.GetExecutingAssembly.GetManifestResourceNames
                If resourceItem.ToLower.EndsWith(".dlx") Then
                    dlxResourceName = resourceItem
                End If
            Next resourceItem

            Dim tempSysPath As String = IO.Path.GetTempPath
            Dim tempNxPath As String = theSession.GetEnvironmentVariableValue("UGII_TMP_DIR")
            Dim tempDlxFile As String = IO.Path.Combine(tempNxPath, dlxResourceName)

            Using DLXStream As Stream = New FileStream(tempDlxFile, FileMode.Create)

                Assembly.GetExecutingAssembly().GetManifestResourceStream(dlxResourceName).CopyTo(DLXStream)

            End Using

            Return tempDlxFile

        Catch ex As Exception
            theNXMessageBox.Show("writeDlxResourceToTemp", NXMessageBox.DialogType.Error, ex.ToString)
        End Try

        Return Nothing

    End Function

End Module 

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

eBook – How to Choose the Correct Corrosion Testing Method
When designing a metal component, engineers have to consider how susceptible certain alloys are to corrosion in the final product’s operating environment. In a recent study by NACE (National Association of Corrosion Engineers), it was estimated that the direct and indirect costs of corrosion in the United States is approximately 6.2% of the GDP. In 2016, that cost exceeded $1 trillion dollars for the first time. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close