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

Measure volume from files in a folder

$
0
0

Hi,

looking for a journal which could process all NX files in a folder and display the file name and the measured volume in the listing window. (Information window) . Please help.


Analysis of the workpart name

$
0
0

Hello! I need some help..

Depending on the workpart name mask is need perform a version code A or B.
name mask for code A: xx.xxxx.x.xxxx.xxx or xx.xxxx.x.xxxx.xxx_pxx
name mask for code B: xx.xxxx.x.xxxx.xxx_kxx

if mask A then
Code A
...
...

if mask B then
Code B....
........
......

How to write this in journal? Please!

Nx Journaling Custom Command Project

$
0
0

Hello,
I am trying to make a custom command button for nx by using nx journal vb scripts. The algorithm is like this;

1)User will choose the areas.
2)The areas will be divided to a constant.
3)If the result is bigger than an other constant, a string message will come to screen. Else an other string message will come to screen.

The problem is the vb code of this algorithm. And the user interface of this command. Can you help me with these problems?

Thank you.

Drafting: Diameter Custom Prefix

$
0
0

Dear fellow NX-ers

I tried to make a button that when clicked acts like the 'diametral annotation' but instead of the 'O' (diameter sign) gives me a (letter) M, as prefix.

I tried the favorites, but couldnt get it working.

When trying to record a journal in which i set up this annotation, it fails to show me the annotation dialog box

Can anyone help or point in the good direction?

Kind regards,

' NX 9.0.3.4
' Journal created by WVelle on Wed Apr 13 16:33:32 2016 Romance (zomertijd)
'
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
 
' ----------------------------------------------
'   Menu: Insert->Dimension->Rapid...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
 
Dim nullAnnotations_Dimension As Annotations.Dimension = Nothing
 
Dim rapidDimensionBuilder1 As Annotations.RapidDimensionBuilder
rapidDimensionBuilder1 = workPart.Dimensions.CreateRapidDimensionBuilder(nullAnnotations_Dimension)
 
rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)
 
rapidDimensionBuilder1.Origin.Anchor = Annotations.OriginBuilder.AlignmentPosition.MidCenter
 
rapidDimensionBuilder1.Measurement.Method = Annotations.DimensionMeasurementBuilder.MeasurementMethod.Diametral
 
theSession.SetUndoMarkName(markId1, "Rapid Dimension Dialog")
 
rapidDimensionBuilder1.Origin.Plane.PlaneMethod = Annotations.PlaneBuilder.PlaneMethodType.XyPlane
 
rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)
 
Dim dimensionlinearunits1 As Annotations.DimensionUnit
dimensionlinearunits1 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits2 As Annotations.DimensionUnit
dimensionlinearunits2 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits3 As Annotations.DimensionUnit
dimensionlinearunits3 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits4 As Annotations.DimensionUnit
dimensionlinearunits4 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits5 As Annotations.DimensionUnit
dimensionlinearunits5 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits6 As Annotations.DimensionUnit
dimensionlinearunits6 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits7 As Annotations.DimensionUnit
dimensionlinearunits7 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits8 As Annotations.DimensionUnit
dimensionlinearunits8 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits9 As Annotations.DimensionUnit
dimensionlinearunits9 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits10 As Annotations.DimensionUnit
dimensionlinearunits10 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits11 As Annotations.DimensionUnit
dimensionlinearunits11 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)
 
rapidDimensionBuilder1.Origin.SetInferRelativeToGeometry(True)
 
Dim nullDirection As Direction = Nothing
 
rapidDimensionBuilder1.Measurement.Direction = nullDirection
 
Dim nullView As View = Nothing
 
rapidDimensionBuilder1.Measurement.DirectionView = nullView
 
rapidDimensionBuilder1.Style.DimensionStyle.NarrowDisplayType = Annotations.NarrowDisplayOption.None
 
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Start")
 
Dim dimensionlinearunits12 As Annotations.DimensionUnit
dimensionlinearunits12 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits13 As Annotations.DimensionUnit
dimensionlinearunits13 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits14 As Annotations.DimensionUnit
dimensionlinearunits14 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits15 As Annotations.DimensionUnit
dimensionlinearunits15 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits16 As Annotations.DimensionUnit
dimensionlinearunits16 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits17 As Annotations.DimensionUnit
dimensionlinearunits17 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits18 As Annotations.DimensionUnit
dimensionlinearunits18 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits19 As Annotations.DimensionUnit
dimensionlinearunits19 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits20 As Annotations.DimensionUnit
dimensionlinearunits20 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits21 As Annotations.DimensionUnit
dimensionlinearunits21 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits22 As Annotations.DimensionUnit
dimensionlinearunits22 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits23 As Annotations.DimensionUnit
dimensionlinearunits23 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
theSession.SetUndoMarkName(markId2, "Settings Dialog")
 
theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Visible)
 
Dim dimensionlinearunits24 As Annotations.DimensionUnit
dimensionlinearunits24 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits25 As Annotations.DimensionUnit
dimensionlinearunits25 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits26 As Annotations.DimensionUnit
dimensionlinearunits26 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits27 As Annotations.DimensionUnit
dimensionlinearunits27 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits28 As Annotations.DimensionUnit
dimensionlinearunits28 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits29 As Annotations.DimensionUnit
dimensionlinearunits29 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits30 As Annotations.DimensionUnit
dimensionlinearunits30 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits31 As Annotations.DimensionUnit
dimensionlinearunits31 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits32 As Annotations.DimensionUnit
dimensionlinearunits32 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits33 As Annotations.DimensionUnit
dimensionlinearunits33 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits34 As Annotations.DimensionUnit
dimensionlinearunits34 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits35 As Annotations.DimensionUnit
dimensionlinearunits35 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
' ----------------------------------------------
'   Dialog Begin Settings
' ----------------------------------------------
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")
 
theSession.DeleteUndoMark(markId3, Nothing)
 
Dim markId4 As Session.UndoMarkId
markId4 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")
 
rapidDimensionBuilder1.Style.RadialStyle.DiameterSymbolType = Annotations.DiameterSymbol.UserDefined
 
theSession.SetUndoMarkName(markId4, "Settings - Diameter Symbol")
 
theSession.SetUndoMarkVisibility(markId4, Nothing, Session.MarkVisibility.Visible)
 
theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Invisible)
 
Dim markId5 As Session.UndoMarkId
markId5 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")
 
theSession.DeleteUndoMark(markId5, Nothing)
 
Dim markId6 As Session.UndoMarkId
markId6 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")
 
rapidDimensionBuilder1.Style.RadialStyle.DiameterSymbol = "M"
 
theSession.SetUndoMarkName(markId6, "Settings - Symbol to Use")
 
theSession.SetUndoMarkVisibility(markId6, Nothing, Session.MarkVisibility.Visible)
 
theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Invisible)
 
Dim markId7 As Session.UndoMarkId
markId7 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")
 
Dim markId8 As Session.UndoMarkId
markId8 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Settings")
 
theSession.DeleteUndoMark(markId8, Nothing)
 
theSession.SetUndoMarkName(markId2, "Settings")
 
theSession.DeleteUndoMark(markId7, Nothing)
 
theSession.SetUndoMarkVisibility(markId2, Nothing, Session.MarkVisibility.Visible)
 
theSession.DeleteUndoMark(markId6, Nothing)
 
theSession.DeleteUndoMark(markId4, Nothing)
 
theSession.DeleteUndoMark(markId2, Nothing)
 
Dim dimensionlinearunits36 As Annotations.DimensionUnit
dimensionlinearunits36 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits37 As Annotations.DimensionUnit
dimensionlinearunits37 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits38 As Annotations.DimensionUnit
dimensionlinearunits38 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits39 As Annotations.DimensionUnit
dimensionlinearunits39 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits40 As Annotations.DimensionUnit
dimensionlinearunits40 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits41 As Annotations.DimensionUnit
dimensionlinearunits41 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits42 As Annotations.DimensionUnit
dimensionlinearunits42 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits43 As Annotations.DimensionUnit
dimensionlinearunits43 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits44 As Annotations.DimensionUnit
dimensionlinearunits44 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
Dim dimensionlinearunits45 As Annotations.DimensionUnit
dimensionlinearunits45 = rapidDimensionBuilder1.Style.UnitsStyle.DimensionLinearUnits
 
' ----------------------------------------------
'   Menu: Tools->Journal->Insert->User Pause
' ----------------------------------------------
Dim theUI As UI = UI.GetUI()
 
theUI.JournalPause()
 
' ----------------------------------------------
'   Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
 
End Sub
End Module

Move datums, axes, sketches, extrudes of component on another assembly layer

$
0
0

You can delete this topic, if you want, because I already solved the problem =)

The working part (Assembly) contains components that are not subassemblies. Components contains the features build tree, including datums, axes, sketches, extrudes. Need to move components with specific attributes and their objects (datums, axes, sketches, extrudes)on layer 10 of the assembly.
I used this code http://www.nxjournaling.com/content/creating-subroutine-process-all-comp... and was able to sort the components I need and move them on a assembly layer, but don't know how to move the contents of the components.

if child.GetStringAttribute("DB_PART_TYPE")="type1" Then
ufs.obj.SetLayer(child.tag, 10)
end if

Code transfers the contents of the component if they belong to the same layer with the component. But if I manually transfer the contents(datums, axes, sketches, extrudes) (by using the selection filter) to another layer of the assembly, the code move only component but not of its contents.

AskMassProps3d in NXOpen

$
0
0

Hi,

I am trying to fetch the following info out of my workpart(an assembly).

1. Mass
2. Centre of mass
3. RadiusOfGyration

I am using the below code to get the same.It works fine in part level,whereas isn't returning any value in assembly level..Please advise if I'm missing out on something.

Cheers,
Aditya

            Part workPart = theSession.Parts.Work;
            Part displayPart = theSession.Parts.Display;
 
            double[] dblAcc_Value = new double[11];
            double[] dblMass_Props = new double[47];
            double[] dblStats = new double[13];
 
 
            //Tag[] taglist = new Tag[1];
            dblAcc_Value[0] = 0.99;
 
            foreach (Body sb in workPart.Bodies)
            {               
                //taglist[1] = sb.Tag;
 
 
                Tag[] taglist = new Tag[1] { sb.Tag };
 
                ufSession.Modl.AskMassProps3d(taglist, 1, 1, 1, 0.0375, 1, dblAcc_Value, dblMass_Props, dblStats);
 
                MessageBox.Show("Mass = " + dblMass_Props[2].ToString() + "\nCentre of mass X = " + dblMass_Props[3].ToString() + "\nCentre of mass Y = " + dblMass_Props[4].ToString() + "\nCentre of mass Z = " + dblMass_Props[5].ToString() + "\nRadiusOfGyration X = " + dblMass_Props[37].ToString() + "\nRadiusOfGyration Y = " + dblMass_Props[38].ToString() + "\nRadiusOfGyration Z = " + dblMass_Props[39].ToString());
 
            }
 
            }

Click on menu item from journal or start macro file to do this

$
0
0

In NX there is user menu service-materials-synchronization, which runs dll that have multiple entry points depending on different conditions . I need to run it from the journal. I decided it would be easier to run it with simulated click on the menu button. Is it probably to do this in journal code, or there is need to run the macro file from the journal?

How to get tool information

$
0
0

Hi to all, I'm new to nxopen.

I try to write simple program that retrive the tool information (tool diameter, tool material etc..)

So after several hours i still could not understand how i get this information...

Will glad for idies.....thanks.

// I look for something like this...
double diameter = tool.getInformation("Diameter");


import, insert in WCS center

$
0
0

I need to import the part in the zero point of the WCS.
If WCS is offset relative to the absolute coordinate system, then when i import some part into WCS, the values of X Y Z is not zero, I enter the zeros. Journal recorded non-zero values and then imports the part is not in WCS:

Dim destinationPoint1 As NXOpen.Point3d = New NXOpen.Point3d(45.0, 41.0, 25.0)
How to assign the zero point of the WCS???
Or how solve my problem?

Dim partImporter1 As NXOpen.PartImporter
partImporter1 = workPart.ImportManager.CreatePartImporter()
partImporter1.FileName = "D:\macro\comp1.prt"
partImporter1.Scale = 1.0
partImporter1.CreateNamedGroup = False
partImporter1.ImportViews = False
partImporter1.ImportCamObjects = False
partImporter1.LayerOption = NXOpen.PartImporter.LayerOptionType.Work
partImporter1.DestinationCoordinateSystemSpecification = NXOpen.PartImporter.DestinationCoordinateSystemSpecificationType.Work
Dim element1 As NXOpen.Matrix3x3
element1.Xx = 1.0
element1.Xy = 0.0
element1.Xz = 0.0
element1.Yx = 0.0
element1.Yy = 1.0
element1.Yz = 0.0
element1.Zx = 0.0
element1.Zy = 0.0
element1.Zz = 1.0
Dim nXMatrix1 As NXOpen.NXMatrix
nXMatrix1 = workPart.NXMatrices.Create(element1)
partImporter1.DestinationCoordinateSystem = nXMatrix1
Dim destinationPoint1 As NXOpen.Point3d = New NXOpen.Point3d(45.0, 41.0, 25.0)
partImporter1.DestinationPoint = destinationPoint1
Dim markId2 As NXOpen.Session.UndoMarkId
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Import Part Commit")
Dim nXObject1 As NXOpen.NXObject
nXObject1 = partImporter1.Commit()
theSession.DeleteUndoMark(markId2, Nothing)
partImporter1.Destroy()

How to open Multiple files at a time in UG NX open Dialog box

$
0
0

Hi All,
The subject says everything,
i would like to open multiple files at a time....in open dialog box by holding CTRL as like in other software,
is there any journal available to replace default OPEN command in UG NX?
Thanks in advance.

Switch Application

$
0
0

Hello guys,

I am creating drawing template and title block through .dll and after completing the process it is remain in Modeling workbench.

After that I want to use some parameter of the drafting but due to Modeling workbench I am not able to use that.

For switching I am using below line code but it is not working.

UI.GetUI.MenuBarManager.ApplicationSwitchRequest("UG_APP_DRAFTING")

Can anyone please help me ?

Browse Load options directly

$
0
0

Hi all,
please go through below code and help me if any changes required to make it work better.

' NX 10.0.1.4' Journal created by gashaik on Mon Apr 25 11:02:33 2016 India Standard Time' Load options browse directly from file 
Option Strict OffImports System
Imports NXOpen
Imports NXOpenUI
Imports System.Windows.Forms 
Module NXJournal
Sub Main (ByVal args()AsString) 
Dim theSession As NXOpen.Session= NXOpen.Session.GetSession()Dim Load1 As NXOpen.Session.UndoMarkIdDim Location1 AsString 
 
Location1 =(NXInputBox.GetInputString("Location:(Please Remove "" Character from location)"))If Location1 =""ThenExitSub 
Load1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Start") 
theSession.SetUndoMarkName(Load1, "Assembly Load Options Dialog") 
theSession.Parts.LoadOptions.Restore(Location1) 
MessageBox.Show(Location1, "Load Location", _
MessageBoxButtons.OK, MessageBoxIcon.Information) 
 
EndSub 
PublicFunction GetUnloadOption(ByVal dummy AsString)AsInteger 
        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination 
    EndFunction 
End Module

Create NX model views for PMI

$
0
0

Is there an existing NX Journal that can create NX model views? We need to generate several model views with specific "PMI" titles. Using NX10.0.3.5 MP1. Thank you.

Point on face attachment activate

$
0
0

How to activate the feature "Point on face", to the center of the dynamic coordinate system was moved along the surface edge?
Journal during recording does not support this button..=(

Not Able to delete Drawing View

$
0
0

Hello Guys,

I am trying to delete DrawingView searching by it's name.
It gets deleted for the first time. But if i will add any base view into drawing then it is not getting deleted.
As an example First i will add the view by Name "A0" then I will add Baseview and after that I will run below code so it will delete the A0 view.
After that I will add the view which name is "A1" and will run the code so at that time it will not delete the A1 view.

Can anyone please help me to solve this issue ?
Below is the code:

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
 
Module Module2
 
     Sub Main()
	 Dim workPart As Part
     Dim displayPart As Part
     Dim theSession As Session
	 Dim DWGName As String
     Dim dwgShtBld As Drawings.DrawingSheetBuilder
	 Dim drawingSheet1 As Drawings.DrawingSheet
 
	    theSession = Session.GetSession()
        workPart = theSession.Parts.Work
        displayPart = theSession.Parts.Display
 
		dwgShtBld = workPart.DrawingSheets.DrawingSheetBuilder(workPart.DrawingSheets.CurrentDrawingSheet)
        drawingSheet1 = workPart.DrawingSheets.CurrentDrawingSheet
        DWGName = drawingSheet1.Name
        dwgShtBld.Commit()
        dwgShtBld.Destroy()
 
		Dim VName As String
		 On Error Resume Next
 
		 If DWGName = "SHEET 1" Then
            For Each View1 As Drawings.DrawingView In drawingSheet1.SheetDraftingViews
                VName = View1.Name
                Dim leftstring As String = VName.ToString().Substring(0, 2)
                If leftstring = "A0" Then
                   DeleteViewByName(VName)
                ElseIf leftstring = "A1" Then
                   DeleteViewByName(VName)
				End if
            Next
		End if
 
		On Error GoTo 0		
	 End Sub
 
	 Sub DeleteViewByName(ByVal Name As String)
            Dim workPart As Part
            Dim displayPart As Part
            Dim theSession As Session
            Dim drawingSheet1 As Drawings.DrawingSheet
 
            theSession = Session.GetSession()
            workPart = theSession.Parts.Work
            displayPart = theSession.Parts.Display
            drawingSheet1 = workPart.DrawingSheets.CurrentDrawingSheet
 
            Dim View As Drawings.DraftingViewCollection = workPart.DraftingViews
            Dim bodyname As String = Name
 
            For Each b As Drawings.DraftingView In View
                If b.Name = bodyname Then
 
                    Dim markId1 As Session.UndoMarkId
                    markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete")
                    Dim notifyOnDelete1 As Boolean
                    notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete
 
                    theSession.UpdateManager.ClearErrorList()
 
                    Dim nErrs1 As Integer
                    nErrs1 = theSession.UpdateManager.AddToDeleteList(b)
                    Dim nErrs2 As Integer
                    nErrs2 = theSession.UpdateManager.DoUpdate(markId1)
 
                End If
            Next
        End Sub
 
End  Module

NXOPEN-CPP

$
0
0

I am just trying to read annotation data from NX file through c++.
Can someone help me out.
I am especially trying for jog details under annotation.
please come out with function, to get jogs details, under annotation.

Please guide me with functions.

Any doubt in my enquiry, please write to me.
karthiktec92@gmail.com

How to Suppress a Dependency

$
0
0

Hello Everyone,

I have a Type Point that appears in the Object Dependency Graph but not in the Part Navigator. I would like to suppress the Type Point but as I try to create a Journal I see that there is no option to suppress the Point. I can see that if I try to suppress another object the suppress command appears right bellow the HIDE option but the command wont appear for the Type Point.

Is there anyway to suppress this Type Point? If I understand things correctly it was created using the SNAP API.

ThroughCurvesBuilder Error

$
0
0

Hi all,
I have been trying create a journal by recording and editing it to create Throughcurves surface.
Steps:
1. Select the first datum plane where the surface starts.
2. Get the use input for number of planes and offset value.
3. Select the dumb surface to be recreated
4. Create section cuts with all the planes.
5. Create through curves surface.

I have the code below. I am getting the error of " invalid feature parameter" at the line feature1 = throughCurvesBuilder1.CommitFeature() . But this is coming from recorded journal. Can some one help me? I am just started to learn coding in NX.

Thanks in advance.
Regards,
Nataraj

' NX 8.5.0.23
' Journal created by Nataraj on Thu Apr 28 17:57:38 2016 India Standard Time
'
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI

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 lw As ListingWindow = theSession.ListingWindow

' ----------------------------------------------
' Menu: Insert->Datum/Point->Datum Plane...
' ----------------------------------------------
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 unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)
Dim expression1 As Expression
expression1 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)
Dim expression2 As Expression
expression2 = workPart.Expressions.CreateSystemExpressionWithUnits("0", unit1)

' ----------------------------------------------
' Getting the First Plane for offset
' ----------------------------------------------

Dim mySelectedObject As NXObject
Dim mySelectedObject1 As NXObject

Dim myoffset As Double = 0
Dim myoffsetnew As Double = 0
Dim mynumplane As Integer = 0
Dim i As Integer

SelectAnObject(mySelectedObject)
mynumplane = NXInputBox.GetInputString("Enter number of planes","Plane Building", "Count")
myoffset = NXInputBox.GetInputString("Enter plane offset values","Plane Building", "Offset")

'lw.Open
'lw.WriteLine("Object Tag: "& mySelectedObject.Tag )
'lw.WriteLine("Object Type: "& mySelectedObject.GetType.ToString)
'lw.WriteLine("Object Tag: "& datumPlane1.GetTitle.ToString)
'lw.WriteLine("")
'lw.Close

SelectSurface(mySelectedObject1)

Dim geom1(0) As NXObject
geom1(0) = mySelectedObject

Dim geom2(0) As NXObject
geom2(0) = mySelectedObject1

' ----------------------------------------------
' Creating a Surface by Through Curve
' ----------------------------------------------
Dim throughCurvesBuilder1 As Features.ThroughCurvesBuilder
throughCurvesBuilder1 = workPart.Features.CreateThroughCurvesBuilder(nullFeatures_Feature)

throughCurvesBuilder1.PreserveShape = False
theSession.SetUndoMarkName(markId1, "Through Curves Dialog")
throughCurvesBuilder1.Alignment.AlignCurve.DistanceTolerance = 0.0254
throughCurvesBuilder1.Alignment.AlignCurve.ChainingTolerance = 0.02413
throughCurvesBuilder1.SectionTemplateString.DistanceTolerance = 0.0254
throughCurvesBuilder1.SectionTemplateString.ChainingTolerance = 0.02413
throughCurvesBuilder1.Alignment.AlignCurve.AngleTolerance = 0.5
throughCurvesBuilder1.SectionTemplateString.AngleTolerance = 0.5
'Dim section1 As Section
'section1 = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5)

For i = 0 To mynumplane-1

' ----------------------------------------------
' Creating the array of planes
' ----------------------------------------------
Dim datumPlaneBuilder1 As Features.DatumPlaneBuilder
datumPlaneBuilder1 = workPart.Features.CreateDatumPlaneBuilder(nullFeatures_Feature)
Dim plane1 As Plane
plane1 = datumPlaneBuilder1.GetPlane()
'theSession.SetUndoMarkName(markId1, "Datum Plane Dialog")
plane1.SetUpdateOption(SmartObject.UpdateOption.WithinModeling)
plane1.SetMethod(PlaneTypes.MethodType.Distance)
plane1.SetGeometry(geom1)
plane1.SetFlip(False)
plane1.SetReverseSide(False)
Dim expressionx As Expression
expressionx = plane1.Expression
myoffsetnew = myoffsetnew + myoffset
expressionx.RightHandSide = myoffsetnew
Dim datumPlaneFeature1 As Features.DatumPlaneFeature = datumPlaneBuilder1.CommitFeature()
Dim datumPlane1 As DatumPlane
datumPlane1 = datumPlaneFeature1.DatumPlane
plane1.RemoveOffsetData()
datumPlaneBuilder1.Destroy()

' ----------------------------------------------
' Creating Section cuts
' ----------------------------------------------
'Dim markId4 As Session.UndoMarkId
'markId4 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim sectionCurveBuilder1 As Features.SectionCurveBuilder
sectionCurveBuilder1 = workPart.Features.CreateSectionCurveBuilder(nullFeatures_Feature)
sectionCurveBuilder1.CurveFitData.Tolerance = 0.0254
sectionCurveBuilder1.CurveFitData.AngleTolerance = 0.5
sectionCurveBuilder1.ChordalTolerance = 0.0254
'theSession.SetUndoMarkName(markId4, "Section Curve Dialog")
Dim added1 As Boolean
added1 = sectionCurveBuilder1.ObjectsToSection.Add(mySelectedObject1)
Dim added2 As Boolean
added2 = sectionCurveBuilder1.SectionPlanes.Add(datumPlane1)
Dim nXObject1 As NXObject
nXObject1 = sectionCurveBuilder1.Commit()
'theSession.DeleteUndoMark(markId6, Nothing)
'theSession.SetUndoMarkName(markId4, "Section Curve")
sectionCurveBuilder1.Destroy()

' ----------------------------------------------
' Creating Surface
' ----------------------------------------------
Dim section1(mynumplane-1) As Section

section1(i) = workPart.Sections.CreateSection(0.02413, 0.0254, 0.5)
throughCurvesBuilder1.SectionsList.Append(section1(i))
section1(i).SetAllowedEntityTypes(Section.AllowTypes.CurvesAndPoints)

Dim features1(0) As Features.Feature
'Dim sectionCurve1 As Features.SectionCurve = CType(workPart.Features.FindObject("SECTION_CURVES(120)"), Features.SectionCurve)
Dim sectionCurve1 As Features.SectionCurve
sectionCurve1 = nXObject1

features1(0) = sectionCurve1
'Dim line1 As Line = CType(sectionCurve1.FindObject("CURVE 1 {3 (-10,-2.3539044875025,50)}"), Line)
section1(i).AllowSelfIntersection(False)

Next

'Dim nXObject2 As NXObject
'nXObject2 = throughCurvesBuilder1.Commit()

Dim markId9 As Session.UndoMarkId
markId9 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Through Curves")

Dim feature1 As Features.Feature
feature1 = throughCurvesBuilder1.CommitFeature()
throughCurvesBuilder1.Destroy()

'theSession.DeleteUndoMark(markId3, Nothing)
theSession.SetUndoMarkName(markId1, "Datum Plane")

Try
' Expression is still in use.
workPart.Expressions.Delete(expression1)
Catch ex As NXException
ex.AssertErrorCode(1050029)
End Try

End Sub

Function SelectAnObject(ByRef selObj As NXObject)
Dim theUI As UI = UI.GetUI
Dim cursor As Point3d
Dim message As String = "Selection"
Dim title As String = "Select The Base Plane"
'Dim selectedObject As NXObject = Nothin
Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
'Dim typeArray() As Selection.SelectionType ={Selection.SelectionType.All}
Dim typeArray As Selection.SelectionType =Selection.SelectionType.All
Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(message, title,scope,False,typeArray,selObj,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 SelectSurface(ByRef selObj As NXObject)
Dim theUI As UI = UI.GetUI
Dim cursor As Point3d
Dim message As String = "Selection"
Dim title As String = "Select The Surface"
'Dim selectedObject As NXObject = Nothin
Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
'Dim typeArray() As Selection.SelectionType ={Selection.SelectionType.All}
Dim typeArray As Selection.SelectionType =Selection.SelectionType.All
Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(message, title,scope,False,typeArray,selObj,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

End Module

Creating a bounding box arround a solid

[NXOpen VB] How to remove parameters of a feature/object

$
0
0

Hello!
I'm new to NXOpen Journals but I have almost reached a good progress on my journal.
Let's assume you want to run a journal inside a part.
The main and only goal of my journal is to generate/create a surface which is the result of an extrusion or in certain cases of a Surface generated with a swept feature. That's all.
My script is organized with a section where you toggle the possibility to create a Datum CSYS, choose its layer, then insert many parameters which will create geometric entities (like points, spline, directions, arcs, helix, all needed to generate the surface), choose if you want to show them, choose again a layer where you will find only the support geometry, then choose the work layer where you will find the final Surface (which is the main function of the journal).

So, this is the workflow:

1. Datum (Yes/No) and its layer ---> Done;
2. Geometry and its layer ---> Almost done;
3. Surface (Extrusion on Z direction or made with a swept) ---> Almost done.
4. Starting with a new part (empty), on the Part Navigator I want to see only the Datum CSYS and the Body which represents the Surface. Other entities are without parameters, so they are not listed on the Part Navigator panel.

My question is this one: is there a way to remove parameters of helix, extrusion, swept function?
I would like to have a journal which does not need to "scan" or search for determined object on a layer or certain function listen on a "For Each" loop.
Still today I'm not finding the solution... :(

For example (hiding parameters lines), the following code generates a Swept feature on the Part Navigator. If I manually remove the feature parameters, I obtain a Body on the Part Navigator. I'm trying to get this automatic with the journal.

Dim sweptBuilder As NXOpen.Features.SweptBuilder
Dim nullNXOpen_Features_swept As NXOpen.Features.Swept = Nothing
sweptBuilder = workPart.Features.CreateSweptBuilder(nullNXOpen_Features_swept)
Dim swept_surf As NXOpen.Features.Swept
swept_surf = sweptBuilder.CommitFeature()
sweptBuilder.Destroy()

I hope someone could help me.
Best regards,

kalo86

Viewing all 783 articles
Browse latest View live


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