Cancel
Showing results for 
Search instead for 
Did you mean: 

Insert UDE command

Pioneer
Pioneer

Hello,

I want to insert one UDE command (For example: MACHIN/XX, XX) in the UDE of first GOTO motion of tool path operation. I do not know it is possible, or not?)

 

CL FILE OUTPUT LOOKS LIKE:

 

LOAD/1,OFFSET,2

SPINDL/1500,CLW

GOTO/123,258,369

MACHIN/XX,XX

;

;

...

...

 

Thanks!

CANATEDA

-----------------------------------------
UG3.0
UG6.0
NX10.0.35
NX11.0.1
UG_NX is my favorite !!!!!!
4 REPLIES

Re: Insert UDE command

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Note as long as the UDE's event is triggered ANY TIME before where you need the output, the UDE's event handler does NOT need to output anything.

 

so say the UDE is

EVENT canateda_stuff
{
      # stuff here
PARAM canateda_data
{
# parameter definition per your needs
} }

 

 

So I would add the UDE to the "start" events in the operation

 

The UDE event handler would NOT output anything:

proc MOM_canateda_stuff { } {
global mom_canateda_data # handle logic, check variables, etc. # but NO output }

Then I would add a custom command, something like this (this is the full tcl code, not visible unless you open the post's .tcl file in an editor):

 

proc PB_CMD_canateda_stuff_output { } {
     global mom_canateda_data
if {[info exists mom_canateda_data]} { MOM_output_literal "mom_canateda_data = $mom_canateda_data"
unset mom_canateda_data
} }

 

 Then add this custom command AFTER the motion output in linear/rapid/other motion events.

 

If you insist on using the CLS, I would copy one of the tcl files in \MACH\resource\tool_path\* to a new name, and edit as needed (you won't have the Post Builder user interface, so you'll have to edit the TCL code directly) and add a reference to the new tcl file in template_clsf.dat.  Code will be (essentially) the same, but without the naming requirements of PB.

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


Re: Insert UDE command

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

I refresh the topic Smiley Very Happy

I do as you write and works but when I have two instruction(Insert) custom command output only the last instruction and ommit the previous. Why is this happening?

Re: Insert UDE command

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You only have 1 set of global variables.

So the 2nd UDE over-writes the first one's data.

You need to store the data in an array

 

In this case, you need to re-write the tcl code to something like... 

 

Event handler:

proc MOM_canateda_stuff { } {
       global mom_canateda_data
       global canateda_data_out
       global canateda_data_count

    if{![info exists canateda_data_count]} {
          set canateda_data_count 0
    }

    set canateda_data_out($canateda_data_count) $mom_canateda_data
    incr canateda_data_count

    # cleanup UDE variable(s) here
    unset mom_canateda_data

}

 

and output routine:

proc PB_CMD_canateda_stuff_output { } {
     global canateda_data_count
     global canateda_data_out

     if {![info exists canateda_data_count]} { return }

    for {set i 0} {$i < canateda_data_count} { incr i} {
         MOM_output_literal "canateda_data_out($i) = $canateda_data_out($i)"
    }
# cleanup variables
     unset canateda_data_out
     unset canateda_data_count
     
}

 

NOTE: The above code is not tested, and may contain minor tcl errors.

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


Re: Insert UDE command

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Also note...

When you get to this level of complexity, there are other alternative ways to code.

- check for *_out(0) existance, and use "array size" to determine the size (instead of *_count variable)

- use tcl lists

- other techniques...

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


Learn online





Solution Information