Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all 787 articles
Browse latest View live

Set all expressions to constant values

$
0
0

I'd like a journal to go through each component in the assembly and set each expression to a constant (removing any formulas if they exist). I see some issues with string expressions, so if possible I would want to restrict it to only change numeric expressions (skip "strings" for example). If you specifically help me with a function for going through the expressions of the work part I should be able to piece that into your recursive journal. Thank You.


Replace Component with NX Journal

$
0
0

Hello

I would like to have a Journal to replace, in an Assembly, a selected component by another one. I used the "record" function of NX but the Journal created by NX is incomplete because the Replace Component NX function is partially journaled. Can you help to write correctly this Journal

Thank you

Layer settings

$
0
0

Hi,

i have to create new layers in many existing parts

someone could help me to create a journal to make this ?

i have the list of the layers, but i don't know how to import in my existig part

Thanks

Need program that will identify a font number for each computer automatically.

$
0
0

I created a text macro. It automates the text and the font (Arial Narrow). The macro works great on my computer but when used on another computer the font changes. The font changes because the Macro see's my font choice as a number on my system, it doesn't see it as Arial Narrow, it sees it as number 65. This number can change from computer to computer. So I'm looking for something I can add to my Macro that will scan someones computer to find out what number Arial Narrow is and then automatically apply that number.

This looks like a NX number association. As far as I know, Windows doesn’t number its fonts. This must be something specific to NX. There may be a function call for this. Does anyone know of a function like this?

Thank you for your time,

Lisa

Edge Blend "Selection Stickiness" Removal

$
0
0

Hello,

I recorded the below journal just for creating two edge blends. Because an EDGE Blend need an EDGE and two connecting FACES, what would be the best practice to edit codes. I looked at the other 'face selection' and 'body section' posts from this site. But couldn't figure where to start for the below code. Need your kind help.

Option Strict Off
Imports System
Imports NXOpen
 
Module NXJournal
Sub Main
 
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
 
Dim displayPart As Part = theSession.Parts.Display
 
' ----------------------------------------------
'   Menu: Insert->Detail Feature->Edge Blend...
' ----------------------------------------------
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
 
        Dim nullFeatures_Feature As Features.Feature = Nothing
 
 
        If Not workPart.Preferences.Modeling.GetHistoryMode Then
            Throw (New Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode."))
        End If
 
Dim edgeBlendBuilder1 As Features.EdgeBlendBuilder
edgeBlendBuilder1 = workPart.Features.CreateEdgeBlendBuilder(nullFeatures_Feature)
 
Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("Inch"), Unit)
 
Dim expression1 As Expression
expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression2 As Expression
expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression3 As Expression
expression3 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression4 As Expression
expression4 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression5 As Expression
expression5 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression6 As Expression
expression6 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression7 As Expression
expression7 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim blendLimitsData1 As GeometricUtilities.BlendLimitsData
blendLimitsData1 = edgeBlendBuilder1.LimitsListData
 
Dim origin1 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim normal1 As Vector3d = New Vector3d(0.0, 0.0, 1.0)
Dim plane1 As Plane
plane1 = workPart.Planes.CreatePlane(origin1, normal1, SmartObject.UpdateOption.WithinModeling)
 
Dim facePlaneSelectionBuilder1 As GeometricUtilities.FacePlaneSelectionBuilder
facePlaneSelectionBuilder1 = workPart.FacePlaneSelectionBuilderData.Create()
 
Dim expression8 As Expression
expression8 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression9 As Expression
expression9 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression10 As Expression
expression10 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression11 As Expression
expression11 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
Dim expression12 As Expression
expression12 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
plane1.Evaluate()
 
Dim expression13 As Expression
expression13 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
 
theSession.SetUndoMarkName(markId1, "Edge Blend Dialog")
 
Dim scaleAboutPoint1 As Point3d = New Point3d(-6.03079777943201, 0.995259358491706, 0.0)
Dim viewCenter1 As Point3d = New Point3d(6.03079777943199, -0.99525935849174, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint1, viewCenter1)
 
Dim scaleAboutPoint2 As Point3d = New Point3d(-4.82463822354561, 0.796207486793361, 0.0)
Dim viewCenter2 As Point3d = New Point3d(4.82463822354559, -0.796207486793397, 0.0)
workPart.ModelingViews.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint2, viewCenter2)
 
Dim scCollector1 As ScCollector
scCollector1 = workPart.ScCollectors.CreateCollector()
 
Dim seedEdges1(0) As Edge
Dim trimBody2_1 As Features.TrimBody2 = CType(workPart.Features.FindObject("TRIM BODY(29)"), Features.TrimBody2)
 
Dim edge1 As Edge = CType(trimBody2_1.FindObject("EDGE * 1 UNPARAMETERIZED_FEATURE(11) 1 {(-18.821234,4.875,0.25)(-11.0147836666667,4.875,0.25)(-3.2083333333333,4.875,0.25) UNPARAMETERIZED_FEATURE(11)}"), Edge)
 
seedEdges1(0) = edge1
Dim edgeMultipleSeedTangentRule1 As EdgeMultipleSeedTangentRule
edgeMultipleSeedTangentRule1 = workPart.ScRuleFactory.CreateRuleEdgeMultipleSeedTangent(seedEdges1, 0.01, True)
 
Dim rules1(0) As SelectionIntentRule
rules1(0) = edgeMultipleSeedTangentRule1
scCollector1.ReplaceRules(rules1, False)
 
Dim seedEdges2(1) As Edge
seedEdges2(0) = edge1
Dim brep1 As Features.Brep = CType(workPart.Features.FindObject("UNPARAMETERIZED_FEATURE(11)"), Features.Brep)
 
Dim edge2 As Edge = CType(brep1.FindObject("EDGE * 2 TRIM BODY(29) 1 {(-18.821234,4.875,-0)(-11.0147836666668,4.875,-0)(-3.2083333333336,4.875,-0) UNPARAMETERIZED_FEATURE(11)}"), Edge)
 
seedEdges2(1) = edge2
Dim edgeMultipleSeedTangentRule2 As EdgeMultipleSeedTangentRule
edgeMultipleSeedTangentRule2 = workPart.ScRuleFactory.CreateRuleEdgeMultipleSeedTangent(seedEdges2, 0.01, True)
 
Dim rules2(0) As SelectionIntentRule
rules2(0) = edgeMultipleSeedTangentRule2
scCollector1.ReplaceRules(rules2, False)
 
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Edge Blend")
 
edgeBlendBuilder1.Tolerance = 0.001
 
edgeBlendBuilder1.AllInstancesOption = False
 
edgeBlendBuilder1.RemoveSelfIntersection = True
 
edgeBlendBuilder1.ConvexConcaveY = False
 
edgeBlendBuilder1.RollOverSmoothEdge = True
 
edgeBlendBuilder1.RollOntoEdge = True
 
edgeBlendBuilder1.MoveSharpEdge = True
 
edgeBlendBuilder1.TrimmingOption = False
 
edgeBlendBuilder1.OverlapOption = Features.EdgeBlendBuilder.Overlap.AnyConvexityRollOver
 
edgeBlendBuilder1.BlendOrder = Features.EdgeBlendBuilder.OrderOfBlending.ConvexFirst
 
edgeBlendBuilder1.SetbackOption = Features.EdgeBlendBuilder.Setback.SeparateFromCorner
 
Dim csIndex1 As Integer
csIndex1 = edgeBlendBuilder1.AddChainset(scCollector1, "0.1")
 
Dim feature1 As Features.Feature
feature1 = edgeBlendBuilder1.CommitFeature()
 
theSession.DeleteUndoMark(markId2, Nothing)
 
theSession.SetUndoMarkName(markId1, "Edge Blend")
 
workPart.FacePlaneSelectionBuilderData.Destroy(facePlaneSelectionBuilder1)
 
Try
  ' Expression is still in use.
  workPart.Expressions.Delete(expression11)
Catch ex As NXException
  ex.AssertErrorCode(1050029)
End Try
 
workPart.Expressions.Delete(expression13)
 
Try
  ' Expression is still in use.
  workPart.Expressions.Delete(expression8)
Catch ex As NXException
  ex.AssertErrorCode(1050029)
End Try
 
workPart.Expressions.Delete(expression10)
 
workPart.Expressions.Delete(expression12)
 
workPart.Expressions.Delete(expression9)
 
edgeBlendBuilder1.Destroy()
 
workPart.Expressions.Delete(expression2)
 
workPart.Expressions.Delete(expression6)
 
workPart.Expressions.Delete(expression1)
 
workPart.Expressions.Delete(expression4)
 
workPart.Expressions.Delete(expression5)
 
workPart.Expressions.Delete(expression3)
 
workPart.Expressions.Delete(expression7)
 
' ----------------------------------------------
'   Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
 
End Sub
End Module

Datum Plane and Datum Axis Selection

$
0
0

Good Morning

I want users to select Datum Plane and Datum Axis to create constrains. In my Journal I use the SelectionManager command

'theUI.SelectionManager.SelectObject(prompt, "Selection", Selection.SelectionScope.AnyInAssembly,False, typeArray, selobj, cursor)'

The issue is that Users are able to select, by mistake, something else in the 3D model because on the typeArray we cannot define something like
'Selection.SelectionType.Datums'

Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.All, _
Selection.SelectionType.Faces, _
Selection.SelectionType.Edges, _
Selection.SelectionType.Features}

What is the command to force the SelectionManager command to select only Datums features and nothing else ?

Thanks

Fabrice

NX Journal - Need to know if layer has objects

$
0
0

Hi all, like the title suggests, I need to be able to have an argument that says "If the layer has objects then"

This is my code but I know I can't use "Null"

Dim LayerManager As Layer.LayerManager = workpart.Layers
Dim ObjTest As NXObject() = Null
        Dim j As Integer = 1
        Do Until (LayerArray(j - 1).State = Layer.State.Selectable And ObjTest <> Null Or j = 256)
            ObjTest = LayerManager.GetAllObjectsOnLayer(j)
            j = j + 1
        Loop

It's just the ObjTest <> Null but I need. Some ways of getting True or False if a layer has objects

Please help!

Retrieving Welds' / Points' owning file name?

$
0
0

Currently I am trying to retrieve data on some welds which I can then output to a text file. Currently I allow the user to select which welds to use by using this:

If SelectObjects("Select Weld Objects", _
mySelectedObjects) = Selection.Response.Ok Then
I then process each selected element with the following:

For Each Obj As NXObject in mySelectedObjects

Next
I can retrieve various properties with something similar to:

x_pos = Obj.getRealAttribute("X_Pos")

Problem:

Now where I am having a problem is trying to find the file / part that the selected point belongs to. There is no attribute that lists the part. I do not know if there is a property for Obj to reference but I have tried things like Obj.Owner, Obj.Part, etc...

Obj.owningpart.fullpath sort of works but only if the owning weld file is selected. If I select the welds from an assembly then it will simply display that assembly which is not correct.

Is there an easy way to get the part that my selected point belongs to?


Dimension of Drafting View

$
0
0

Hi,

I am trying to create Grid line of one particular view.
For that I required the dimension of the View.
How to get the length and height of View or extreme of the view ?

Export Results to txt or csv or Excel

$
0
0

Hi all!:)
I got a problem which seems easy to me, but unfortunately it seems to be more difficult than expected. I can't understand why.
I've got a shell model, meshed it, created a .sim File with 5 Solutions à 2 loadcases. My major aim is it to get a file out of it, where the max displacements in x and y direction are printed. All that should be executable via a batch file.
Solving etc. works fine but i already tried myself to find a solution for it in the internet, but as I am really really new to journaling, the solutions seem to be too elaborate or too bombastic for my problem.
I read something about the whole .GetResultAccess thing and also I tried to use the "create Report" button. In the .htm file of the report, the max. displacements are written down but I am not sure how to automate these steps as "record journal" does not record these commands.
Also the method of printing all the displacements to my .f06 or .pch file and postprocessing these huge amounts of data for 10 cases seems to be exaggerated.

Could somebody please help me?
I would be very grateful!

Thank you in advance.

Kind regards,
Benny

Cycling through Assembly Children - structure isn't updated

$
0
0

So I have created a recursive function to go through all children of the current displayed part that contain some text in their display name. I use a method like this:

Sub WalkAssemblyTree(ByVal c As Component, ByVal indent As String)

Dim children As Component() = c.GetChildren()
Dim newIndent As String
Dim loadStatus1 As UFPart.LoadStatus = Nothing
For Each child As Component In children

If indent.Length = 0 Then
newIndent = ""
Else
newIndent = indent & ""
End If
Dim theInst As NXOpen.Tag = ufs.Assem.AskInstOfPartOcc(child.Tag)
Try

If child.getStringAttribute("DB_PART_NAME").Contains("IA-WELDS") = TRUE or child.getStringAttribute("DB_PART_NAME").Contains("WLD_") = true Then

ufs.Assem.EnsureChildLoaded(theInst, loadStatus1)

End If
Catch ex As Exception
Echo("Exception: "& ex.Message())
End Try

WalkAssemblyTree(child, newIndent)

Next
End Sub

This method works well for almost everything. The problem I have is that none of the subassembly files are loaded. Initially looking at the tree for one item, it shows one of its components as a part (not assembly, like it doesn't have any children) but if I actually open the assembly, I discover that the component it thought was a part, is actually an assembly. This creates a problem with my method, as it will not find the children of that component since it things it is a part, and not an assembly.

Is there a way to make my search look inside this type of a file or to update the treeview structure to be accurate to what actually exists?

Deleting Notes from View

$
0
0

Hi,

I have created one drafting view with few notes containing some text value.

I am trying to delete that View through journal and it is working good sometime and sometime not.

I have used below code.

Option Strict Off
Imports System
Imports NXOpen
 
Module NXJournal
 
Sub Main (ByVal args() As String) 
 
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
 
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete")
 
Dim notifyOnDelete1 As Boolean
notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete
 
theSession.UpdateManager.ClearErrorList()
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete")
 
Dim objects1(0) As NXObject
Dim drawingView1 As Drawings.DrawingView = CType(workPart.DraftingViews.FindObject("Example"), Drawings.DrawingView)
 
objects1(0) = drawingView1
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.AddToDeleteList(objects1)
 
Dim notifyOnDelete2 As Boolean
notifyOnDelete2 = theSession.Preferences.Modeling.NotifyOnDelete
 
Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId2)
 
theSession.DeleteUndoMark(markId1, Nothing)
 
 
End Sub
End Module

Set Font Style in Tabular Note

$
0
0

HI,

I am trying to set font style "Arial Unicode MS" in tabular note.
But it is not getting applied to note.

But I am able to set "Monospac821 BT".
I have used below code to set this Font.

Dim theCellPrefs As UFTabnot.CellPrefs
ufsession.Tabnot.AskCellPrefs(cellTag, theCellPrefs)
theCellPrefs.text_aspect_ratio = 0.68

'change the font preference setting
Dim fntMonoBT As Integer = workPart.Fonts.AddFont("Monospac821 BT", FontCollection.Type.Standard)
theCellPrefs.text_font = 8
ufsession.Tabnot.SetCellPrefs(cellTag, theCellPrefs)

So is there any specific integer value for "Arial Unicode MS" like "8" is for "Monospac821 BT".

How to add Chinese font in Table through journal

$
0
0

Hi,

I am trying to create tabular note through journal and want to add chinese character in it.
For that i am using below mentioned code.
I am able to set the font separately after creating table but not through the code.
So how to do it ?
I have used Arial Unicode MS font style.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports NXOpen.Builder
Imports NXOpen.NXObject
Imports System.Collections.Generic
Imports NXOpen.Features
Imports System.Threading
 
Module Module1
 
    Dim theSession As Session
    Dim workPart As Part
    Dim displayPart As Part
    Dim theCellPrefs As UFTabnot.CellPrefs
    Dim myTabularNoteTags As New List(Of Tag)
    Dim tableSectionBuilder1 As Annotations.TableSectionBuilder
    Dim cellTag As Tag
    Private ufsession As UFSession
    Private theUfSession As UFSession
    Private myTabNote As NXOpen.Annotations.TableSection
    Dim OH As Double
    Private dwgShtBld As Drawings.DrawingSheetBuilder
    Dim rowTag As Tag
    Dim colTag As Tag
    Dim numRows As Integer
    Dim numCols As Integer
    Sub Main()
 
 
        theSession = Session.GetSession()
        workPart = theSession.Parts.Work
        UFSession = UFSession.GetUFSession()
        displayPart = theSession.Parts.Display
 
        Dim nullAnnotations_TableSection As Annotations.TableSection = Nothing
 
        displayPart = theSession.Parts.Display
        dwgShtBld = workPart.DrawingSheets.DrawingSheetBuilder(workPart.DrawingSheets.CurrentDrawingSheet)
 
        OH = dwgShtBld.Length
 
        dwgShtBld.Commit()
        dwgShtBld.Destroy()
 
        tableSectionBuilder1 = workPart.Annotations.TableSections.CreateTableSectionBuilder(nullAnnotations_TableSection)
        tableSectionBuilder1.Origin.Anchor = Annotations.OriginBuilder.AlignmentPosition.MidLeft
        tableSectionBuilder1.Origin.Plane.PlaneMethod = Annotations.PlaneBuilder.PlaneMethodType.ModelView
        tableSectionBuilder1.Origin.Anchor = Annotations.OriginBuilder.AlignmentPosition.TopLeft
        tableSectionBuilder1.RowHeight = 7.1
        tableSectionBuilder1.Style.TableSectionStyle.AlignmentPosition = Annotations.TableSectionStyleBuilder.AlignmentPositionType.BottomRight
        tableSectionBuilder1.Style.LetteringStyle.GeneralTextAspectRatio = 0.68
 
        tableSectionBuilder1.NumberOfColumns = 5
        tableSectionBuilder1.NumberOfRows = 1
        tableSectionBuilder1.ColumnWidth = 30
        tableSectionBuilder1.Style.TableSectionStyle.MaximumHeight = 2000
 
        '--Setting the properties of Table--------------------------------------
        Dim fitmethods1(0) As Annotations.TableCellStyleBuilder.FitMethodType
        fitmethods1(0) = Annotations.TableCellStyleBuilder.FitMethodType.Wrap
        '   fitmethods1(1) = Annotations.TableCellStyleBuilder.FitMethodType.AutoSizeRow
        tableSectionBuilder1.Style.TableCellStyle.SetFitMethods(fitmethods1)
 
 
        Dim assocOrigin1 As Annotations.Annotation.AssociativeOriginData
        assocOrigin1.OriginType = Annotations.AssociativeOriginType.Drag
        Dim nullView As View = Nothing
        assocOrigin1.View = nullView
        assocOrigin1.ViewOfGeometry = nullView
        Dim nullPoint As Point = Nothing
 
        tableSectionBuilder1.Origin.SetAssociativeOrigin(assocOrigin1)
        Dim point1 As Point3d
 
 
        point1 = New Point3d(OH - 200, 70, 0.0)
 
 
        tableSectionBuilder1.Origin.Origin.SetValue(Nothing, nullView, point1)
        tableSectionBuilder1.Origin.SetInferRelativeToGeometry(True)
 
 
        Dim nXObject1 As NXObject
        nXObject1 = tableSectionBuilder1.Commit()
        Dim objects1() As NXObject
        objects1 = tableSectionBuilder1.GetCommittedObjects()
        tableSectionBuilder1.Destroy()
 
        Dim objectGeneralPropertiesBuilder1 As ObjectGeneralPropertiesBuilder
        objectGeneralPropertiesBuilder1 = workPart.PropertiesManager.CreateObjectGeneralPropertiesBuilder(objects1)
 
        Dim selectNXObjectList1 As SelectNXObjectList
        selectNXObjectList1 = objectGeneralPropertiesBuilder1.SelectedObjects
 
        objectGeneralPropertiesBuilder1.NameLocationSpecified = False
        objectGeneralPropertiesBuilder1.Index = 1
        objectGeneralPropertiesBuilder1.Name = "EXAMPLE"
 
        Dim nXObject3 As NXObject
        nXObject3 = objectGeneralPropertiesBuilder1.Commit()
 
        If FindTabularNotes(myTabularNoteTags) = 0 Then
            'no tabular notes to process
            Return
        End If
        '----------------------------------------------------
 
        Dim tableNote As NXOpen.Tag
 
        For Each tableNote In myTabularNoteTags
            tableNote = myTabularNoteTags.Item(0)
            ufsession.Tabnot.AskNmRows(tableNote, numRows)
            ufsession.Tabnot.AskNmColumns(tableNote, numCols)
 
            '------------------------------------------------------------
            'For First row
            '-------------------------------------------------------------
            For i As Integer = 0 To 0
                ufsession.Tabnot.AskNthRow(tableNote, i, rowTag)
                ufsession.Tabnot.SetRowHeight(rowTag, 4.5)
                For j As Integer = 0 To numCols - 1
                    ufsession.Tabnot.AskNthColumn(tableNote, j, colTag)
                    Dim cellTag As Tag
                    ufsession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)
 
                    If j = 0 Then
                        ufsession.Tabnot.SetColumnWidth(colTag, 35)
                    ElseIf j = 1 Then
                        ufsession.Tabnot.SetColumnWidth(colTag, 27)
                    ElseIf j = 2 Then
                        ufsession.Tabnot.SetColumnWidth(colTag, 27)
                    ElseIf j = 3 Then
                        ufsession.Tabnot.SetColumnWidth(colTag, 27)
                    ElseIf j = 4 Then
                        ufsession.Tabnot.SetColumnWidth(colTag, 79)
                    End If
 
                    'Set the RowHeight
                    ufsession.Tabnot.SetRowHeight(rowTag, 7.1)
                    'get the current cell preferences
                    ufsession.Tabnot.AskCellPrefs(cellTag, theCellPrefs)
                    theCellPrefs.text_aspect_ratio = 0.68
                    'change the font preference setting
                    Dim Font As Integer = workPart.Fonts.AddFont("Arial Unicode MS", FontCollection.Type.Standard)
                    'theCellPrefs.text_aspect_ratio = 0.68
 
                    theCellPrefs.text_height = 3.5
                    theCellPrefs.horiz_just = UFTabnot.Just.JustMiddle
                    theCellPrefs.vert_just = UFTabnot.Just.JustCenter
 
                    Dim LL() As Integer = {4, 1, 5}     '------To change the linetype of border  
                    theCellPrefs.bottom_line_cfw = LL
                    theCellPrefs.right_line_cfw = LL
                    'apply the new settings to the cell
                    ufsession.Tabnot.SetCellPrefs(cellTag, theCellPrefs)
                    ufsession.Tabnot.SetRowHeadCfw(rowTag, LL) '----Sets only the extreme left border of a row -----
                    '  ufsession.Tabnot.SetCellText(cellTag, "")
 
                    If j = 0 Then
                        ufsession.Tabnot.SetCellText(cellTag, "Created By/制图")
                    End If
                Next
            Next
        Next
 
    End Sub
 
 
    Function FindTabularNotes(ByRef theTabNotes As List(Of Tag)) As Integer
 
        Dim tmpTabNote As NXOpen.Tag = NXOpen.Tag.Null
        Dim type As Integer
        Dim subtype As Integer
        theSession = Session.GetSession()
        workPart = theSession.Parts.Work
        ufsession = ufsession.GetUFSession()
        displayPart = theSession.Parts.Display
 
        Do
            ufsession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote)
            If tmpTabNote = NXOpen.Tag.Null Then
                Continue Do
            End If
            If tmpTabNote <> NXOpen.Tag.Null Then
                ufsession.Obj.AskTypeAndSubtype(tmpTabNote, type, subtype)
                If subtype = UFConstants.UF_tabular_note_subtype Then
 
                    theTabNotes.Add(tmpTabNote)
 
                End If
            End If
        Loop Until tmpTabNote = NXOpen.Tag.Null
 
        Return theTabNotes.Count
 
    End Function
 
End Module

Output material of component?

$
0
0

Greetings all. I have a NX program that generates a Flat BOM of the assembly along with a few other details for each component. How can I output the material of each component? If material is only assigned to bodies, is there a way to get the material of each body within a component?

Any help would be appreciated.

Thanks


Batch file error UFUN 949904

$
0
0

I have a .bat file that used to work but now gives out error 'failed to initialize UFUN 949904'.
This journal batch file is supposed go into NX parts in the background and open one .vb file to get data from those parts.
The file used to work so maybe something got misplaced. Have you ever encountered it?

Hi

Suppress Drafting Object

$
0
0

Hello
I have a drawing with lot of dimensions; some of them are suppressed using the UG Function 'Suppress Drafting Object'; they are controlled by expressions

I created a journal which writes, in a text file, all Append Text and all Dimension Value visible on the drawing but the journal writes also the suppressed ones (not visible); I need only not suppressed dimensions.
I did not find any 'suppress' properties for dimensions object.

How can I do the distinction between 'not suppressed' dimensions (visible on the drawing) and 'suppressed' dimensions (not visible on the drawing)

Thanks in advance for your help

Extract positions of pattern feature

$
0
0

Hello,

I need to extract all positions in the pattern general of a linked body.
The following code not working, the section1 have not information of linked body's.
have you an idea of the good way :).
Sorry for my bad english

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Dim featArray() As Feature = workPart.Features.GetFeatures()

For Each myFeature As Feature In featArray
lw.WriteLine("Feature: "& myFeature.FeatureType.ToString)
If myFeature.FeatureType = "Pattern Feature" Then

Dim pattfeaturebuilder As PatternFeatureBuilder = workPart.Features.CreatePatternFeatureBuilder(myFeature)
Dim section1 As NXOpen.Section
section1 = pattfeaturebuilder.PatternService.GeneralDefinition.ToPoints

Reference the Point in a Feature

$
0
0

Hi All,

I'm looking for a little help in putting together a vb journal that will list the names and coordinates of many point features that I have selected from a work part (in NX9).

I think I need to select the features so that I can get the names, but then the features don't have any location info.

Here's an excerpt:

Dim selectedObjects() As NXObject
Dim myPoint As Point
Dim myFeature As Features.PointFeature
For Each myFeature In selectedObjects
' Somehow set myPoint as the point contained in myFeature
' So that I can do something like:
lw.WriteLine(myFeature.GetFeatureName & " - "& myFeature.Name)
lw.WriteLine(myPoint.Coordinates.X.ToString("N3") & vbTab & _ myPoint.Coordinates.Y.ToString("N3") & vbTab & _ myPoint.Coordinates.Z.ToString("N3"))
Next

Am I even going about this the right way? Should I be selecting the points instead of the features?
Any help would be appreciated.

Thanks,
Seth

Viewing all 787 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>