hexagon logo

VB.NET .GetVariableValue("NAME")

How do you pull variable values from PCD program using VB.NET?

I know how to do it with VBA and BASIC etc.... but how do you do it with VB.NET, I can get variable name but no values!

Any help, thanks.

***Edit***

My code works I just hadn't ran PcD to 'load' the variables with values....HAHAHAHA!!!!!!!!!!!!!!!
  • There are also some 'brackets' through the command.Type DIMENSION_TRUE_START_POSITION, DIMENSION_TRUE_END_POSITION, DIMENSION_START_LOCATION and DIMENSION_END_LOCATION. The START part is a good place to grab the dimension ID, and the END part the place to forget the ID again.

    A warning for the future - my FEATUREEXPORT.BAS (which is used commercially) is 479 lines long. It includes handling of FCF and [most] composite dimensions, but not simultaneous or SIZE, yet...
    (And it surely contains some bugs...)


    Thanks for your input more to think about for future edits, there is so much more I would like to do but CMM programs are my priority and writing this code can only happen on my 'down' time. Implementing error handling and logging is what I'm wanting to include badly and then beef up the rest.



    Thanks for sharing


    Most definitely!
  • Never posted my output. In case any of you were wondering...here it is.
    This is a CSV file.























































































































































































































































































































































































































































































































































































































































































































    Serial Number: 10
    Part Number: Deleted
    Work Order: Deleted
    Part Revision: A
    Time: 9:50:17 AM
    Date: 7/26/2017
    Dimension Feature Axis Segment Nom Meas UTOL LTOL
    D5_1 M 0.1 0.09754 0.01 0.01
    D5_2 M 0.1 0.0976 0.01 0.01
    D5_3 M 0.1 0.09892 0.01 0.01
    D5_4 M 0.1 0.09924 0.01 0.01
    D5_5 M 0.1 0.10164 0.01 0.01
    D5_6 M 0.1 0.09914 0.01 0.01
    D6_1 R 0.187 0.18763 0.01 0.01
    D6_2 R 0.187 0.18766 0.01 0.01
    D6_3 R 0.187 0.18772 0.01 0.01
    D6_4 R 0.187 0.1877 0.01 0.01
    D7_1 R 0.13 0.12956 0.03 0.03
    D7_2 R 0.13 0.12999 0.03 0.03
    D7_3 R 0.13 0.13004 0.03 0.03
    D7_4 R 0.13 0.13195 0.03 0.03
    D7_5 R 0.13 0.12985 0.03 0.03
    D7_6 R 0.13 0.13126 0.03 0.03
    D7_7 R 0.13 0.13178 0.03 0.03
    D7_8 R 0.13 0.13073 0.03 0.03
    D7_9 R 0.13 0.13228 0.03 0.03
    D7_10 R 0.13 0.13182 0.03 0.03
    D7_11 R 0.13 0.12943 0.03 0.03
    D7_12 R 0.13 0.13355 0.03 0.03
    D8_1 D 0.129 0.13041 0.005 0.001
    D8_2 D 0.129 0.13041 0.005 0.001
    D9 D 0.65 0.65312 0.01 0.001
    D10 Z 0.438 0.43838 0.01 0.01
    D11 M 0.875 0.87462 0.01 0.01
    D13 Y 0.65 0.65148 0.01 0.01
    D14 Z 0.875 0.87278 0.01 0.01
    D15_1 R 0.12 0.12054 0.03 0.03
    D15_2 R 0.12 0.1221 0.03 0.03
    D15_3 R 0.12 0.12071 0.03 0.03
    D16 X 2.38 2.38106 0.03 0.03
    D17 M 1.3 1.30136 0.03 0.03
    D18 D 0.562 0.56346 0.008 0.001
    D19 M 0.3 0.30005 0.01 0.01
    D20 M 0.15 0.15002 0.03 0.03
    D21 M 0.65 0.64988 0.03 0.03
    D22 M 0.875 0.87298 0.01 0.01
    D23_1 M 1.3 1.30026 0.01 0.01
    D23_2 M 1.3 1.30069 0.01 0.01
    D25_1 X 0.725 0.72463 0.01 0.01
    D25_2 X 0.725 0.7248 0.01 0.01
    D26_1 M 1.1 1.10057 0.01 0.01
    D26_2 M 1.1 1.10003 0.01 0.01
    D27_1 R 0.12 0.12137 0.03 0.03
    D27_2 R 0.12 0.12125 0.03 0.03
    D28_1 D 0.188 0.19185 0.005 0.001
    D28_2 D 0.188 0.19186 0.005 0.001
    D28_3 D 0.188 0.19184 0.005 0.001
    D28_4 D 0.188 0.19184 0.005 0.001
    D29_1 D 0.312 0.31583 0.006 0.001
    D29_2 D 0.312 0.31591 0.006 0.001
    D29_3 D 0.312 0.31572 0.006 0.001
    D29_4 D 0.312 0.31559 0.006 0.001
    D30_1 M 0.2 0.20201 0.01 0.01
    D30_2 M 0.2 0.20203 0.01 0.01
    D30_3 M 0.2 0.20208 0.01 0.01
    D30_4 M 0.2 0.20195 0.01 0.01

  • Awesome work! I'm just now starting to dabble in VB.NET myself but i have to ask the question...

    why didn't you just use the excel output built into PCD?
  • Awesome work! I'm just now starting to dabble in VB.NET myself but i have to ask the question...

    why didn't you just use the excel output built into PCD?


    Thanks! VB.NET is cool, most people say to work with C# instead but meh gets the job done. Why not the built in excel? To make life interesting! On a more serious note... RANGES in a report. Mostly everything out there is built around the FAI but I need to be able to populate ranges (high/low) along with FAIs. Plus GUIs, SQL, PLC programming, etc... Output to a CSV isn't the reason for my exploration into witting this more like an excuse.

    AND the reason why most of "us" get into it....cuz it's cool/fun!

    You'd have to play around with the p2x file to get the output in the format shown above, instead of investing the time in that and implementing it to all my programs (a subroutine would probably be best) and maintenance it is just so much easier writing a widget in VB.NET IMHO.
  • It definitely does make things interesting. You can make PCD do some really cool things with VB.NET.

    the ranges thing i completely understand. But we also have DataPage+ for that. Slight smile

    again, nice work. I had to write a VBA script for a customer who didn't buy datapage but wanted their data sorted in excel. Had to teach myself how to do that in a couple of days.
  • Never had DataPage+ up until recently and I'm not proud to say but I have no idea how to use it. I'm sure it's very easy to use once you've been using it for a while and I'm sure it's super powerful. I've probably only started it up once over a year ago.

    Thanks!
  • I'm with Kp61. I've been unable to get DP+ to work with PC-DMIS 2017 yet. I've tried just about everything you find in the help in both PC-DMIS and DP+. To say the least, it's confusing. I'm trying to use the STATS/ON command but keep getting and error Database[] could not be opened. I can't get anything to show up when I hit the "TEST CONNECTION" button. I've even tried the Demo database and it still doesn't work. Anyone have any idea how to get this working and what exactly I have to do?
  • Could be an admin rights issue...Unfortunately i don't know a whole lot about DP+. Disappointed
  • Update on my VB.NET venture.

    For those of you who program the same style as I do it will make sense. I program from top down (obviously) starting from alignment, geometry, constructions, and dimensions respectively. It's pretty basic for the most part until I get into dimensioning. I like to follow a ballooned drawing in a sequential order, I use report comments to define the balloon # and dimension description like this:

    COMMENT/REPT,
                97. Ø16
                _____________________________________________________________________________________
    DIM D97= LOCATION OF CIRCLE CIR19  UNITS=MM ,$
    GRAPH=OFF  TEXT=OFF  MULT=10.00  OUTPUT=BOTH  HALF ANGLE=NO
    AX    NOMINAL       +TOL       -TOL       MEAS        DEV     OUTTOL
    D      16.00+0     0.2000     0.2000    16.0024     0.0024     0.0000 ----#----
    END OF DIMENSION D97
                COMMENT/REPT,
    
    


    I also add a report comment with 2 spaces to place a gap between dims for visual clarity. Why all the redundant work? Well...I sell reports to just about anyone you can think about in the aerospace gig and none of them have a CMM background, so I try to make it as easy for them as pie.

    BUT!

    Creating comments takes long and it's redundant as heck not to mention all the typos I make that QEs call me out on or THE COSTUMER when QEs also miss my typos. Also, I copy and paste comments a bunch to try to save time but I forget to update the balloon number!

    Our QE department uses a ballooning software that generates a balloon drawing and an Excel workbook with Form 1-3 of AS9102. All the dimensions I type in are already on Form 3 sheet, but copying from Excel may seem like a good idea but slows the process EVEN further.

    My solution:



    A COMMENT creator! (Patent Pending jk!)


    Upon attaching an Excel workbook it imports all dimension text and as you increase/decrease the balloon# it cycles thru corresponding dimension. It matches the dim# with the widgets "Enter Balloon #" and as I click "Create" it increments the widgets balloon #. Don't have data as far as how much faster this is compared to my old manual method but IMO it is much faster and IF any typos exists I can blame it back on the COPS (QEs) as they generate those Excel sheets haha!

    You can also manually overwrite any text or skip importing excel sheets and type them out manually.

    KP61dude!