Hello,
There are surfaces in the part. Some of them are adjacent to eachother. Any idea to find and list (maybe tag) those adjacent faces?
Thanks
Hello,
There are surfaces in the part. Some of them are adjacent to eachother. Any idea to find and list (maybe tag) those adjacent faces?
Thanks
Hello,
There are surfaces in the part. Some of them are adjacent to eachother. Any idea to find and list (maybe tag) those adjacent faces?
Thanks
hello there,
Can I select a symbol on the drafting page and enclose it in parentheses? I would like to enclose the datum symbols in parentheses to indicate that I want to be a reference.
Hi,
UF_DRF_ask_dim_info is function returning all dimension info
Information like text info, line info, arc info, and arrow info are obtained.
In which I need to get arc_info through C++.
I mean, data from UF_DRF_arc_info are need to be fetched in C++.
Can any one suggest.
Thanks
Hi all!
I want to make question dialog with two buttons, that have custom labels: "Electrical port" and "Mechanical port". I have tried to use UF_UI MessageDialog Method, but it looks like i doing somthing totally wrong, because NX dose not show any dialog window, but i see message "building file selection dialog" at the bottom of the NX window. It is my code below, could you help me?
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UFImports NXOpenUI Imports System.Runtime.InteropServices Module NXJournal Public theSession As Session = Session.GetSession()Public ufs As UFSession = UFSession.GetUFSession()Public lw As ListingWindow = theSession.ListingWindow Sub Main() Dim resp AsIntegerDim messages(0)AsString messages(0)="What type of port is highlighted"Dim but As UFUi.MessageButtons but.button1=True but.label1="Electrical port" but.response1=1 but.button2=True but.label2="Mechanical port" but.button3=False but.response1=2 MessDi("", UiMessageDialogType.UiMessageInformation, messages, 1, True, but, resp) lw.Open() lw.WriteLine("resp= "& resp) EndSub PublicSub MessDi( _ ByVal title_string AsString, _ ByVal dialog_type As UiMessageDialogType, _ ByVal messages AsString(), _ ByVal num_messages AsInteger, _ ByVal translate AsBoolean, _ ByRef buttons As UFUi.MessageButtons, _ <OutAttribute()>ByRef response AsInteger _ )EndSub PublicFunction GetUnloadOption(ByVal dummy AsString)AsInteger GetUnloadOption = NXOpen.Session.LibraryUnloadOption.ImmediatelyEndFunction EndModule
Hi
When the nxmanager open part dialog is open
I can right click a part and choose copy
and then in the same nxmanager opened dialog
I can brows to a folder and right click the
folder and choose paste, and the part-link
is copied in that folder.
Do someone can help in the nx api that
do the equivalent of this.
I'm thank you a lot.
Hello,
I have some bodies(faces),sew and revolved surfaces mixed in the part navigator. There is also a ref revolved surface which will be used as tool in trimming op.
Some of them are intersecting the tool. What I want to do is running a loop which asks each bodies in the part and each faces belong to the bodies respectively and try to be trimmed by the tool. If the loop meets the nonintersecting faces then it will jump simply with "on error resume next"
But there is a problem with the code. It finds some tag belongs to faces but the tags are invalid error that I am getting although I used ufs.modl.askfeatbody(..... , ......)
Where am I wrong?
I have a script which pause while it shows a message box.
MsgBox("Continue?")
But after a second it also shows the "Work in Progress" dialog with a Stop button.
Everything works well if I don't touch the Stop button.
But if I hit Stop the script fails.
How can I avoid this?
BR Gunnar
This is an edit of the example from Convert Part Units Submitted by NXJournaling.
Because I am not experienced, I ran in to some issues, but solved.
You can respond and clean up this code so it is better.
Option Strict Off ' NX 10' Date: 4/23/2018' Subject: UGPC Utility to Listing WindowImports System Imports System.DiagnosticsImports NXOpen Imports NXOpen.UFImports NXOpen.UIImports NXOpen.Utilities Module startup Public theSession As Session = Session.GetSession()Public ufs As UFSession = UFSession.GetUFSession()Public lw As ListingWindow = theSession.ListingWindowPublic theUISession As UI = UI.GetUIPublic workPart As Part = theSession.Parts.WorkPublic partPath AsString= workPart.FullPathPublic partName AsString= System.IO.Path.GetFileName(partPath)Public copyPart AsString= System.IO.Path.Combine(System.IO.Path.GetTempPath, partName)Public response AsInteger Sub Main() Dim rm As RemoteUtilities = RemoteUtilities.GetRemoteUtilities() Dim baseDir AsString= Environment.GetEnvironmentVariable("UGII_BASE_DIR")' lw.WriteLine("UGII_BASE_DIR = " & baseDir)Dim lw As ListingWindow = theSession.ListingWindow lw.Open()'Utility to run'Dim UtilityUGPC As String = baseDir & "\" & "ugpc.exe"Dim UtilityUGPC AsString= baseDir &"\NXBIN\"&"ugpc.exe"Dim unitArg AsString="-s" unitArg =" "& unitArg &" " IsPrtMod() ' ----------- Use the Remote Utility ------------Dim utilitySuccess AsBoolean=FalseTry Dim utilityProcess AsNew Process Dim myStartInfo AsNew ProcessStartInfo myStartInfo.UseShellExecute=False myStartInfo.CreateNoWindow=True' The command myStartInfo.FileName=""""& UtilityUGPC &""""& unitArg &""""& partPath &"""" myStartInfo.RedirectStandardOutput=True myStartInfo.RedirectStandardError=True 'test lw.WriteLine("Running: "&myStartInfo.FileName) utilityProcess.StartInfo= myStartInfo utilityProcess.Start() Dim std_out As IO.StreamReader= utilityProcess.StandardOutput()Dim std_err As IO.StreamReader= utilityProcess.StandardError() Dim stdOutput AsString= std_out.ReadToEndDim stdLines()AsString= stdOutput.Split(ControlChars.CrLf) ForEach Line AsStringIn stdLines If Line.ToUpper.Contains("SUCCESS")Then utilitySuccess =TrueEndIf' To Listing WindowIf Line IsNotNothingThen Line = Line.Replace(vbCr, "").Replace(vbLf, "")' removing return character lw.WriteLine(Line)ElseEndIfNext Dim stdError AsString= std_err.ReadToEndIfNotString.IsNullOrEmpty(stdError)Then lw.WriteLine("") lw.WriteLine("stdErr:")ForEach Line AsStringIn stdError lw.WriteLine(Line)NextEndIf std_out.Close() std_err.Close() utilityProcess.Close() Catch ex As Exception lw.WriteLine("Error with ug_convert_part.exe") lw.WriteLine(ex.GetType.ToString&" : "& ex.Message) EndTry EndSub '----------------------------------- Function ----------------------------------------PublicFunction IsPrtMod() Dim messages(4)AsString messages(0)="The part, "& partName &" shows that it is modified and" messages(1)="is not saved locally for this function:" messages(2)=" " messages(3)=" Would you like to save the current work part?" messages(4)=" " If ufs.Part.IsModified(workPart.Tag)Then response = theUISession.NXMessageBox.Show("Save current changes?", theUISession.NXMessageBox.DialogType.Question, messages) If response =1Then'saveDim partSaveStatus1 As PartSaveStatus partSaveStatus1 = workPart.Save(BasePart.SaveComponents.True, BasePart.CloseAfterSave.False) partSaveStatus1.Dispose()' workPart.Close(BasePart.CloseWholeTree.True, BasePart.CloseModified.UseResponses, Nothing)' workPart = Nothing Else EndIf Else EndIf EndFunction '------------------------------------------------------------------------------------- '----------------------------------- Function ----------------------------------------PublicFunction GetUnloadOption(ByVal dummy AsString)AsInteger Return Session.LibraryUnloadOption.Immediately EndFunction'------------------------------------------------------------------------------------- EndModule
Hi, I am wondering if you could help me with a problem I have?
I am trying to Highlight all Positioning constraints which meet my criteria. How can I do that?
I tried with something like this. (Part of the code)
Dim myConstraints() As Positioning.Constraint = theSession.Parts.Work.ComponentAssembly.Positioner.Constraints.ToArray() For Each thisConstraint As Positioning.Constraint In myConstraints constraintstringtocheck = (thisConstraint.Name.ToString()) If «criteria met» Then thisConstraint.Highlight() ‘Highlight the Constraint in Constraint Navigator End If Next
Hello! I have a solution for creating a single bar, but I want to find a solution to create a multi-bar. I need to find the nodes using the facet body. Facet body is a rivet or a bolt. I have a nodes on the middle surface and these nodes are interconnected by bars. Within the body there are two nodes (one node per surface). Many bodies and they are randomly located. How to find nodes inside faceted bodies?
Thanks!
Hi!
I have a part with multiple parameters and would like export different variants of it in stl format, with the filenames of the parameter values concatenated. I try to do it with nested for loops. I could not figure out how the stl export should work. Any help would be appreciated.
Thanks,
Máté
' NX 10.0.3.5
'
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
theSession.Preferences.Modeling.UpdatePending = False
Dim markId1 As NXOpen.Session.UndoMarkId
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Expression")
For i As Double = 120 To 240 Step 30
For j As Double = 1.5 To 3.5 Step 0.5
Dim expression1 As NXOpen.Expression = CType(workPart.Expressions.FindObject("p102"), NXOpen.Expression)
Dim unit1 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)
workPart.Expressions.EditWithUnits(expression1, unit1, i)
Dim expression2 As NXOpen.Expression = CType(workPart.Expressions.FindObject("p103"), NXOpen.Expression)
Dim unit2 As NXOpen.Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), NXOpen.Unit)
workPart.Expressions.EditWithUnits(expression2, unit2, j)
theSession.Preferences.Modeling.UpdatePending = True
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)
Next j
Next i
End Sub
End Module
Hello,
I am using Nx8.5 and I have some troubles on revolving of lines. I both followed Nxopen manual and recorded journal.
Due to having trouble with this line of code,
Dim r1 As NXOpen.CurveDumbRule = workPart.ScRuleFactory.CreateRuleBaseCurveDumb({c1})
I had to switch to get help from a recorded journal:
curveDumbRule1 = workPart.ScRuleFactory.CreateRuleCurveDumb(curves1)
But having troubles at commit. No section curve or point created error I get.
I could not resolve it.
Thanks
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text.RegularExpressions
Imports NXOpen
Imports NXOpen.UF
Imports System.IO
Imports System.IO.Directory
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Text
Imports System.Diagnostics
Imports System.Collections
Imports NXOpen.Assemblies
Imports NXOpen.Utilities
Imports NXOpen.Features
Module revolvesolid
Sub Main()
Dim line1 As Tag = "33595"' these will be comming from another loop.
Dim line2 As Tag = "33539"
Dim line3 As Tag = "33573"
Dim line4 As Tag = "33594"
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
Dim ctol = 0.0095 ' Chaining tolerance
Dim dtol = 0.01 ' Distance tolerance
Dim atol = 0.5 ' Angle tolerance
Dim rect As NXOpen.Section = workPart.Sections.CreateSection(ctol, dtol, atol)
Dim section1 As NXOpen.Section = workPart.Sections.CreateSection(ctol, dtol, atol)
Dim helpPoint As New NXOpen.Point3d(0, 0, 0)
Dim helpPoint1 As New NXOpen.Point3d(0, 0, 0)
Dim nullObj As NXOpen.NXObject = Nothing
Dim noChain As Boolean = False
Dim createMode As NXOpen.Section.Mode = Section.Mode.Create
Dim curves1(3) As Curve
Dim c1 As Line = ObjectFromTag(line1)
Dim c2 As Line = ObjectFromTag(line2)
Dim c3 As Line = ObjectFromTag(line3)
Dim c4 As Line = ObjectFromTag(line4)
curves1(0) = c1
curves1(1) = c2
curves1(2) = c3
curves1(3) = c4
section1.AllowSelfIntersection(False)
Dim curveDumbRule1 As CurveDumbRule
'curveDumbRule1 = workPart.ScRuleFactory.CreateRuleCurveDumb(curves1)
curveDumbRule1 = workPart.ScRuleFactory.CreateRuleCurveDumb(curves1)
Dim rules1(0) As SelectionIntentRule
rules1(0) = curveDumbRule1
Dim nullNXObject As NXObject = Nothing
rect.AddToSection(rules1, c1, nullObj, nullObj, helpPoint, createMode, noChain)
rect.AddToSection(rules1, c2, nullObj, nullObj, helpPoint, createMode, noChain)
rect.AddToSection(rules1, c3, nullObj, nullObj, helpPoint, createMode, noChain)
rect.AddToSection(rules1, c4, nullObj, nullObj, helpPoint, createMode, noChain)
Dim builder = workPart.Features.CreateRevolveBuilder(Nothing)
Dim axisPoint3d As New NXOpen.Point3d(0, 0, 0)
Dim axisVector As New NXOpen.Vector3d(1, 0, 0)
Dim updateOption = SmartObject.UpdateOption.WithinModeling
Dim direction = workPart.Directions.CreateDirection(axisPoint3d, axisVector, updateOption)
Dim axisPoint As NXOpen.Point = workPart.Points.CreatePoint(axisPoint3d)
builder.Axis = workPart.Axes.CreateAxis(axisPoint, direction, updateOption)
builder.Limits.StartExtend.Value.RightHandSide = "0"
builder.Limits.EndExtend.Value.RightHandSide = "180"
Dim revolveFeature As NXOpen.Features.Revolve = builder.CommitFeature
builder.Destroy()
End Sub
Public Function ObjectFromTag(tag As NXOpen.Tag) As NXOpen.NXObject
Dim obj As NXOpen.TaggedObject = NXOpen.Utilities.NXObjectManager.Get(tag)
Dim nxObject As NXOpen.NXObject = CType(obj, NXOpen.NXObject)
Return nxObject
End Function
End Module
Hello,
Is there anyone could share an example about undo mark? I am going to create a trim and according to trim direction the mass will be changed. Whichone will result in the least mass measured then the flip trim direction will work for getting this.
Thanks
Hello,
We have engineers who wants to open an Excel file while they are working in NX. Is it possible to open an external Excel sheet with a journal?
Best Regards
Thijs Janssen
Hi,
I need to read sweep feature. I have created a simple sweep using "Sweep along guide" option in NX. Now sweep parameter can be read using "UF_MODL_ask_sweep_parms".
But, I need orientation , guide, section, alignment, scaling which is available at "UF_MODL_ask_sweep". kindly, come out with the syntax that is working to read above said option. Syntax in C++ style is also welcome. Pls, come up with full syntax for "UF_MODL_ask_sweep" which is working.
Waiting for your valuable reply.
Thank you.
Hi,
In the following code I tried to create point and axis after selecting with block styler
But I have a problem to terminate the 2 lines above
Dim thePoint As Point = s.Parts.Work.Points.CreatePoint(
Dim revolve_axis As Axis = s.Parts.Work.Axes.CreateAxis(
Thanks in advance
Regards
Didier
___________________________________________________________
Option Strict Off Imports NXOpen Imports NXOpen.BlockStyler Public Class Dialog Private Shared s As Session Private Shared theUI As UI Private theDlxFileName As String = "axis_and_point.dlx" Private theDialog As BlockStyler.BlockDialog Private block_axe As NXOpen.BlockStyler.SpecifyAxis ' Dim propList As PropertyList = Nothing Public Sub New() Try s = Session.GetSession() theUI = UI.GetUI() theDialog = theUI.CreateDialog(theDlxFileName) theDialog.AddApplyHandler(AddressOf apply_cb) theDialog.AddInitializeHandler(AddressOf initialize_cb) theDialog.AddDialogShownHandler(AddressOf dialogShown_cb) theDialog.AddUpdateHandler(AddressOf update_cb) theDialog.AddOkHandler(AddressOf ok_cb) Catch ex As Exception Throw ex End Try End Sub Public Sub initialize_cb() Try Catch ex As Exception theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try End Sub Public Sub dialogShown_cb() Try Catch ex As Exception theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try End Sub Public Sub Show() Try theDialog.Show() block_axe = theDialog.TopBlock.FindBlock("axis0") Catch ex As Exception theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try End Sub Public Sub Dispose() If theDialog IsNot Nothing Then theDialog.Dispose() theDialog = Nothing End If End Sub Public Function update_cb(ByVal block As UIBlock) As Integer Dim propList As PropertyList = Nothing Try Catch ex As Exception theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try update_cb = 0 End Function Public Function apply_cb() As Integer Dim errorCode As Integer = 0 Try Catch ex As Exception errorCode = 1 theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try apply_cb = errorCode End Function Public Function ok_cb() As Integer Dim errorCode as Integer = 0 Try propList = block_axe.GetProperties Dim thePoint As Point = s.Parts.Work.Points.CreatePoint( Dim revolve_axis As Axis = s.Parts.Work.Axes.CreateAxis( Catch ex As Exception errorCode = 1 theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString) End Try ok_cb = errorCode End Function End Class
I have created a block styler in NX, with Vb.net code generated.
I got these thing in code generated.
Private Shared theSession As Session
Private Shared theUI As UI
Private theDlxFileName As String
Private theDialog As NXOpen.BlockStyler.BlockDialog
Private group0 As NXOpen.BlockStyler.Group' Block type: Group
Private string0 As NXOpen.BlockStyler.StringBlock' Block type: String
now i need to read the "string" entered in UI , and print that string using NXmessegeBox, when Apply button is pressed.
Public Function apply_cb() As Integer
Dim errorCode as Integer = 0
Try
/*Please come with code*/
Catch ex As Exception
'---- Enter your exception handling code here -----
errorCode = 1
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
how to fetch data from String block styler, please come with syntax.
I couldn't even trigger a listing window using Apply_cb(). Some one suggest.
thanks.
I have successfully created a program using vb.net and journals to receive user inputs and create models as per the input. I now want to create drawings for the models which are created by the program.
The problem I am facing is that, when I record a journal for creating a dimension, several hundred lines of code are generated and I am not able to reuse them for models which are regenerated through the program I created.
I want to know how to create dimensions on-the-fly in drafting which can be reused for several models with varying parameters. Kindly help me out.
In C style , we can use uf_obj_cycle_objs_in_parts , with type 25(uf_drafting_entity_type)to get drafting entity like note, label, idsymbol..etc,
In C++ how to get drafting entity and its type.
What is the equivalent function for uf_obj_cycle_objs_in_parts? in C++
Also, for entity subtype fpt, how to differentiate type fcf,datum symbol.
For both it is returning fpt subtype.
In c# we have function called "gettype" in nxobject class, so I need equivalent function in C++.
Thank you