Cancel
Showing results for 
Search instead for 
Did you mean: 

Fanuc GMe_SetMacroArgument

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi

It seems that in NX 12 the macro argument is not set to de sub program parameter p.e. D--> #7 anymore. I can imagine that this is necessary for multi subprogramming. But how shoud I know which Variable contains the Value that I stored with this method?

 

5 REPLIES 5

Re: Fanuc GMe_SetMacroArgument

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello,

 

to check your problem in detail, please let me know which NX version you are using in detail and what is the NC Code of the main program where you do have these problem.

 

Are you saying that was  working in a previous version?

 

Thomas Schulz
Siemens PLM
Manufacturing Engineering Software

Re: Fanuc GMe_SetMacroArgument

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi

NX 12.0.2.9 MP4

see example below

in the subprog - "ToolChange_B_Head" I can use then #7 and #2 to do something. This was working in NX10, but I don't know in which version this was changing... now #7 has always 0.

 

<Metacode xsi:noNamespaceSchemaLocation="D:\Siemens\MachineConfigurator\resource\mc_metacode.xsd">
 <Name>G361</Name>
 <MCParam>B</MCParam>
 <MCParam>D</MCParam>
<Execute>
<MacroCommand>
 <Name>GMe_MoveVariableBlock</Name>
 <Param>0</Param>
 <Param>GV_nStackOffset+(getStackSize()-1)*100</Param>
 <Param>33</Param>
 </MacroCommand>
<MacroCommand>
 <Name>GMe_ResetVariableBlock</Name>
 <Param>GV_nStackOffset+getStackSize()*100</Param>
 <Param>33</Param>
 </MacroCommand>
<IfCommand>
 <Condition>"1" == getChannelName()</Condition>
<Then>
<Command>
 <Name>CallSubProg</Name>
 <Param>"ToolChange_B_Head"</Param>
 </Command>
<IfCommand>
 <Condition>isDefined(B)</Condition>
<Then>
<MacroCommand>
 <Name>GMe_SetMacroArgument</Name>
 <Param>"B"</Param>
 <Param>B</Param>
 </MacroCommand>
 </Then>
 </IfCommand>
<IfCommand>
 <Condition>isDefined(D)</Condition>
<Then>
<MacroCommand>
 <Name>GMe_SetMacroArgument</Name>
 <Param>"D"</Param>
 <Param>D</Param>
 </MacroCommand>
 </Then>
 </IfCommand>
 </Then>
 </IfCommand>
 </Execute>
 </Metacode>

Re: Fanuc GMe_SetMacroArgument

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello, I looked that in our sim15 Fanuc example and it works. So overall this should work.

In this example we are calling a subprogram O0361 and the values from the main program are correctly set insides the subprogram. To do that this is all implemented in the O Metacode first line of the subprogram. I may work if you try to follow that way.

 

2019-02-15 09_26_23-NX 12 - Simulation.png2019-02-15 09_29_02-Execution View.png

Thomas Schulz
Siemens PLM
Manufacturing Engineering Software

Re: Fanuc GMe_SetMacroArgument

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi Thomas

Thank you very much for your answer. But the Problem appears if you set the macro argument (lets say manually) after CallSubProg. To have the Fanuc Arguments in the called sub prog I was able to set the Macro argument (which was recognized with MCParam) with the global Method GMe_SetMacroArgument.

the called subprog starts like this:

 

 

O73 (do not remove - important for parameter handling)
G0 G49

 

Re: Fanuc GMe_SetMacroArgument

Siemens Phenom Siemens Phenom
Siemens Phenom

Please define an additional variable, which is used inside the O metacode definition.

 

subprogs-fanuc.png

Thomas Schulz
Siemens PLM
Manufacturing Engineering Software

Learn online





Solution Information