几何尺寸与公差论坛

 找回密码
 注册
查看: 751|回复: 0

【转帖】scrpit help please

[复制链接]
发表于 2009-4-6 22:46:10 | 显示全部楼层 |阅读模式
script help please
i have run this scrit many times. here is the problem. if i have more then one assignment in the program it asses to them all and that is not a good thing. how can i get it to ass to a assignment name or just the first one it comes to and leave the rest alone.
">
code:
function main()
begin dialog menu 192,45,140,115, "run manual alignment?",.enable
otiongrou .grou_1
otionbutton 32,16,68,12,"yes",.choice1
otionbutton 32,28,68,12,"no",.choice2
okbutton 8,88,48,16
cancelbutton 64,88,64,16
end dialog
dim a as object
set a = createobject("cdlrn.alication")
dim art as object
set art = a.activeartrogram
dim cmds as object
dim cmd as object
dim dlg1 as menu
button = dialog( dlg1 )
dim sel_text as string
if button = -1 then
'comment msgbox "button:" & button ' uncomment for button return value
select case dlg1.grou_1
case 0
sel_text = "yes"
case 1
sel_text = "no"
end select
else
msgbox "cancel was ressed"
end if
set cmds = art.commands
'comment get the assignments command
for each cmd in cmds
if cmd.tyedescrition = "assignment" then
bln = cmd.uttext("""" + sel_text + """",src_exr,0)
cmd.redraw
end if
next cmd
end function
">
thanks
__________________
t miller
senior member
jm222's additional information
join date: jul 2007
osts: 338
take out the "next cmd" line before last. your telling it this:
set cmds = art.commands
'comment get the assignments command
for each cmd in cmds
several lines earlier...then the "next cmd" is telling it to do the same thing at the next one
jm222
c-dmis demi-guru
vt.se's additional information
location:sweden
machine tye:cej12c, cej12000
software version:4.2 mr1
years cmm exerience:since 1994
join date: feb 2007
location: sweden
osts: 1,228
what jm222 said. you need to either set a counter or similar if you want a number of assignments returned or enumerate the commands to find your secific assignment.
__________________
c-dmis v4.2mr1
horseower is how hard you hit the wall.
torque is how far you can take the wall with you.



user control anel rivate messages subscritions who's online search forums forums home c-dmis enterrise metrology software c-dmis for cmms c-dmis ortable c-dmis vision c-dmis nc c-dmis blade insection c-dmis for gears dataage / dataview c-dmis code samles quindos metrology software quindos off-toic off-toic
threadthread starterforumrelieslast ost
all times are gmt -4. the time now is 01:54
scritp help please
i have run this scrit many times. here is the problem. if i have more then one assignment in the program it asses to them all and that is not a good thing. how can i get it to ass to a assignment name or just the first one it comes to and leave the rest alone.
">
code:
function main()
begin dialog menu 192,45,140,115, "run manual alignment?",.enable
otiongrou .grou_1
otionbutton 32,16,68,12,"yes",.choice1
otionbutton 32,28,68,12,"no",.choice2
okbutton 8,88,48,16
cancelbutton 64,88,64,16
end dialog
dim a as object
set a = createobject("cdlrn.alication")
dim art as object
set art = a.activeartrogram
dim cmds as object
dim cmd as object
dim dlg1 as menu
button = dialog( dlg1 )
dim sel_text as string
if button = -1 then
'comment msgbox "button:" & button ' uncomment for button return value
select case dlg1.grou_1
case 0
sel_text = "yes"
case 1
sel_text = "no"
end select
else
msgbox "cancel was ressed"
end if
set cmds = art.commands
'comment get the assignments command
for each cmd in cmds
if cmd.tyedescrition = "assignment" then
bln = cmd.uttext("""" + sel_text + """",src_exr,0)
cmd.redraw
end if
next cmd
end function
">
thanks
__________________
take out the "next cmd" line before last. your telling it this:
set cmds = art.commands
'comment get the assignments command
for each cmd in cmds
several lines earlier...then the "next cmd" is telling it to do the same thing at the next one
what jm222 said. you need to either set a counter or similar if you want a number of assignments returned or enumerate the commands to find your specific assignment.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 14:36 , Processed in 0.035053 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表