hexagon logo

Excel to PC-DMIS and back again

So my company uses Excel to store our info and I am writing 2 VB scripts. The first script is executed at the start of the part program after the alignment and, after some user inputs, selects the correct excel file and imports the nominals and tolerances from the spreadsheet to the dimensions. At the end of the program a second script runs which exports the measured values of each dimension back to the spreadsheet. The problem however is that not all of the features are measured each time the part program is executed. I want the user to be able to skip measurements that are not needed. My script doesn't differentiate between skipped dimensions and measured so it might export an inaccurate value to the excel sheet. I am trying to solve this problem by having the first script also set the measured values of each feature based on the excel sheet. That way the value on the excel sheet will remain unchanged when the second script writes to it. The other possible solution is to only export values that were measured in the part program but I don't know any way to have the script determine that. Is there a function the returns whether a feature was measured or skipped during the current execution? Anyway my biggest problem is that I don't know the syntax to change the measured Z position of a feature to a value from excel. This is the code I have but it returns an error saying that it does not recognize "ZActual." Is there a good reference for syntax somewhere?

If Cmd.IsFeature then
Set DcmdID = Cmd.FeatureCommand
DimID = DCmdID.ID

If DimID = "HEAT PACK TOP" then
DCmd.ZActual = xlsheet.Range("J39").Value
End If
'repeat for a bunch of other features
End If

Any suggestions or solutions would be appreciated. Thanks.
Parents
  • I find the export to excel option not to work very well. If you just need the raw data, the export to "generic" works well. It sends the data to a text file that can then be opened in excel as a comma separated file. It give the X, Y, Z, I, J, & K values for each feature followed by the same for each hit in that feature. If there is anything like diameter or length associated with the feature then it gives those as well.

    As to getting the data to go to a single sheet every time, just change the basic script that is exporting the data. Look for a line that identifies the excel file. It should contain something like "C:\Excel Stuff\Cool files\Parts and stuff.xls" If it is creating a new one, change it so that it opens an existing one. Then change the name of the file it references to the name of the file that you want it to open. Not having seen the code you are working with this is the best general answer I can give.
Reply
  • I find the export to excel option not to work very well. If you just need the raw data, the export to "generic" works well. It sends the data to a text file that can then be opened in excel as a comma separated file. It give the X, Y, Z, I, J, & K values for each feature followed by the same for each hit in that feature. If there is anything like diameter or length associated with the feature then it gives those as well.

    As to getting the data to go to a single sheet every time, just change the basic script that is exporting the data. Look for a line that identifies the excel file. It should contain something like "C:\Excel Stuff\Cool files\Parts and stuff.xls" If it is creating a new one, change it so that it opens an existing one. Then change the name of the file it references to the name of the file that you want it to open. Not having seen the code you are working with this is the best general answer I can give.
Children
No Data