Learning coding

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Learning coding

    Where did you all learn coding?

    I have one very basic code that was mainly copied from on here but I want to do more. So where did everyone learn this? Coworkers, books, Google, YouTube, classes, guy in a van down by the river??? What reading materials/websites/videos/classes/guys in vans by rivers would you recommend? I am going to take the free (until June) "VB.Net for PC-DMIS 301" class online probably this weekend. I see what you guys are having DMIS do with coding and I see how it can greatly help here at my job so I want to learn as much as I can. I'm the kind of person that is thirsty for knowledge and can't learn enough. My boss has had conversations with the owner and myself about sending me to classes at the local community college and they are all for it but that's on hold until this virus blows over.

    Any recommendations you guys have are greatly appreciated.
    Remembering my beautiful wife Taz who's life was lost on 6-13-2020. I love you and I miss you.

  • #2
    Learning has to be fun. Coding is like learning to speak a new language or playing an instrument. Hearing someone play violin or reading a book on it isn't enough to pick up one up and play music. It takes doing and practice, practice, practice! Start small and work your way up to harder projects. For me the fastest thing was to familiarize myself with code syntactically, learning where to use it or where to apply or how a computer works took a bit longer.

    Learning code has been a lonely road for me, I never met anyone else that could mentor me. Google/YouTube played a major part in the beginning, they paved the way to learn enough to go to a book store and have the ability to recognize a 'good' book. Second, forums and the people therein, they're amazing, though don't ever attempt to force someone to hold your hand, do your homework (StackOverflow folks are ruthless! haha). Reading the developers manual/notes. Other people's code (it's everywhere). Make it a personal hobby and not just practice at work. Did I mention practice? Don't talk about it - it will cause your brain into thinking you're doing something productive but you're just chomping at the gums, instead refrain and unleash your desires (or whatever you want to call it) with more practice!

    EDIT: Oh and by the way "VB.Net for Pc-Dmis 301" I can't recommend enough! I took it shortly when it became available.
    Last edited by Kp61dude!; 04-03-2020, 10:59 AM.
    PcDmis 2015.1 SP10 CAD++
    Global 7-10-7 DC800S

    Comment


    • #3
      Hi,
      I think to have Coworkers who can teach coding is the best what could happen. In my case, the most helpful was this forum and PC DMIS help files (for functions). Now the important thing for me is to have a clear task of what I need to do and the second important thing was the recognition of useful possibilities of what I can do. The first idea of ​​coding was to write a script which should calculate general tolerances of dimensions depending on dimension size. By trying to get an idea how to write that script I searched info in this forum and in the same time I found other useful possibilities what I can do. First of those possibilities was a script for export data to excel, I found a script which working and have potency. Then I played and played and played on a script for export to excel, to get the best of what I could imagine, for info I always returned to this forum. To idea about script calculating general tolerances I returned maybe after 6 months and after few finished other scripts. I am sure, in this case learning for learning not the best thing to do.

      Comment


      • #4
        At university I took one class which taught VB6. It was pretty basic (no pun intended) but just being able to drag and drop controls onto a form and then do simple stuff (add items to a list box, change the text of a label depending on which radio button was clicked etc) was an eye opener.

        I then did a work placement and worked closely with the IT guy who was great with Excel (among other things) and then I learnt I could combine the two with Macros (VBA).

        I also did a great class on databases (in which we didn't even touch a computer once!) - probably one of the most important classes I ever took.

        I continued with this (VB6/VBA and databases) through a range of temp jobs after Uni and in my first engineering job, then when I went to work for Hexagon I took over VB duties for PC-Dmis related stuff.

        Apart from one class it's all self taught, however I think working with automating a piece of software you already know (like automating PC-Dmis or Excel) is a great way of learning, as you're already familiar with the objects (part programs, commands, or workbooks or worksheets etc) so it makes getting your head round objects and methods and properties much easier.

        Automettech - Automated Metrology Technology

        Comment


        • #5
          Ok, I just finished the Automating PC-DMIS online course... Where should I go next to learn more about how to use this with DMIS?
          Remembering my beautiful wife Taz who's life was lost on 6-13-2020. I love you and I miss you.

          Comment


          • #6
            Originally posted by A-machine-insp View Post
            Ok, I just finished the Automating PC-DMIS online course... Where should I go next to learn more about how to use this with DMIS?
            A fun one for me was to re-create a scripts that floating around here somewhere that takes all programs in a directory and reads all of the probes used and tips for each one. I adopted to use as much Object Oriented Programming as I could, what a blast!

            I would create small checker/helper programs to assist you in developing part routines... think of the one thing you always forget to do when writing Pc-Dmis part programs.... like forgetting to change that pesky default tolerance you forgot to correct.

            Another would be to figure out how to send arguments to console applications and/or how to fire console .exe from within Pc-Dmis.
            PcDmis 2015.1 SP10 CAD++
            Global 7-10-7 DC800S

            Comment


            • #7
              Originally posted by Kp61dude! View Post

              A fun one for me was to re-create a scripts that floating around here somewhere that takes all programs in a directory and reads all of the probes used and tips for each one. I adopted to use as much Object Oriented Programming as I could, what a blast!

              I would create small checker/helper programs to assist you in developing part routines... think of the one thing you always forget to do when writing Pc-Dmis part programs.... like forgetting to change that pesky default tolerance you forgot to correct.

              Another would be to figure out how to send arguments to console applications and/or how to fire console .exe from within Pc-Dmis.
              Do you have some examples on here that you can point me to? We are incredibly slow so my boss is letting me spend as much training time as I want, just what I needed to start learning this.
              Remembering my beautiful wife Taz who's life was lost on 6-13-2020. I love you and I miss you.

              Comment


              • #8
                One major improvement with automating PCDMIS I learned along the way was using a "BackgroundWorker" (there are other ways to accomplish this as well) to execute certain tasks. One thing you'll eventually notice is that when you hit a button and the buttons "freeze" until the code block(s) finish executing, running a part program for example.

                Below is an example of launching pcdmis with a BackgroundWorker. I just copied and pasted this so if you have a question about what something is let me know

                Code:
                using System;
                using System.Collections.Generic;
                using System.Linq;
                using System.Text;
                using System.Windows;
                using System.Windows.Controls;
                using System.Windows.Data;
                using System.Windows.Documents;
                using System.Windows.Input;
                using System.Windows.Media;
                using System.Windows.Media.Imaging;
                using System.Windows.Navigation;
                using System.Windows.Shapes;
                using PCDLRN;
                using Microsoft.VisualBasic;
                using System.Diagnostics;
                using System.IO.Compression;
                using System.Threading;
                using System.Runtime.InteropServices;
                using System.ComponentModel;
                using System.Windows.Interop;
                
                namespace PCD_Operator_App
                {
                    /// <summary>
                    /// Interaction logic for LoadScreen.xaml
                    /// </summary>
                    public partial class LoadScreen : Window
                    {
                        private const int GWL_STYLE = -16;
                        private const int WS_SYSMENU = 0x80000;
                
                        [DllImport("user32.dll", SetLastError = true)]
                        private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
                
                        [DllImport("user32.dll")]
                        private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
                
                        public LoadScreen()
                        {
                            InitializeComponent();
                
                            BackgroundWorker backgroundStartup = new BackgroundWorker();
                            backgroundStartup.WorkerReportsProgress = true;
                            backgroundStartup.DoWork += startup_DoWork;
                            backgroundStartup.ProgressChanged += startup_ProgressChanged;
                            backgroundStartup.RunWorkerCompleted += startup_RunWorkerCompleted;
                            backgroundStartup.RunWorkerAsync();
                        }
                        void startup_DoWork(object sender, DoWorkEventArgs e)
                        {
                            bool startCondition = true;
                
                            Process[] pcdStartupCheck = Process.GetProcessesByName("PCDLRN");
                            if (pcdStartupCheck.Length > 0)
                            {
                                startCondition = false;
                            }
                            else
                            {
                                Type PCDRLN_Application = null;
                                object PCDObj = null;
                
                                PCDLRN.Application PCDApp = null;
                
                                try
                                {
                                    PCDRLN_Application = Type.GetTypeFromProgID("PCDLRN.Application");
                
                                    PCDObj = Activator.CreateInstance(PCDRLN_Application);
                                }
                                catch (System.Exception em)
                                {
                                    MessageBox.Show(em.Message);
                                }
                
                                PCDApp = new PCDLRN.Application();
                
                                PCDApp.OperatorMode = true;
                
                                PCDApp.Visible = false;
                
                                PCDApp.ApplicationEvents.OnMachineConnected += new IApplicationEvents_OnMachineConnectedEventHandler(onMachineConnect);
                
                                void onMachineConnect(Machine machine)
                                {
                                    //MessageBox.Show("machine connected");
                                    //loadScreenStatus.Content = "PC-DMIS active, connecting to machine...";
                
                                    startCondition = false;
                                }
                
                                if (startCondition)
                                {
                                    WindowSearcher homeWindowSearch = new WindowSearcher();
                                    homeWindowSearch.BeginWindowLook_Home();
                                }
                            }
                        }
                
                        void startup_ProgressChanged(object sender, ProgressChangedEventArgs e)
                        {
                            
                        }
                
                        void startup_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
                        {
                            new MainWindow().Show();
                
                            this.Close();
                        }
                
                        private void WindowLoaded(object sender, RoutedEventArgs e)
                        {
                            var hwnd = new WindowInteropHelper(this).Handle;
                            SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
                        }
                    }
                }

                Comment


                • Kp61dude!
                  Kp61dude! commented
                  Editing a comment
                  multi threaded programs is another name for them.

                • CodeWarrior
                  CodeWarrior commented
                  Editing a comment
                  Yeah I blanked on that word. Good catch

              • #9
                Originally posted by CodeWarrior View Post
                One major improvement with automating PCDMIS I learned along the way was using a "BackgroundWorker" (there are other ways to accomplish this as well) to execute certain tasks. One thing you'll eventually notice is that when you hit a button and the buttons "freeze" until the code block(s) finish executing, running a part program for example.

                Below is an example of launching pcdmis with a BackgroundWorker. I just copied and pasted this so if you have a question about what something is let me know

                Code:
                using System;
                using System.Collections.Generic;
                using System.Linq;
                using System.Text;
                using System.Windows;
                using System.Windows.Controls;
                using System.Windows.Data;
                using System.Windows.Documents;
                using System.Windows.Input;
                using System.Windows.Media;
                using System.Windows.Media.Imaging;
                using System.Windows.Navigation;
                using System.Windows.Shapes;
                using PCDLRN;
                using Microsoft.VisualBasic;
                using System.Diagnostics;
                using System.IO.Compression;
                using System.Threading;
                using System.Runtime.InteropServices;
                using System.ComponentModel;
                using System.Windows.Interop;
                
                namespace PCD_Operator_App
                {
                /// <summary>
                /// Interaction logic for LoadScreen.xaml
                /// </summary>
                public partial class LoadScreen : Window
                {
                private const int GWL_STYLE = -16;
                private const int WS_SYSMENU = 0x80000;
                
                [DllImport("user32.dll", SetLastError = true)]
                private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
                
                [DllImport("user32.dll")]
                private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
                
                public LoadScreen()
                {
                InitializeComponent();
                
                BackgroundWorker backgroundStartup = new BackgroundWorker();
                backgroundStartup.WorkerReportsProgress = true;
                backgroundStartup.DoWork += startup_DoWork;
                backgroundStartup.ProgressChanged += startup_ProgressChanged;
                backgroundStartup.RunWorkerCompleted += startup_RunWorkerCompleted;
                backgroundStartup.RunWorkerAsync();
                }
                void startup_DoWork(object sender, DoWorkEventArgs e)
                {
                bool startCondition = true;
                
                Process[] pcdStartupCheck = Process.GetProcessesByName("PCDLRN");
                if (pcdStartupCheck.Length > 0)
                {
                startCondition = false;
                }
                else
                {
                Type PCDRLN_Application = null;
                object PCDObj = null;
                
                PCDLRN.Application PCDApp = null;
                
                try
                {
                PCDRLN_Application = Type.GetTypeFromProgID("PCDLRN.Application");
                
                PCDObj = Activator.CreateInstance(PCDRLN_Application);
                }
                catch (System.Exception em)
                {
                MessageBox.Show(em.Message);
                }
                
                PCDApp = new PCDLRN.Application();
                
                PCDApp.OperatorMode = true;
                
                PCDApp.Visible = false;
                
                PCDApp.ApplicationEvents.OnMachineConnected += new IApplicationEvents_OnMachineConnectedEventHandler(onMachineConnect);
                
                void onMachineConnect(Machine machine)
                {
                //MessageBox.Show("machine connected");
                //loadScreenStatus.Content = "PC-DMIS active, connecting to machine...";
                
                startCondition = false;
                }
                
                if (startCondition)
                {
                WindowSearcher homeWindowSearch = new WindowSearcher();
                homeWindowSearch.BeginWindowLook_Home();
                }
                }
                }
                
                void startup_ProgressChanged(object sender, ProgressChangedEventArgs e)
                {
                
                }
                
                void startup_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
                {
                new MainWindow().Show();
                
                this.Close();
                }
                
                private void WindowLoaded(object sender, RoutedEventArgs e)
                {
                var hwnd = new WindowInteropHelper(this).Handle;
                SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
                }
                }
                }
                Um... yeah... I question all of it. This is my first time getting into any kind of programming except programming part programs in DMIS. Maybe I should have them send me to the local community college for classes.
                Remembering my beautiful wife Taz who's life was lost on 6-13-2020. I love you and I miss you.

                Comment


                • #10
                  Originally posted by A-machine-insp View Post

                  Um... yeah... I question all of it. This is my first time getting into any kind of programming except programming part programs in DMIS. Maybe I should have them send me to the local community college for classes.
                  I bought a book here that got me started, I liked it a lot. Answered a lot of questions not regarding pc-dmis. Now that I've taken a few college level courses in coding, a lot of them follow these books very closely. Learning this will start to happen much quicker as you go along, like putting a puzzle together

                  https://www.amazon.com/Microsoft-Vis...a-527352025378

                  Comment


                  • #11
                    Originally posted by CodeWarrior View Post

                    I bought a book here that got me started, I liked it a lot. Answered a lot of questions not regarding pc-dmis. Now that I've taken a few college level courses in coding, a lot of them follow these books very closely. Learning this will start to happen much quicker as you go along, like putting a puzzle together

                    https://www.amazon.com/Microsoft-Vis...a-527352025378
                    I have a few books downloaded that I am going through and I will give this book a look too. Is there anywhere I can find things specific to DMIS?
                    Remembering my beautiful wife Taz who's life was lost on 6-13-2020. I love you and I miss you.

                    Comment


                    • #12
                      Originally posted by A-machine-insp View Post

                      I have a few books downloaded that I am going through and I will give this book a look too. Is there anywhere I can find things specific to DMIS?
                      I haven't found much information on stuff specific to PC DMIS other than the hexagon notes:

                      https://docs.hexagonmi.com/pcdmis/20...g_Started.html

                      When I have a little time I could pass along some simple examples with notes

                      Comment


                      • #13
                        Originally posted by CodeWarrior View Post

                        I haven't found much information on stuff specific to PC DMIS other than the hexagon notes:

                        https://docs.hexagonmi.com/pcdmis/20...g_Started.html

                        When I have a little time I could pass along some simple examples with notes
                        It would be much appreciated. Ill message you my email address.
                        Remembering my beautiful wife Taz who's life was lost on 6-13-2020. I love you and I miss you.

                        Comment


                        • CodeWarrior
                          CodeWarrior commented
                          Editing a comment
                          No problem at all, I'll send some your way after I'm done testing them

                      • #14
                        'coding'. It all depends on what yo mean by 'coding'. I learned on DOS 3.1
                        sigpic
                        Originally posted by AndersI
                        I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

                        Comment


                        • #15
                          Originally posted by Matthew D. Hoedeman View Post
                          'coding'. It all depends on what yo mean by 'coding'. I learned on DOS 3.1
                          Really showing your age there arent you...
                          Remembering my beautiful wife Taz who's life was lost on 6-13-2020. I love you and I miss you.

                          Comment


                          • Peter Fuller
                            Peter Fuller commented
                            Editing a comment
                            Learned the same way. Fell pretty old too, the last person I worked with was born 2 years after I started programming in PC-DMIS.
                        widgetinstance 190 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                        Working...
                        X