hexagon logo

Problem accessing CadModel.CADProjectPoint from Basic Script

Trying to access the my Cad model in the Graphics Display Window using a PC-DMIS basic script. Getting a "Missing parameter(s)" error message. Here's what I have with the error being generated on the last line seen below;

'==================
Sub GetProjectPointData()
'==================
Dim App As Object
Dim Part As Object
Dim Cmds As Object
Dim GWindow As Object
Dim CadWin As Object
Set App = CreateObject("PCDLRN.Application")
Set Part = App.ActivePartProgram
Set Cmds = Part.Commands
Set GWindow = Part.CadWindows
Set CadWin = GWindow.Item(1)
Dim CADMod As CadModel
Set CADMod = Part.CadModel
'
'
Dim RetVal As Boolean
Dim XT, YT, ZT, DIRX, DIRY, DIRZ, PX, PY, PZ, PDIRX, PDIRY, PDIRZ As Double
Dim FeatureName, FID As String
'
CadWin.Visible = True

XT=NetData(7,1)
YT=NetData(7,2)
ZT=NetData(7,3)
CADMod.CADProjectPoint(XT, YT, ZT,7,0,0, PX, PY, PZ, PDIRX, PDIRY, PDIRZ,2)



The Function info in the help menus has 13 parameters, (as do I). Haven't tried accessing the Graphics display window from a script before and not sure if i have everything right here, but it does compile without errors, so...

If anyone that has basic script/Pcdmis knowledge about this topic, it would be much appreciated if you could take a peek at this and steer me in the right direction if there are blaring issues seen at first glance. Alien


Parents
  • Finding Other Possibilities:
    Upon further investigation I came across the "View Menu/Cad Verify" option in PC-DMIS. Looking at this, I plugged in my drop_point constructed nominals from my script and the Cad Verify menu produced the exact nominals seen in the "OverRide Nominals" window when a point is bumped. It actually shows both nominals and vector from the point projected onto the Cad Model. Looking further, I found that the object CadModel.CADProjectPoint is the object that will produce the same results as the Cad Verify menu produces.

    Current Script Condition:
    As of now, I am unable to get CadModel.CADProjectPoint to work. This function has type ENUM_CAD_RESULT. Clicking on this in the help menus show that the values are -1, 0, 2, and 1. This would suggest that the function should be assigned to an Integer value (as seen in the script).

    Other questions I have pertain to the last returned value "CadHandle". CadHandle is an object that, as far as I can tell, seems to represent an instance of the Cad Model in the Graphics Dislpay Window (could be wrong about this) and somehow must be defined prior to using CadModel.CADProjectPoint. The members are CadSequence, Collection, PartInstanceID, and SubCadId. Funny there is no description for CadHandle and not much in the way of showing how it is used.

    Also seeing a ENUM_CAD_COLLECTION. Each of these members starts with HCAD_. Because I am dealing with projecting points onto cad surfaces, HCAD_SURFACE (value = 1) may be my best bet when defining CadHandle.collection.

    Notes on LoadLine:
    I am currently importing the line feature I use to load each measured feature's value in to it. Tried creating it in the script but I must be missing something because the script created line does not produce the drop_point values seen when I import/dmis line. Here's the .dmi file I import below my net pad hits (10 total);

     DMISMN/LIN1.dmi
     FILNAM/LIN1.dmi
    F(LIN1)=FEAT/MEAS_LINE,UNBND,CART,722.23,760.92,1593.72,0.9999999,0.0002614,$
      -0.0002259,0,0,1
    MEAS/LINE,F(LIN1),2
        PTMEAS/CART,0,0,0,0,0,1,RMS=N/A,
        PTMEAS/CART,0,0,0,0,0,1,RMS=N/A,
    ENDMES
    ENDFIL
    


    Any further thought would be appreciated pertaining to the script set-up procedure for accessing the cad model in the Graphics Display Window or the use of object CadModel.CADProjectPoint.

    Alien​​​​​​​​​​​​​​
Reply
  • Finding Other Possibilities:
    Upon further investigation I came across the "View Menu/Cad Verify" option in PC-DMIS. Looking at this, I plugged in my drop_point constructed nominals from my script and the Cad Verify menu produced the exact nominals seen in the "OverRide Nominals" window when a point is bumped. It actually shows both nominals and vector from the point projected onto the Cad Model. Looking further, I found that the object CadModel.CADProjectPoint is the object that will produce the same results as the Cad Verify menu produces.

    Current Script Condition:
    As of now, I am unable to get CadModel.CADProjectPoint to work. This function has type ENUM_CAD_RESULT. Clicking on this in the help menus show that the values are -1, 0, 2, and 1. This would suggest that the function should be assigned to an Integer value (as seen in the script).

    Other questions I have pertain to the last returned value "CadHandle". CadHandle is an object that, as far as I can tell, seems to represent an instance of the Cad Model in the Graphics Dislpay Window (could be wrong about this) and somehow must be defined prior to using CadModel.CADProjectPoint. The members are CadSequence, Collection, PartInstanceID, and SubCadId. Funny there is no description for CadHandle and not much in the way of showing how it is used.

    Also seeing a ENUM_CAD_COLLECTION. Each of these members starts with HCAD_. Because I am dealing with projecting points onto cad surfaces, HCAD_SURFACE (value = 1) may be my best bet when defining CadHandle.collection.

    Notes on LoadLine:
    I am currently importing the line feature I use to load each measured feature's value in to it. Tried creating it in the script but I must be missing something because the script created line does not produce the drop_point values seen when I import/dmis line. Here's the .dmi file I import below my net pad hits (10 total);

     DMISMN/LIN1.dmi
     FILNAM/LIN1.dmi
    F(LIN1)=FEAT/MEAS_LINE,UNBND,CART,722.23,760.92,1593.72,0.9999999,0.0002614,$
      -0.0002259,0,0,1
    MEAS/LINE,F(LIN1),2
        PTMEAS/CART,0,0,0,0,0,1,RMS=N/A,
        PTMEAS/CART,0,0,0,0,0,1,RMS=N/A,
    ENDMES
    ENDFIL
    


    Any further thought would be appreciated pertaining to the script set-up procedure for accessing the cad model in the Graphics Display Window or the use of object CadModel.CADProjectPoint.

    Alien​​​​​​​​​​​​​​
Children
No Data