how to create a link Button help me please !!

More
08 Jan 2011 15:17 #6544 by Raen
@John

thanx a lot....

Please Log in or Create an account to join the conversation.

More
08 Jan 2011 15:52 #6545 by Raen
i want to create a button at EMC2-Axis (Axis_mm.ini) and the button can execute my "program.py"

can someone help me? how to build this ??

i've already configure this all things :

STEP 1
make a int.xml file --> place at the same place with the axis_mm.ini file
<pyvcp>
<button>
<text>"program"</text>
<halpin>"program"</halpin>
</button>
</pyvcp>

STEP 2
make a intpostgui.hal file --> place at the same place with the axis_mm.ini file
net btn1 halui.mdi-command-00 <= pyvcp.program

STEP 3
configure the axis_mm.ini

[DISPLAY]
pyvcp = int.xml

[HAL]
HALUI = halui

add section:
[HALUI]
MDI_COMMAND = M101

STEP 4
make a M101 file (already setting execute file) --> place at a NC_files
#!bin/bash
# file to turn on paraport pin 14 to open the collet closer
halcmd setp parport.0.pin-14-out True
exit 0

is there anything WRONG or INCOMPLETE at this STEP ??
please explain me step by step...... >.<
i want to create a button at EMC2-Axis (Axis_mm.ini) and the button can execute my "program.py"

please someone help me......

Please Log in or Create an account to join the conversation.

More
08 Jan 2011 17:46 #6549 by andypugh
Please go back to the beginning, and instead of blindly following the magic incantations, try to understand what the example files do.

It is no good expecting an example that shows how to open a collet closer using a parallel port to magically run your python code. You need to understand what that file is doing, and modify it to do what you want (in this case to run your python program)

Please Log in or Create an account to join the conversation.

More
09 Jan 2011 11:52 #6565 by Raen
what is a relationship between this section :
1. net btn1 halui.mdi-command-00 <= pyvcp.program
2. M101 file --> placed at nc_files
#!bin/sh

why i still cant link the button to my "program.py" ?

Please Log in or Create an account to join the conversation.

More
09 Jan 2011 13:33 #6569 by andypugh
Raen wrote:

what is a relationship between this section :
1. net btn1 halui.mdi-command-00 <= pyvcp.program
2. M101 file --> placed at nc_files
#!bin/sh

why i still cant link the button to my "program.py" ?


There is still nowhere in the chain anything which links to your program.py file.
The confusion might be because the HAL pin which changes state when you press the button is called "program", but that does not in any way link it to the python file of the same name.
Please read these links, in this order, but don't just take the examples and use them, all you need is a read-through to get a feel for the structure.
www.linuxcnc.org/docview/html/hal_intro.html
www.linuxcnc.org/docview/html/hal_basic_hal.html
www.linuxcnc.org/docview/html/hal_pyvcp.html
www.linuxcnc.org/docview/html/config_emc2hal.html
www.linuxcnc.org/docview/html/gui_halui.html

(Sorry, it is quite a lot of information)

What you should have so far is a system of links in Pyvcp, Hal and Halui that results in the file "M101" being run. You need to make that "M101" file run your python file. The current M101 is set up to run just like the command line, so anything you put in the file will execute exactly as it would if you typed it in the terminal window. What do you type in the terminal window to run your python file?

Please Log in or Create an account to join the conversation.

More
11 Apr 2011 11:33 - 11 Apr 2011 12:06 #8752 by piasdom
i'm adding another button and having this problem.i'm trying to get the offset of X
custom_postgui.hal:12: Signal 'x-offset' of type 'float' cannot add pin 'pyvcp.x-offset' of type 'bit'

in the link i have and the button shows in axis
net x-offset halui.tool.length_offset.x <= pyvcp.x-offset

all looks ok to me, but i think i need something besides pyvcp.x-offset.
can't find anything about floats and bits. and in the docs, list of pins
have
halui.tool.length-offset.x minus sign
but i found in the hal config
halui.tool.length_offset.x underscore

so i know i have the pin right. just don't know if the end of the
link will always end in pyvcp.?????-?????

THANKS

p.s. i'm trying to make a pin in xml file, but isn't pin halui.tool.length_offset.x
used to output something. so i need to change my xml file to something besides button ?
Last edit: 11 Apr 2011 12:06 by piasdom. Reason: thinking

Please Log in or Create an account to join the conversation.

More
11 Apr 2011 12:08 #8755 by piasdom
i've found <number> </number>, but it doesn't
display the offset. just 0.0

Please Log in or Create an account to join the conversation.

More
11 Apr 2011 13:03 #8756 by piasdom
got it.
was offsetting x and looking for z :)

Please Log in or Create an account to join the conversation.

More
11 Apr 2011 13:15 #8757 by andypugh
piasdom wrote:

can't find anything about floats and bits. and in the docs,

"bit" means boolean (en.wikipedia.org/wiki/Boolean_data_type ) and is the output type of switches, buttons etc.
"float" means floating point ( en.wikipedia.org/wiki/Floating_point )and is the output type of spinboxes and number boxes.
HAL also has s32 and u32 (signed and unsigned integers ( en.wikipedia.org/wiki/Integer_(computer_science) )

list of pins
have
halui.tool.length-offset.x minus sign
but i found in the hal config
halui.tool.length_offset.x underscore

That sounds like an error in the docs. The Hal Config screen will always be correct.

Please Log in or Create an account to join the conversation.

More
11 Apr 2011 13:48 - 11 Apr 2011 13:49 #8762 by piasdom
Cool. thanks ! can you comment out a paragraph in the xml file?
what i have so far.
Attachments:
Last edit: 11 Apr 2011 13:49 by piasdom.

Please Log in or Create an account to join the conversation.

Time to create page: 0.110 seconds
Powered by Kunena Forum