×
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

need advice in macros

need advice in macros

need advice in macros

(OP)
Hello macro experts!
I need use UF_DRAW_extracted_edge to change current view style in drawing
could  someone give the simple example...
I dont know when should  use session when ufsesssion and what is difference...
thanks

RE: need advice in macros

if the function you want to use has UF at the start it needs a UFsession.
I think the syntax for that command would be
Ufsession.Draw.extracted_edge
That's just off the top of my head and needs to be checked.


Mark Benson
Aerodynamic Model Designer

RE: need advice in macros


 Hi,

i didnt get what extracting edges for drafting mean..

  Just giving a tip not a solution for your task

  Session object is .NET reference where as UFsession object is UFUNC Open C wrappers reference

  you need to instantiate these two to get hold on the current NX session and operate on the function calls
 



RE: need advice in macros

(OP)
i wanted to have toggle  between none and associative in drawing view style ...

my code is

Option Strict Off

Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.Drawings
Module Module1
    
    Sub Main()

        Dim  i, j As Integer
        Dim theSession As Session = Session.GetSession()
        Dim ufs As UFSession = UFSession.GetUFSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim drtag As Tag()
        Dim v_tag As Tag()
        Dim numd As Integer
        Dim numv As Integer
        Dim PartName As String
        
        ufs.Draw.AskDrawings(numd, drtag)
        For i = 0 To numd - 1
            ufs.Draw.AskViews(drtag(i), numv, v_tag)
            Dim v_par As UFDraw.ViewPrfs
            For j = 0 To numv - 1
                v_par.extracted_edges = 1
                ufs.Draw.SetViewDisplay(v_tag(j), v_par)
            Next
        Next
    End Sub
End Module

it failed with error
NXOpen.NXException: Input is not a valid parameter.
at NXOpen.UF.UFDraw.SetViewDisplay(Tag view_tag, ViewPrfs& view_parms)
at NX.Module1.Main() in nx://root/Script:line 29

RE: need advice in macros



 Hi,

   You have declared the structure for view preferences, but it needs to be initialized for all the values it has. you are supplying only the extracted edges input.

Try using this way....

For j = 0 To numv - 1
    ufs.Draw.AskViewDisplay(v_tag(j), v_par)
    v_par.extracted_edges = 1
    ufs.Draw.SetViewDisplay(v_tag(j), v_par)
Next

Now the whole of the structure instance is poppulated with the default values..will get modified in the subsequent statement and then the update is driven.


RE: need advice in macros

(OP)
thanks very much,HariharanB!

RE: need advice in macros

(OP)
please could You help in another thing

i need to turn on autoupdate in Sheetmetal flatpattern...

can not manage...
code:
Sub set_smd_pref
    'sheet metal preferences setup
       dim smd as UFSmd
       dim fp_options() As UFSmd.FpPrefs
       
      smd.AskFpPrefs(fp_options)
       
       fp_options.auto_update = true
    
    End Sub

RE: need advice in macros



 Hi,

  Find the corrected code below with appropriate comments

  Sub set_smd_pref()

        Try

            ''' / Need to get the session object /
            Dim UFS As UFSession = UFS.GetUFSession

            ''' / Do not access wrapper class objects directly
            ''' They cannot be instantiated, but only the shared
            ''' elements can be accessed /
            'sheet metal preferences setup
            'Dim smd As UFSmd

            Dim fp_options(-1) As UFSmd.FpPrefs

            UFS.Smd.AskFpPrefs(fp_options)

            With fp_options(0)

                MessageBox.Show("Existing auto update preferences value :" + .auto_update.ToString)

                ''' / Check the default value before overriding /
                If Not (.auto_update) Then

                    fp_options(0).auto_update = True

                    MessageBox.Show("Value succesfully changed to TRUE")

                End If

            End With

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

RE: need advice in macros

(OP)
thanks very much - it works...
experience is forever thing! :)

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