cancel
Showing results for 
Search instead for 
Did you mean: 

Spindle Marker

PLM World Member Phenom PLM World Member Phenom
PLM World Member Phenom

Is there some way to detect in the post when a Spindle_Marker UDE has been used?  I cannot see anything on the review tool

John Joyce, Manufacturing Engineer,
Senior Aerospace Connecticut
www.senioraeroct.com
Production: NX10.0.3.5, Vericut 8.0.3
Development: Tcl/Tk
Testing: NX11.0.2.7
9 REPLIES

Re: Spindle Marker

Genius
Genius

I don't know if you use the cls file or directly postprocessor , but for generate the cls file , nx use :

proc USER_DEFINED_output { v1 v2 } {}

With this procedure, it is easy to count the number of times which we use spindle_marker or if this info exist

@mkn

Re: Spindle Marker

PLM World Member Phenom PLM World Member Phenom
PLM World Member Phenom

Thanks, but I am looking for something in Post Builder to let me know when or if the Spindle Marker has been used in an operation.

John Joyce, Manufacturing Engineer,
Senior Aerospace Connecticut
www.senioraeroct.com
Production: NX10.0.3.5, Vericut 8.0.3
Development: Tcl/Tk
Testing: NX11.0.2.7

Re: Spindle Marker

Creator
Creator

HI

 

This Marker is using the UDE, if you add "spindle marker" in operation UDE than next add the "insert" UDE and put the M code than genrate the nc code and you can see the after spindle ON (M03) next line for you M code.  

Re: Spindle Marker

PLM World Member Phenom PLM World Member Phenom
PLM World Member Phenom

I have several hundred files that already have the spindle marker in them.  I am looking for something that will identify if a Spindle Marker has already been used.

John Joyce, Manufacturing Engineer,
Senior Aerospace Connecticut
www.senioraeroct.com
Production: NX10.0.3.5, Vericut 8.0.3
Development: Tcl/Tk
Testing: NX11.0.2.7

Re: Spindle Marker

Esteemed Contributor
Esteemed Contributor

I'm not sure if the post can report this.

Your best bet may be a journal to process all the operations in a part , go thru the "start" events, and look to see if it is there.

 

I have some code that I stole from GTAC (ugsolutions database? - although I can't seem to find it anymore).  Should get you close (try combining w/ some of Marks code to process all operations in a part?)

' From GTAC / UGanswer
' stolen on 26-Nov-2012

Imports System 
Imports System.Collections 
Imports NXOpen 
Imports NXOpen.Annotations 
Imports NXOpen.UF 
Imports NXOpen.CAM
Imports NXOpen.Utilities


Public Class Program 
    ' class members 
    Private Shared theSession As Session 
    Private Shared theUI As UI 
    Private Shared theUfSession As UFSession 
    Private Shared lw As ListingWindow 
    
    Public Shared Function Main(ByVal args As String()) As Integer 
        theSession = Session.GetSession() 
		Dim workPart As Part = theSession.Parts.Work
        theUI = UI.GetUI() 
        theUfSession = UFSession.GetUFSession() 
        lw = theSession.ListingWindow 
        lw.Open() 
		
' DOES NOT WORK IN ONT		Dim numsel As Integer = theUI.SelectionManager.GetNumSelectedObjects()	
'		lw.WriteLine("Selected Objects: " & numsel.ToString())

		Dim num_nodes As Integer = 0 
		Dim nodes As Tag() 
		theUfSession.UiOnt.AskSelectedNodes(num_nodes, nodes) 
        lw.WriteLine(" Found " & num_nodes & " selected nodes - only doing first selected object...") 
		If num_nodes <= 0 Then 
			lw.WriteLine("No CAM node selected...exit") 
			Return (1) 
		End If 

		Dim camObject As NXObject = NXObjectManager.Get(nodes(0))

		lw.WriteLine(" Found type = " & camObject.GetType().ToString() ) 

		Dim params1(0) As CAM.CAMObject
		params1(0) = CType(camObject, CAM.CAMObject)

		
        Try 
			Dim objectsUdeSet1 As CAM.ObjectsUdeSet
			objectsUdeSet1 = workPart.CAMSetup.CreateObjectsUdeSet(params1, CAM.CAMSetup.Ude.Start)
            lw.WriteLine(" Found " & objectsUdeSet1.UdeSet.UdeList().Length() & " Start UDEs...") 

			Dim UDE_Array as Ude() = objectsUdeSet1.UdeSet.UdeList.GetContents()
            'lw.WriteLine("     UDEArray size = " & UDE_Array.Length()) 
			
            For i As Integer = 0 To UDE_Array.Length() - 1 
				'lw.WriteLine("     UDEArray item = " & i) 
                lw.WriteLine(vbLf & "    UDE: " & UDE_Array(i).UdeName()) 
                lw.WriteLine( "    TYPE: " & UDE_Array(i).GetType().ToString()) 

                Dim num_params As Integer  = UDE_Array(i).NumberOfParameters()
                lw.WriteLine( "    PARAM COUNT: " & num_params.ToString()) 
                
                For j As Integer = 0 To num_params - 1 
                    Dim thisParam As UdeParameter = UDE_Array(i).GetParameter(j)
					lw.WriteLine( "        PARAM " & j.ToString() & " NAME: " & thisParam.NameOfParameter) 
					lw.WriteLine( "        PARAM " & j.ToString() & " ACTI: " & thisParam.ParameterActive.ToString()) 
					lw.WriteLine( "        PARAM " & j.ToString() & " OPTN: " & thisParam.ParameterOptional.ToString()) 
					lw.WriteLine( "        PARAM " & j.ToString() & " TYPE: " & thisParam.GetType().ToString()) 
					Try
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE INT: " & thisParam.IntegerValue.ToString()) 
					Catch
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE not an int") 
					End Try
					Try
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE BOOL: " & thisParam.BooleanValue.ToString()) 
					Catch
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE not an boolean") 
					End Try
					Try
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE DBL: " & thisParam.DoubleValue.ToString()) 
					Catch
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE not an double") 
					End Try
					Try
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE OPT: " & thisParam.OptionText.ToString()) 
					Catch
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE not an option") 
					End Try
					Try
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE STR: " & thisParam.StringText.ToString()) 
					Catch
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE not an string") 
					End Try
					Try
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE PNT: " & thisParam.Point.Coordinates.X.ToString()) 
					Catch
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE not an point") 
					End Try
					Try
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE VEC: " & thisParam.Vector.ToString()) 
					Catch
						lw.WriteLine( "        PARAM " & j.ToString() & " VALUE not an vector") 
					End Try
					
                Next 
            Next 
               
        Catch ex As NXOpen.NXException 
            'try 
            UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message) 
        End Try 

        Try 
			Dim objectsUdeSet1 As CAM.ObjectsUdeSet
			objectsUdeSet1 = workPart.CAMSetup.CreateObjectsUdeSet(params1, CAM.CAMSetup.Ude.End)
            lw.WriteLine(vbLf & " Found " & objectsUdeSet1.UdeSet.UdeList().Length() & " End UDEs...") 
			
			' Re-add stuff
 			Dim UDE_Array as Ude() = objectsUdeSet1.UdeSet.UdeList.GetContents()
            For i As Integer = 0 To UDE_Array.Length() - 1 
                lw.WriteLine(vbLf & "    UDE: " & UDE_Array(i).UdeName()) 
                lw.WriteLine( "    TYPE: " & UDE_Array(i).GetType().ToString()) 
            Next 
               
        Catch ex As NXOpen.NXException 
            'try 
            UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message) 
        End Try 
		
		' ignore groups & other "non-operations"
		' only operations can have non-start and non-end UDEs
		Try
			' Filter groups
			Dim answer As Boolean

			' If the object is not an operation then leave without doing anything more
			theUfSession.Ncgroup.IsGroup(params1(0).Tag(), answer)
			If answer = True Then
				lw.WriteLine("Selected object is a group...") 
				Return 0
			End If

			' filter out other non-operations
			If NOT TypeOf camObject Is CAM.Operation Then
				lw.WriteLine("Selected object is a not an operation...") 
				Return 0
			End If
			
        Catch ex As NXOpen.NXException 
            'try 
            UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message) 
        End Try 

        Try 
			' Filter JUST *control operations
			Dim operationType As Integer
			Dim operationSubtype As Integer

			'Get the type and subtype of the operation
			theUFSession.Obj.AskTypeAndSubtype(params1(0).Tag(), operationType, operationSubtype)
	
			'lw.WriteLine(" Found type = " & operationType & " subtype = " & operationSubtype) 
		
			' type 100 subtype 1100 = mill/drill control
			' type 100 subtype 1200 = lathe control
			' type 100 subtype 1300 = Wire EDM control
			
			' TODO: What about machine control sub-ops in turning teach mode operations?
			' TODO: What about generic motion sub-ops?
		
			Dim udeSet1 As CAM.UdeSet
			If operationSubtype = 1100 Then
				Dim operationBuilder As CAM.MillMachineControlBuilder
				operationBuilder = workPart.CamSetup.CAMOperationCollection.CreateMillMachineControlBuilder(camObject)
				udeSet1 = operationBuilder.UdeSet
			ElseIf operationSubtype = 1200 Then
				Dim operationBuilder As CAM.LatheMachineControlBuilder
				operationBuilder = workPart.CamSetup.CAMOperationCollection.CreateLatheMachineControlBuilder(camObject)
				udeSet1 = operationBuilder.UdeSet
			ElseIf operationSubtype = 1300 Then
				Dim operationBuilder As CAM.WedmMachineControlBuilder
				operationBuilder = workPart.CamSetup.CAMOperationCollection.CreateWedmMachineControlBuilder(camObject)
				udeSet1 = operationBuilder.UdeSet
			Else
				Return 0
			End If

				
				lw.WriteLine(vbLf & " Found " & udeSet1.UdeList().Length() & " Control UDEs...") 
				Dim UDE_Array as Ude() = udeSet1.UdeList.GetContents()
				For i As Integer = 0 To UDE_Array.Length() - 1 
					lw.WriteLine(vbLf & "    UDE: " & UDE_Array(i).UdeName()) 
					lw.WriteLine( "    TYPE: " & UDE_Array(i).GetType().ToString()) 
				Next 


		Catch ex As NXOpen.NXException 
            'try 
            UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message) 
        End Try 
        Return 0 
    End Function 
    
    Public Shared Function GetUnloadOption(ByVal arg As String) As Integer 
        Return System.Convert.ToInt32(Session.LibraryUnloadOption.Immediately) 
    End Function 
    
End Class
Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Spindle Marker

Valued Contributor
Valued Contributor

The post proc "MOM_spindle_rpm" is called when there is a Spindle Marker UDE although it is also called with an Extra Spindle On  and maybe more events. It might be helpful though to throw an alert when posting to check that operation.

 

HTH Eric

Re: Spindle Marker

PLM World Member Phenom PLM World Member Phenom
PLM World Member Phenom
Eric,

Thanks this may be a simpler solution.


"Sometimes you can't see the forest for the trees "
John Joyce, Manufacturing Engineer,
Senior Aerospace Connecticut
www.senioraeroct.com
Production: NX10.0.3.5, Vericut 8.0.3
Development: Tcl/Tk
Testing: NX11.0.2.7

Re: Spindle Marker

Esteemed Contributor
Esteemed Contributor

Note (IIRC) MOM_spindle_rpm is called anywhere the spindle is turned on?

So you may get a lot of "false positives"

 

If you want to get REALLY tricky, you could menuscript a /PRE action on the postprocess button.  Then use a journal (I think) to check for them & abort posting (or warn the user or whatever) if they exist.

 

Another option would be to run a journal against all your parts & report which ones have this issue.  Then go thru & fix them, and not have to worry about them anymore.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Spindle Marker

Valued Contributor
Valued Contributor

In my testing MOM_spindle_rpm was not called from an operation that has no start events but maybe I missed something. I just added a dummy text comment to see if it was output to the posted code.

 

Eric 

Learn online





Solution Information