首页上一页 1  下一页尾页 1 条记录 1/1页
        求助,我希望我的变量Add即使是一位数字7,也能显示为007
                 	
                        发表在VB答疑区
                        2015-04-14                                                
                    		
                                                                            	
                        
                        
                    
                    
                    	是否精华
                    	是
                    	否
                    
                    
                    
                            版块置顶:
                            是
                            否
                        
                    
                                           add是一个数字变量,范围应该是从1~999,我希望它是一位数字或两位数字的时候都显示为三位,比如001,023。代码如下:
Private Sub QVBlock_7
dim xpos,ypos,zpos
dim xnom,ynom,znom
dim i,j
dim add
dim dx
for i=1 to 5
for j=1 to 38
if j<5 then
xnom=125.25-(j-1)*3.4
elseif j>4 and j<22 then
xnom=111.65-(j-5)*2.5
elseif j>21 and j<37 then
xnom=48.15-(j-22)*2.5
elseif j=37 then
xnom=10
elseif j=38 then
xnom=6.5
end if
   
if i=1 then
ynom=4.25
elseif i=2 then
ynom=7.15
elseif i=3 then
ynom=13.32
elseif i=4 then
ynom=15.8
else
ynom=18.65
end if
   
if i=1 then
znom=6.26
elseif i=2 then
znom=11.75
elseif i=3 then
znom=18.25
elseif i=4 then
znom=24.2
else
znom=30
end if
    
add=add+1
Measure.Point Label:="", ProjPlane:=NO_PLANE
PatternTemplate.Import "D:\Ptn\196W\PCB_Pin_1.ptn"
Video.ChangeToImageContext X:=xnom, Y:=ynom, Z:=znom, Coax:=0.50, Stage:=0.00, Back:=0.00, Front:=0.00, Right:=0.00, Left:=0.00, Angle:=0.00, Color:= qvWhite, NomMag:=2.500000
PatternTool.SetMode Speed:=1, Accuracy:=0, CertaintyThr:=66, AcceptThr:=64, StartAngle:=0.000000, EndAngle:=0.000000, NumPatterns:=1
PatternTool.RunVCS X:=3, Y:=1, W:=632, H:=467
Measure.EndMeas
xpos=featuredb.X.actual
ypos=featuredb.y.actual
Zpos=featuredb.Z.actual
Measure.Point Label:="H_"& add, ProjPlane:=NO_PLANE
Video.ChangeToImageContext X:=xpos, Y:=ypos, Z:=zpos-0.2, Coax:=0.16, Stage:=0.00, Back:=0.00, Front:=0.00, Right:=0.00, Left:=0.00, Angle:=0.00, Color:= qvWhite
FocusTool.SetMode FocusType:=SURFACE, Speed:=MED, Range:=1.2
FocusTool.RunVCS X:=0, Y:=0, W:=68, H:=74
Measure.EndMeas
'Results.ReportFeature Show:=Z_, Tag:="Hight"
next
next
End Sub 'QVBlock_7
                
        	
        
        
    Private Sub QVBlock_7
dim xpos,ypos,zpos
dim xnom,ynom,znom
dim i,j
dim add
dim dx
for i=1 to 5
for j=1 to 38
if j<5 then
xnom=125.25-(j-1)*3.4
elseif j>4 and j<22 then
xnom=111.65-(j-5)*2.5
elseif j>21 and j<37 then
xnom=48.15-(j-22)*2.5
elseif j=37 then
xnom=10
elseif j=38 then
xnom=6.5
end if
if i=1 then
ynom=4.25
elseif i=2 then
ynom=7.15
elseif i=3 then
ynom=13.32
elseif i=4 then
ynom=15.8
else
ynom=18.65
end if
if i=1 then
znom=6.26
elseif i=2 then
znom=11.75
elseif i=3 then
znom=18.25
elseif i=4 then
znom=24.2
else
znom=30
end if
add=add+1
Measure.Point Label:="", ProjPlane:=NO_PLANE
PatternTemplate.Import "D:\Ptn\196W\PCB_Pin_1.ptn"
Video.ChangeToImageContext X:=xnom, Y:=ynom, Z:=znom, Coax:=0.50, Stage:=0.00, Back:=0.00, Front:=0.00, Right:=0.00, Left:=0.00, Angle:=0.00, Color:= qvWhite, NomMag:=2.500000
PatternTool.SetMode Speed:=1, Accuracy:=0, CertaintyThr:=66, AcceptThr:=64, StartAngle:=0.000000, EndAngle:=0.000000, NumPatterns:=1
PatternTool.RunVCS X:=3, Y:=1, W:=632, H:=467
Measure.EndMeas
xpos=featuredb.X.actual
ypos=featuredb.y.actual
Zpos=featuredb.Z.actual
Measure.Point Label:="H_"& add, ProjPlane:=NO_PLANE
Video.ChangeToImageContext X:=xpos, Y:=ypos, Z:=zpos-0.2, Coax:=0.16, Stage:=0.00, Back:=0.00, Front:=0.00, Right:=0.00, Left:=0.00, Angle:=0.00, Color:= qvWhite
FocusTool.SetMode FocusType:=SURFACE, Speed:=MED, Range:=1.2
FocusTool.RunVCS X:=0, Y:=0, W:=68, H:=74
Measure.EndMeas
'Results.ReportFeature Show:=Z_, Tag:="Hight"
next
next
End Sub 'QVBlock_7

 
	
                                                 VIP会员
VIP会员 购物车
购物车

 私信
                         私信 
                     发表新帖
发表新帖 立即签到
立即签到 
        		  
        		 
         		 关注
关注
                  回复
 回复 支持(
                	支持( 反对(
                    反对( 
                    

 
               			  
                







 
                     
                     
					 
						 
						 
						 
						