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
  • Responce #5:
    AndersI, first off, thanks for all you do for everyone on the boards here. I see your posts throughout issues I look up all the time and appreciate your contributions!

    Just did a test to check and see if "value" works versus enumeration "member" in a field that holds this type of information. Code below works both ways. First line under loop is commented out (which I've been using in my script). The second line where "DmisCmd.Feature = 4" is the enumeration value for F_LINE in the commented line.

    For Each DmisCmd In Cmds
    '        If DmisCmd.isFeature And DmisCmd.Feature = F_LINE  Then
            If DmisCmd.isFeature And DmisCmd.Feature = 4 Then
    .
    .
    .
    


    History of why I want to write this script:
    The script I'm writing to try and access the Graphics Display Window where my cad model resides pertains to me wanting to "OverRide Nominals" of points I measured using our Laser Tracker. After measuring net pads (we take 5 hits (vector_points) on each pad) on our tooling here at Fiat-Chrysler Automobiles, we have to go back and bump each point measured against the cad mode in the Graphics Display Window to aquire the proper nominal value for each point.

    Having anywhere from 6 to 30 net pads on any given piece of tooling out on the body shop floor, this means right-clicking on each vector point in the Edit Window (Summary Mode) and then selecting "Feature/OverRide Nominals", then clicking on the appropriate surface in the Graphics Display Window, check the surface highlighted surface in the "OverRide Nominals" window, and then click on the "Drop Point" values and click the OverRide Button. Not too hard to do, but time consuming.

    Script Benefits:
    The benefit for having a script that accesses the cad model in the Graphics Display Window could be used for all Tracker users and possibly even those that use PC-DMIS Scanning software. I've seen a lot of post on the boards pertaining to users trying to acquire nominal from Graphics Display Window after producing measured scans. I myself do not use PC-DMIS Scanning software and may never in the future, but never say never, ha.

    Current Script Conditions:
    Prior to looking into the CadModel.CADProjectPoint object, I was poking around trying to find a way to reproduce the override nominal values seen in the OverRide Nominals Window. What I came up with was this;

    *Read in the nominal and measured data from 2 net pad measurements (5 points on each net pad) and load it into the NetData(1 To 400,1 To 11) array. (Sub routine GetNetData).
    Col 1-3 will eventually represent the nominal value of the measured hit projected onto the cad model (x, y, and z, OverRide Nominal values).
    Col 4-6 represents the measured x, y, and z values of each hit on the net pad
    Col 7-9 represents the measured i,j, and k values of each hit on the net pad. (relative to tracker alignment at time of tool shoot).
    Col 10 represents the feature ID of each measured hit. (Hit name must have the word "NET" in it).
    Col 11 not used.

    *Load a LINE feature with the xyz measured values and ijk measured values from a net pad hit into "both" the Theoretical and Actuals xyz and ijk fields of the line. (Sub routine LoadLine). More about this line feature later!

    *Next, I construct a drop_point from the net pad hit (REF1) and the loaded LINE (REF2). (Sub routine CreateDrop). I write these drop_point theoretical values back out into spots 1-3 of the NetData array.

    This construction produces a point that has nominals very close to what is seen in the OverRide Nominals Window. They are slightly different because the ijk vector values of the measured hit (and subsequently the loaded line) are picked up and created from the tracker alignment which is not the same as the Cad Model alignment which is theoretically perfect and in car body position.

    Not wanting to be sloppy, (and always striving for perfection (OCD)), I kept searching for other possibilities to achieve perfect data. Below is the script and subroutines;

Reply
  • Responce #5:
    AndersI, first off, thanks for all you do for everyone on the boards here. I see your posts throughout issues I look up all the time and appreciate your contributions!

    Just did a test to check and see if "value" works versus enumeration "member" in a field that holds this type of information. Code below works both ways. First line under loop is commented out (which I've been using in my script). The second line where "DmisCmd.Feature = 4" is the enumeration value for F_LINE in the commented line.

    For Each DmisCmd In Cmds
    '        If DmisCmd.isFeature And DmisCmd.Feature = F_LINE  Then
            If DmisCmd.isFeature And DmisCmd.Feature = 4 Then
    .
    .
    .
    


    History of why I want to write this script:
    The script I'm writing to try and access the Graphics Display Window where my cad model resides pertains to me wanting to "OverRide Nominals" of points I measured using our Laser Tracker. After measuring net pads (we take 5 hits (vector_points) on each pad) on our tooling here at Fiat-Chrysler Automobiles, we have to go back and bump each point measured against the cad mode in the Graphics Display Window to aquire the proper nominal value for each point.

    Having anywhere from 6 to 30 net pads on any given piece of tooling out on the body shop floor, this means right-clicking on each vector point in the Edit Window (Summary Mode) and then selecting "Feature/OverRide Nominals", then clicking on the appropriate surface in the Graphics Display Window, check the surface highlighted surface in the "OverRide Nominals" window, and then click on the "Drop Point" values and click the OverRide Button. Not too hard to do, but time consuming.

    Script Benefits:
    The benefit for having a script that accesses the cad model in the Graphics Display Window could be used for all Tracker users and possibly even those that use PC-DMIS Scanning software. I've seen a lot of post on the boards pertaining to users trying to acquire nominal from Graphics Display Window after producing measured scans. I myself do not use PC-DMIS Scanning software and may never in the future, but never say never, ha.

    Current Script Conditions:
    Prior to looking into the CadModel.CADProjectPoint object, I was poking around trying to find a way to reproduce the override nominal values seen in the OverRide Nominals Window. What I came up with was this;

    *Read in the nominal and measured data from 2 net pad measurements (5 points on each net pad) and load it into the NetData(1 To 400,1 To 11) array. (Sub routine GetNetData).
    Col 1-3 will eventually represent the nominal value of the measured hit projected onto the cad model (x, y, and z, OverRide Nominal values).
    Col 4-6 represents the measured x, y, and z values of each hit on the net pad
    Col 7-9 represents the measured i,j, and k values of each hit on the net pad. (relative to tracker alignment at time of tool shoot).
    Col 10 represents the feature ID of each measured hit. (Hit name must have the word "NET" in it).
    Col 11 not used.

    *Load a LINE feature with the xyz measured values and ijk measured values from a net pad hit into "both" the Theoretical and Actuals xyz and ijk fields of the line. (Sub routine LoadLine). More about this line feature later!

    *Next, I construct a drop_point from the net pad hit (REF1) and the loaded LINE (REF2). (Sub routine CreateDrop). I write these drop_point theoretical values back out into spots 1-3 of the NetData array.

    This construction produces a point that has nominals very close to what is seen in the OverRide Nominals Window. They are slightly different because the ijk vector values of the measured hit (and subsequently the loaded line) are picked up and created from the tracker alignment which is not the same as the Cad Model alignment which is theoretically perfect and in car body position.

    Not wanting to be sloppy, (and always striving for perfection (OCD)), I kept searching for other possibilities to achieve perfect data. Below is the script and subroutines;

Children
No Data