查看单个帖子
旧 2007-11-26, 10:44 AM   #1
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 【转帖】How to access the hits that comprise a feature?

I've tried the following basic code (generated by the OldBasic converter).

Sub main

Dim i, j, k As Integer ' working vars
Dim tpoint As Object
Set tpoint = CreateObject("PCDLRN.PointData")

Dim AutoApp As Object
Set AutoApp = CreateObject("PCDLRN.Application")
Dim AutoPart As Object
Set AutoPart = AutoApp.ActivePartProgram
Dim AutoOldBasicObj As Object
Set AutoOldBasicObj = AutoPart.OldBasic
i = AutoOldBasicObj.StartGetFeatPoint("CIR1",PCD_MEAS, PCD__BALLCENTER)
For j = 1 To i
msgbox i & " - " & j
AutoOldBasicObj.GetFeatPoint( tpoint, j)
msgbox "Got past the GetFeatPoint call"
Next j
End Sub

The circle ("C1") has four points, which the call to AutoOldBasicObj.StartGetFeatPoint returns correctly.

However, the call to AutoOldBasicObj.GetFeatPoint( tpoint, j) has two problems:

1. It won't run if I attempt to assign the result of this funtion to an integer (e.g. k = AutoOldBasicObj.GetFeatPoint( tpoint, j) ) I get a type mismatch error, which indicates that the function is not returning an integer as indicated in the manual.

2. Once executed, the program blows up without an error, and ceases to run. That is, I'll never get to the second MSGBOX call.

Is there another way to get at the basic hit data for this circle? I can find non-OldBasic objects that let me get at the dimensions of it, but not the individual hits themselves. This is more than a little exasperating...
huangyhg离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)