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
  • I've never tried that function, but note that it is a function and you are calling it as a subroutine. I would start by adding a "Result =" at the beginning of the line and declare Result as a suitable type (32 bit unsigned integer?).

    Looking at the function definition in the type library, it agrees on the 13 arguments,

        function CADProjectPoint(pointX: Double; pointY: Double; pointZ: Double;
                                 geometryFilterFlags: ENUM_CAD_GEOMETRY_FILTER_FLAGS;
                                 vectorOption: ENUM_CAD_VECTOR_OPTION;
                                 surfaceBoundaryOption: ENUM_CAD_SURFACE_BOUNDARY_OPTION;
                                 out pProjectPointX: Double; out pProjectPointY: Double;
                                 out pProjectPointZ: Double; out pProjectVectorI: Double;
                                 out pProjectVectorJ: Double; out pProjectVectorK: Double;
                                 out pCadHandle: ICadHandle): ENUM_CAD_RESULT; dispid 7;
    


    but your last one - 2 - is almost certainly wrong, as it is an OUT parameter - it must be a variable!
Reply
  • I've never tried that function, but note that it is a function and you are calling it as a subroutine. I would start by adding a "Result =" at the beginning of the line and declare Result as a suitable type (32 bit unsigned integer?).

    Looking at the function definition in the type library, it agrees on the 13 arguments,

        function CADProjectPoint(pointX: Double; pointY: Double; pointZ: Double;
                                 geometryFilterFlags: ENUM_CAD_GEOMETRY_FILTER_FLAGS;
                                 vectorOption: ENUM_CAD_VECTOR_OPTION;
                                 surfaceBoundaryOption: ENUM_CAD_SURFACE_BOUNDARY_OPTION;
                                 out pProjectPointX: Double; out pProjectPointY: Double;
                                 out pProjectPointZ: Double; out pProjectVectorI: Double;
                                 out pProjectVectorJ: Double; out pProjectVectorK: Double;
                                 out pCadHandle: ICadHandle): ENUM_CAD_RESULT; dispid 7;
    


    but your last one - 2 - is almost certainly wrong, as it is an OUT parameter - it must be a variable!
Children
No Data