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

Activate copy thread in all visible Extract

$
0
0

Hello
Am new in NX journalling, I have some 2000 extracted bodies .Copy thread option is forgot to click while extracting those bodies . Now I want to activate that copy thread in all extract using for loop. Please help me

thanks i advance
Dipin


How to make note unpickable

OuterMost Of Surface

Batch file to run Journal File

$
0
0

Hello,

Wish you a happy New Year.

I have come across the journal file (Export Drawing To .Dxf File Using NX Journal) which creates DXF file from NX drawing sheet, which is very good and saves a lot of time.

So I am just curious to know if we can run the same Journal file without opening NX and run it through windows batch file.

Please let me know if there is any possibility to do this request?

Thank you very much

Best Regards,
Praveen

clear all selections

$
0
0

Hy all together,

i have a maybe simple problem.

How can i clear all selections?

I tried it with theui.selectionmanager but dind`t get what i whant.

Can somebody help please.

Hagen

Problem with System.InvalidCastExceptio NX 11 Journal

$
0
0

Hi, I have problem with NX 11 Journal.

Journal worked perfectly in NX 10
When I run the Journal in NX 11 I get the following message:

"System.InvalidCastExceptio: Das Objekt Des Typs "NXOpen.BasePart[]" kann nicht in Typ "NXOpen.PArt[]" umgewendelt werden."

Journal reads atribude of the Parts, and lists them in the Info window.

Does anyone have a suggestion what to change in the code?

----------------------------------------

" & a1  )
'end if
 
 
        Next
lw.Open
        lw.WriteLine("=====================================================================================")
 
 
 
 
 
        lw.WriteLine("Assembly parts found:" & assyParts.Count.ToString())
 
 
 
 
 
        For inx As Integer = 0 To assyParts.Count - 1
            Dim aPart As NXOpen.Part = assyParts(inx)
            'lw.WriteLine(inx.ToString() & ".  Original: " & aPart.FullPath())
            Dim newPath As String = _
                aPart.FullPath.Insert(aPart.FullPath.LastIndexOf("\"), _
                "\NewDirectory")
            'lw.WriteLine("    Saving As: " & newPath)
            Dim pathOnly As String = Microsoft.VisualBasic.Left(newPath, _
                                                  newPath.LastIndexOf("\"))
 
            'If My.Computer.FileSystem.DirectoryExists(pathOnly) = False Then
             '   My.Computer.FileSystem.CreateDirectory(pathOnly)
            'End If
 
Dim words As String() = assyParts(inx).FullPath.Split("\")
 
Dim words01 As String() = words(words.Length-1).Split(".")
 
Dim assemblyNom as String =aPart.GetStringAttribute("NOMENCLATURE")
 
            Dim saveStatus As PartSaveStatus = Nothing
          '  saveStatus = aPart.SaveAs("D:\Pregled_NX\assemblyy" & inx.ToString)
 
 
lw.Open
 
lw.WriteLine(words(words.Length-1) & " ==> " & assemblyNom  )
 
       ' lw.WriteLine("partoviStari(" & inx & ")=(*" & words01(0) & "*)" )
 ' lw.WriteLine("partoviNovi(" & inx & ")=(*" & assemblyNom & "*)")
 
 
 
 
If words(words.Length-1).Contains("M") Then
 
slovoM=slovoM+1
 
End if
 
 
If words(words.Length-1).Contains("S") Then
 
slovoS=slovoS+1
 
End if
 
If words(words.Length-1).Contains("B") Then
 
slovoB=slovoB+1
 
End if
 
If words(words.Length-1).Contains("X") Then
 
slovoX=slovoX+1
 
End if
 
If words(words.Length-1).Contains("K") Then
 
slovoK=slovoK+1
 
End if
 
If words(words.Length-1).Contains("E") Then
 
slovoE=slovoE+1
 
End if
 
 
 
 
 
 
        Next
lw.Open
     lw.WriteLine("======================================================")
lw.WriteLine("M= " & slovoM.ToString)
lw.WriteLine("S= " & slovoS.ToString)
lw.WriteLine("B= " & slovoB.ToString)
lw.WriteLine("X= " & slovoX.ToString)
lw.WriteLine("K= " & slovoK.ToString)
lw.WriteLine("E= " & slovoE.ToString)
lw.WriteLine("Dodati +1 za citav product)
 
 
 
    End Sub
 
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        Return Session.LibraryUnloadOption.Immediately
    End Function
 
End Module>
 
 
Picture of error:
<a href="http://imgur.com/a/7WLvy

">http://imgur.com/a/7WLvy[/geshifilter-code]

Extracted faces selection and break mode debugging

$
0
0

Hi, I want to select the extracted faces of a part to change the display and also to change on which layer they are on. The problem is the selection of the extracted face.

When recording the journal, it gives the following:

Dim objects1(0) As NXOpen.DisplayableObject
Dim body1 As NXOpen.Body = CType(workPart.Bodies.FindObject("EXTRACT_FACE(53)"), NXOpen.Body)

objects1(0) = body1
displayModification1.Apply(objects1)

But I need to pass the name of the extracted face to that and additionnally I want to make a loop to find all the extracted face of the part to do the same with all of them.

Can someone tell me what's wrong in it:
' Features to select
Dim feat As Feature
Dim featColl As FeatureCollection = workPart.Features
Dim classType As String = Nothing
Dim featType As String = Nothing
Dim IndexFace As Integer = 0
Dim FaceNameArray() As String

Dim objects1(IndexFace) As NXOpen.DisplayableObject

For Each feat In featColl
featType = feat.FeatureType
classType = feat.GetType().FullName

If featType = "Extracted Face" Then
'report_feature_info(feat)
FaceNameArray(IndexFace) = feat.GetFeatureName()
Dim body1 As NXOpen.Body = CType(workPart.Bodies.FindObject(FaceNameArray(IndexFace)), NXOpen.Body)
objects1(IndexFace) = body1
IndexFace = IndexFace + 1
End If
Next

It looks like FaceNameArray(IndexFace) return a Null value so I do not build anny array with it.

In a more general way, is there a way to find all the attributes of NX classes and all properties that apply to them; it is very tedious work to "guess" how NX developpers did work while programing that. Also, is there a way to run journal in a break mode and have some break points and spy on the intermediate results to debug those programs?

Best regards

HOW TO GETPROJECTIONPLANE AND GETPROJECTIONPLANENORMAL

$
0
0

Hi,

i am trying to get projectionplanenormal and projectionplane of drawingview.

There is a way in catia to get it as mentioned in below code.

DrawingView.GenerativeBehavior.GetProjectionPlaneNormal Xn, Yn, Zn
DrawingView.GenerativeBehavior.GetProjectionPlane x(1), Y(1), Z(1), x(2), Y(2),Z(2)

Is there any equivalent method in NX to get it?


How to rename a component inside an assembly using NX Journel

$
0
0

I have an assembly xxx and parts as 12,13,14. I would like to run a journal to replace the parts with different name as 12 to 15 ,13 to 16 and so on.
It would be great if have an journal for it.
Also it would be better if you could write a program which can read the existing parts (12,13,14...) from a text or Excel file and rename with (15,16,17...)from the same same text or excel file.

Select All Suppressed Components and Delete

$
0
0

Hello all,

I'm currently searching for a way to automatically select and then delete all suppressed components in an assembly. The suppressed components can change so selecting components by name is not an option. There are suppressed components at the main assembly level and in some sub-assemblies.
Thanks!

Replacing Text in a Table with Formatted text

$
0
0

Hello All,

So I am working on a bit of script to replace cells in my tables with new information. It looks for the thing I want to replace and replaces it with new text. I have managed to do this part.

The problem I am having is that when I am writing the code, I would like to have the option to add a newline into the cell. I want to do this when I put in the new string, but when I use \n or \r it just exports "\r".

Is there a way to do this other than having some code which looks for that character in the string I say I want to replace, separates the code, and then adds the newline and the 2 different string to the write to cell?

' ------------------------------------------------------------------------------------------------------------' NX 8.5.2.3' Replace Cell Text' Created 13 Jan 2017' ------------------------------------------------------------------------------------------------------------ 
Option Strict Off
Imports System
Imports System.Collections.GenericImports NXOpen
Imports NXOpenUI
Imports NXOpen.UF 
 
Module Label_Information_Extraction
 
	'--------------------------------------' Sets up the NX session'-------------------------------------- 
	Dim theSession As Session = Session.GetSession()Dim theUISession As UI = UI.GetUIDim theUfSession As UFSession = UFSession.GetUFSession()Dim workPart As Part = theSession.Parts.Work 
	Sub Main() 
		'--------------------------------------' Opens the Listing Window'-------------------------------------- 
		Dim lw As ListingWindow = theSession.ListingWindow
		lw.Open()Dim OldText AsString=""Dim NewText AsString=""Dim NewText2 AsString=""Dim NumberOfReplacements AsInteger=0 
		OldText = NXInputBox.GetInputString("Input the String you would like to replace:", "Table Text Replacement")
		NewText = NXInputBox.GetInputString("Input the String you would like to the old text with:", "Table Text Replacement")
		NewText2 = NXInputBox.GetInputString("Input the String you would like to the old text with:", "Table Text Replacement") 
		lw.WriteLine("You would like to replace: "& OldText &" with: "& NewText &".") 
		If NewText !=""Then
			FindTabularNotes(lw, OldText, NewText, NewText2, NumberOfReplacements)Else
			lw.WriteLine("You did not insert Text, if you want to replace please run again")EndIf 
		lw.WriteLine("We found and replaced: "& NumberOfReplacements.ToString()&" occurances of "& OldText &" with: "& NewText &".") 
 
	EndSub 
	Sub FindTabularNotes(lw As ListingWindow, OldText AsString, NewText AsString, NewText2 AsString, ByRef numreplaced AsInteger) 
		Dim tmpTabNote As NXOpen.Tag= NXOpen.Tag.NullDim NxType AsIntegerDim NxSubtype AsIntegerDim tmpTabNoteObj as displayableObject
		Dim numTables AsInteger=0 
		Do
			theUfSession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote) 
			If tmpTabNote <> NXOpen.Tag.NullThen 
				theUfSession.Obj.AskTypeAndSubtype(tmpTabNote, NxType, NxSubtype) 
				If NxSubtype = UFConstants.UF_tabular_note_subtypeThen 
					'Now we need to search for text
					FindReplaceText(tmpTabNote, lw, OldText, NewText, NewText2 , numreplaced)
					numTables +=1 
				EndIf 
			EndIf 
		Loop Until tmpTabNote = NXOpen.Tag.Null 
	EndSub 
 
	Sub FindReplaceText(tmpTabNote As Tag, lw As ListingWindow, OldText AsString, NewText AsString, NewText2 AsString, ByRef numreplaced AsInteger) 
		Dim rowTag As Tag =NothingDim colTag As Tag =NothingDim numRows AsInteger=0Dim numCols AsInteger=0Dim cellText AsString=""Dim NewCellText AsString=""Dim cellTag As Tag =Nothing 
		theUfSession.Tabnot.AskNmColumns(tmpTabNote , numCols)
		theUfSession.Tabnot.AskNmRows(tmpTabNote , numRows) 
		For y AsInteger=0To numRows-1 
			For x AsInteger=0To numCols-1 
 
				theUfSession.Tabnot.AskNthRow(tmpTabNote , y, rowTag)
				theUfSession.Tabnot.AskNthColumn(tmpTabNote , x, colTag)
				theUfSession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)
				theUfSession.Tabnot.AskCellText(cellTag, cellText) 
				If celltext.Contains(OldText)Then
					numreplaced +=1
					NewCellText = celltext.Replace(OldText, NewText)If NewText2 !=""Then
						theUfSession.Tabnot.SetCellText(cellTag, NewCellText & vbLf & NewText2)Else
						theUfSession.Tabnot.SetCellText(cellTag, NewCellText)EndIfEndIf 
			Next 
		Next 
	EndSub 
EndModule

Interactive selection function with Smart Selection, Method connected edges

$
0
0

Hello All

I need to use "connected edge" method which is a smart selection. This option is available when you are using Simple Radiation to Environment BC in simulation. I want to have a function which stores all the user selected edges in a NxObject().

I know that Selection.SelectionType will give me the Type filter (Polygon Edge).
Is there anything similar which will let me access the Method "connected edges"?.

I have looked at CAE.SmartSelectionManager but i am unable to figure this out. I had used something like this earlier to store user selected features.

Function SelectObjectsL0(promptL0 As String, ByRef selObjL0 As NXObject()) As Selection.Response
 
Dim theUIL0 As UI = UI.GetUI
 
Dim typeArrayL0() As Selection.SelectionType = {Selection.SelectionType.Body}
 
Dim respL0 As Selection.Response = theUIL0.SelectionManager.SelectObjects(promptL0, "Select Solid Bodies for Linking", Selection.SelectionScope.AnyInAssembly, False, typeArrayL0, selObjL0)
 
 
 
If respL0 = Selection.Response.ObjectSelected Or
 
respL0 = Selection.Response.ObjectSelectedByName Or
 
respL0 = Selection.Response.Ok Then
 
Return Selection.Response.Ok
 
Else
 
Return Selection.Response.Cancel
 
End If
 
End Function

Need to trigger a dll when user changes the module. From NX Modeling to File->All Applications->mechanical Routing

$
0
0

Hi, I'm trying to trigger a code when user switches the application module. For example, user is in NX modeling and changes the module form File->All applications->Mechanical routing. Right after opening Mechanical Routing, I want my code to be triggered. Please let me know any mechanism to achieve the same. Thanks in advance.

How to delete all content in a particular layer

$
0
0

Hello NXJournaling,

Could you please let me know, how to delete all the contents in the layers which are not visible or clubbed with other layers?

Is there any possibility to have the Journal to do this task?

Thank you very much.

Best Regards,
Praveen

Part History

$
0
0

Hello

Is it possible, by using OPEN NX, to get the Part History Information.
I have a part 222222.prt; this part is a 'save as ' from the part 111111.prt (this information is available though the UG Part History List)

Is it possible to get this information using OPEN NX code in order to know from which part number a part has been saved as.

Fab


Revolve confirmation issue

$
0
0

Hello All,
I’d like to share my problem with you and hopefully will find some help. I’ve written an application which simulates manufacturing of bevel gears based on Boolean’s operations. After simulation I receive some number of “microsurfaces” representing a teeth spacing. In the next step the program needs to cut received microsurfaces by a tool created by revolve operation (sheet feature). I’ve notice an issue when a number of “microsurfaces” is high, then the NX cannot confirm a revolve feature (only such error occurs: “System.NullReferenceException” which says me nothing. When this number is low the revolve feature can be confirmed without any error. Below you can find a code. Anybody have an idea what is wrong here? Do you think that memory is overloaded? Do I have any command enables to release it?
Thank you in advance for your help,
Pawel

The code:

int licz1 =0; 
Section section1;
SelectionIntentRule[] rules1 =new SelectionIntentRule[1];
NXObject feature_revolve1 =null;
NXOpen.Features.RevolveBuilder revolveBuilder1 =null; 
double IncZ =((B +2* naddatek)/(inter_number-1)); 
 
    while(licz1 <10){
        point3d1.X=0;
        point3d1.Y=0.5;
        point3d1.Z= offsetIN + Z1DIA +(IncZ * Math.Cos(sigma1 *(Math.PI/180)))* licz; 
        point3d2.X=0;
        point3d2.Y= Y1DIA +(4* Math.Cos(sigma1 *(Math.PI/180)))+((IncZ)* Math.Sin(sigma1 *(Math.PI/180))+(0)* Math.Cos(sigma1 *(Math.PI/180)))* licz; 
        point3d2.Z= offsetIN -(4* Math.Sin(sigma1 *(Math.PI/180)))+((IncZ)* Math.Cos(sigma1 *(Math.PI/180))-(0)* Math.Sin(sigma1 *(Math.PI/180)))* licz; 
 
 
        Vector3d vector3d1 =new Vector3d(0, 0, 1);
        Point point1 = displayPart.Points.CreatePoint(point3d1);
        Point point2 = displayPart.Points.CreatePoint(point3d2); 
        //Line definition
        Curve[] linia =new Curve[1];
        linia[0]= displayPart.Curves.CreateLine(point1, point2);
        NXObject nxObject1;
        nxObject1 = linia[0]; 
        Point3d pointZero =new Point3d(0, 0, 0); 
        Direction direction1;
        direction1 = displayPart.Directions.CreateDirection(pointZero, vector3d1, NXOpen.SmartObject.UpdateOption.WithinModeling); 
        //Axis creation
        Point nullPoint =null;
        Axis axis1;
        axis1 = displayPart.Axes.CreateAxis(nullPoint, direction1, SmartObject.UpdateOption.WithinModeling); 
        //RevolveBulidier 
        NXOpen.Features.Feature nullFeature1 =null;
        revolveBuilder1 = displayPart.Features.CreateRevolveBuilder(nullFeature1); 
        //Section 
        section1 = displayPart.Sections.CreateSection(0.02, 0.02, 0.02); 
        revolveBuilder1.Section= section1;
        revolveBuilder1.Axis= axis1;
        revolveBuilder1.Tolerance=0.02;
        section1.DistanceTolerance=0.02;
        section1.ChainingTolerance=0.02; 
        //Line assignment
        CurveDumbRule curveDumbRule1;
        curveDumbRule1 = displayPart.ScRuleFactory.CreateRuleCurveDumb(linia); 
        section1.AllowSelfIntersection(true); 
 
        rules1[0]= curveDumbRule1;
        NXObject nullNXObject =null; 
        //Selection
        section1.AddToSection(rules1, nxObject1, nullNXObject, nullNXObject, point3d1, NXOpen.Section.Mode.Create, false); 
 
        revolveBuilder1.Axis= axis1; 
        //Sheet Body selection
        revolveBuilder1.FeatureOptions.BodyType= NXOpen.GeometricUtilities.FeatureOptions.BodyStyle.Sheet;
        revolveBuilder1.Section= section1; 
        //Ustawienia
        revolveBuilder1.Limits.StartExtend.Value.RightHandSide="0";
        revolveBuilder1.Limits.EndExtend.Value.RightHandSide="360";
        revolveBuilder1.ParentFeatureInternal=false; 
        licz1++; 
        try{
            feature_revolve1 = revolveBuilder1.CommitFeature();}catch{continue;} 
        break;};

How to move a component

$
0
0

Hi
I have an assembly and sub assembly file.
How will write a code to it to move the sub assembly by 100,100,0 in X,Y,Z coordinates.

Any help please!!!

NX UG drawing sheet to pdf

Delete Expression

centerline trim

$
0
0

Hi,

i have centerline that is intersecting(eg:L or U shape pipe), i have to remove(delete) the portion of centerline which is not required or of no use.

Thanks

Viewing all 783 articles
Browse latest View live


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