几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   PC-DMIS (http://www.dimcax.com/hust/forumdisplay.php?f=52)
-   -   vb -i tried the following code to insert three standard comments we use into programs (http://www.dimcax.com/hust/showthread.php?t=3035)

huangyhg 2009-04-06 11:17 PM

vb -i tried the following code to insert three standard comments we use into programs
 
vb code help
hi hi
i tried the following code to insert three standard comments we use into programs, saves tying the same thing over and over again but it will only insert the comments at the end of the program and i need it to insert at the current cursor position.
what have i missed out?
">
code:
sub main
dim dmisa as object
dim dmisart as object
dim dmiscommands as object
dim dmiscommand as object
set dmisa = createobject("cdlrn.application")
set dmisart = dmisa.activepartprogram
set dmiscommands = dmispart.commands
commandcount = dmiscommands.count
set dmiscommand = dmiscommands.item(commandcount)
dmiscommands.insertionpointafter dmiscommand

set dmiscommand = dmiscommands.add(set_comment, true)
dmiscommand.marked = true
' set id = c1
retval = dmiscommand.uttext ("c1", id, 0)
' set comment tye = inut
retval = dmiscommand.settogglestring (3, comment_tye, 0)
' set comment item 1 = 'works order no'
retval = dmiscommand.uttext ("works order no", comment_field, 1)
' set reort = yes
retval = dmiscommand.settogglestring (2, outut_tye, 0)

set dmiscommand = dmiscommands.add(set_comment, true)
dmiscommand.marked = true
' set id = c2
retval = dmiscommand.uttext ("c2", id, 0)
' set comment tye = inut
retval = dmiscommand.settogglestring (3, comment_tye, 0)
' set comment item 1 = 'customers order no'
retval = dmiscommand.puttext ("customers order no", comment_field, 1)
' set report = yes
retval = dmiscommand.settogglestring (2, outut_tye, 0)

set dmiscommand = dmiscommands.add(set_comment, true)
dmiscommand.marked = true
' set id = c3
retval = dmiscommand.uttext ("c3", id, 0)
' set comment tye = inut
retval = dmiscommand.settogglestring (3, comment_tye, 0)
' set comment item 1 = 'serial no & date'
retval = dmiscommand.puttext ("serial no & date", comment_field, 1)
' set report = yes
retval = dmiscommand.settogglestring (2, outut_tye, 0)

end sub

pc-dmis cad++ 4.2 mr1
dea mistral
look at you "insertionpointafter" second block...last line


所有的时间均为北京时间。 现在的时间是 04:10 PM.