Cancel
Showing results for 
Search instead for 
Did you mean: 

points by expressions

Valued Contributor
Valued Contributor

Hi,

 

I need to make "points by expression" without selecting them from the expression list.

 

I have "n" points expression defined (which come from an excel file) and I need to generate "automatically" the "points by expressions" without selecting them one by one. (I have to do this process too many times, and all I want is nx to create the assosiavite point by expressions just using the "points expressions" defined in each file.

 

I know its quite confusing, so i will upload a quick video showing how I must clik over each point, which is what I want to avoid. I may need a journal or whatever could make my life easier...

 

 

5 REPLIES 5

Re: points by expressions

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Is that NX 10 you are using?

Re: points by expressions

Valued Contributor
Valued Contributor

No, I´m using NX9 (well, client is..)

Re: points by expressions

Legend
Legend

Here is a journal (tested on NX9) that creates point features for all point expression.

 

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI
Imports NXOpen.UF
Imports NXOpen.Utilities

Module PointByExpression
    Dim s As Session = Session.GetSession()
    Dim ui As UI = ui.GetUI()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim wp As Part = s.Parts.Work()
    Sub Main()
        Dim expressions1 As ExpressionCollection = wp.Expressions
        Dim searchstring As String = "Point"
        Dim exprhsstring As String = Nothing
        Dim expname As String = Nothing
        Dim pnt1 As Point = Nothing
        For Each exp As Expression In expressions1
            exprhsstring = exp.RightHandSide
            If exprhsstring.Contains(searchstring) Then
                pnt1 = wp.Points.CreatePoint(exp, SmartObject.UpdateOption.WithinModeling)
                pnt1.SetVisibility(SmartObject.VisibilityOption.Visible)
                Dim nullFeatures_Feature As Features.Feature = Nothing
                Dim pointFeatureBuilder1 As Features.PointFeatureBuilder
                pointFeatureBuilder1 = wp.BaseFeatures.CreatePointFeatureBuilder(nullFeatures_Feature)
                pointFeatureBuilder1.Point = pnt1
                Dim nXObject1 As NXObject
                nXObject1 = pointFeatureBuilder1.Commit()
                pointFeatureBuilder1.Destroy()
            End If
        Next
    End Sub


    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

 

Frank Swinkels

Re: points by expressions

Siemens Phenom Siemens Phenom
Siemens Phenom
This is going to require a bit of programming, so you'll probably get more help in the NX Programming and Customization forum.
山田
yamada

Re: points by expressions

Valued Contributor
Valued Contributor
JUST WHAT I NEEDED. SORRY FOR THE DELAYED ACCEPTANCE.