Is it possible to automate???
Is it possible to automate???
(OP)
Here is my case, I have a number of part files in the iges file format for which i have to get the raw material size for material ordering for carrying out the further manufacturing operations.
Now as for me i am doing like importing each iges files and measuring the size using the stock size command and preparing a list of part name and raw material size in an excel is there a possible way to automate these functions cause these takes up lot more time in selecting, dragging, copying, pasting, etc.
Is there any program available or to learn such kind of stuffs guide me i ain't know anything about programming....
Thanks in advance
Santhosh
Now as for me i am doing like importing each iges files and measuring the size using the stock size command and preparing a list of part name and raw material size in an excel is there a possible way to automate these functions cause these takes up lot more time in selecting, dragging, copying, pasting, etc.
Is there any program available or to learn such kind of stuffs guide me i ain't know anything about programming....
Thanks in advance
Santhosh





RE: Is it possible to automate???
To import the BOM to Excel Sheet select DATA->From Text and browse to your exported csv or text file and select.
Michael Fernando (CSWE)
www.solidCADworks.com
Tool and Die Designer
Siemens NX V9.0 + PDW
SWX 2013 SP3.0 X64
PDMWorks 2013
Logopress3
FastForm Advance
FormatWorks
RE: Is it possible to automate???
There is an old and rather extreme example here:
Link
RE: Is it possible to automate???
www.nxjournaling.com
RE: Is it possible to automate???
RE: Is it possible to automate???
Here i have attached a picture of a stock size measurement of a random part using stock size command i just have to extract the dimensions given in the stock size and blank size text boxes into an excel.
RE: Is it possible to automate???
RE: Is it possible to automate???
Journal to measure the stock size of a solid body and write the info to a .csv file. The journal will prompt you to select a solid body then it will prompt to specify a csys (the dynamic csys tool will default to the WCS orientation). The edges of the "stock" will be aligned to the axes of the chosen csys. Change the orientation if needed and press OK. The measured size will be written to the specified file. The output will be in the format: "file name, X dimension, Y dimension, Z dimension". The X, Y, and Z directions will be according to the csys you specified.
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession() Sub Main() If IsNothing(theSession.Parts.Work) Then 'active part required Return End If Dim workPart As Part = theSession.Parts.Work Dim lw As ListingWindow = theSession.ListingWindow lw.Open() '$$$ file to output measurements, change this before running journal Dim outputFile As String = "C:\temp\prtStockSize.csv" '$$$ Dim bodyToMeasure As Body = Nothing If SelectSolid("Select a solid body to measure", bodyToMeasure) = Selection.Response.Cancel Then Return End If If Not OrientWCS() Then Return End If Dim stkSize As String = MeasureBody(bodyToMeasure) Dim output As String = workPart.Leaf & ", " & stkSize AppendToTextFile(outputFile, output) lw.Close() End Sub Function SelectSolid(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response Dim theUI As UI = UI.GetUI Dim title As String = "Select a solid body" Dim includeFeatures As Boolean = False Dim keepHighlighted As Boolean = False Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific Dim cursor As Point3d Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart Dim selectionMask_array(0) As Selection.MaskTriple With selectionMask_array(0) .Type = UFConstants.UF_solid_type .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_BODY End With Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _ title, scope, selAction, _ includeFeatures, keepHighlighted, selectionMask_array, _ selobj, cursor) If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then Return Selection.Response.Ok Else Return Selection.Response.Cancel End If End Function Function OrientWCS() As Boolean Dim theUISession As UI = UI.GetUI() '9 element orientation matrix of specified csys 'arrays are zero based Dim myCsys(8) As Double '3 element array: origin point of specified csys Dim myOrigin(2) As Double 'tag variable used as input/output for the .SpecifyCsys method 'passing a null tag into the function uses the current WCS as the starting csys Dim newCsysTag As Tag = Tag.Null 'variable to hold the user specified coordinate system Dim newCsys As CartesianCoordinateSystem Dim response As Integer theUISession.LockAccess() response = theUfSession.Ui.SpecifyCsys("Specify Desired Orientation", 5, myCsys, myOrigin, newCsysTag) theUISession.UnlockAccess() If response = Selection.Response.Ok Then 'get CartesianCoordinateSystem object from tag newCsys = Utilities.NXObjectManager.Get(newCsysTag) 'orient WCS to specified coordinate system theSession.Parts.Work.WCS.SetCoordinateSystemCartesianAtCsys(newCsys) Return True Else 'user pressed back or cancel or the system was in a state that could not allow the dialog to be shown '1 = back '2 = cancel '3 = OK '7 = no active part '8 = disallowed state, unable to bring up dialog Return False End If End Function Function MeasureBody(ByVal theBody As Body) As String Dim minCorner(2) As Double Dim boxDirections(2, 2) As Double Dim boxDistances(2) As Double Dim boundX As Double Dim boundY As Double Dim boundZ As Double 'get solid body bounding box extents aligned to work csys (pass null tag to use work csys) theUfSession.Modl.AskBoundingBoxAligned(theBody.Tag, Tag.Null, expand:=False, min_corner:=minCorner, directions:=boxDirections, distances:=boxDistances) boundX = boxDistances(0) boundY = boxDistances(1) boundZ = boxDistances(2) Return boundX.ToString & ", " & boundY.ToString & ", " & boundZ.ToString End Function Sub AppendToTextFile(ByVal textFilePath As String, ByVal textLine As String) 'pass False to overwrite existing file, True to append existing file 'if file does not exist, a new file will be created and the True/False value will be ignored Using myWriter As New IO.StreamWriter(textFilePath, True) myWriter.WriteLine(textline) End Using End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End Modulewww.nxjournaling.com