586,068 active members*
3,615 visitors online*
Register for free
Login
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2005
    Posts
    20

    Post Selecting patterns to cut within G-code

    This is kind of a odd question. I have a frined who programs in Xilog and he has a big program that can do 16 different features (a shape fully defined by code). The problem he is having is how to send the program a parameter that would describe what combination of the 16 different features he wants cut. He only has a few open parameters to send this feature list encoded into a singel number. I was thinking of having him send a binary number like 1001011100011010 in on 1 parameter. A 1 would say to cut that parameter and a 0 would say skip that paramter. All sounds good so far. Now is where the problem comes in. How do I decode the long binary number into chunks to say yes/no to each feature. I dont know all the math functions he has available but I believe they are just basic addition subtraction etc.
    Does any one have any thoughts or ideas on how to go about something like this?
    I would appreciate any help you could give me.

    Thanks
    Scott

  2. #2
    Join Date
    Aug 2011
    Posts
    2517
    you may be able to do what you want using the macro commands BCD & BIN.

    it may be better to use two 8-bit binary numbers as its easier to handle. you have the same number of features (16) but they are split into two.
    then if you convert your two binary numbers to decimal and pre-set those numbers into two macro variables you could use some IF GOTO statements at the top of the program to run the required sections of the program.

    it's kind of a maths/logic problem. you need to think out a solution that can be executed in a logical order based on IF/GOTO or IF/THEN conditional branching macro commands and looking up macro variables that are either program-set or pre-set.

  3. #3
    Join Date
    May 2005
    Posts
    2502
    Divide by 2 and drop the fraction to shift right 1 binary digit.

    Use "MOD 2" to determine the value of the last digit.

    Check out any writings on using mod operators in programming and most of them will walk you through how it works.

    Best,

    BW
    Try G-Wizard Machinist's Calculator for free:
    http://www.cnccookbook.com/CCGWizard.html

Similar Threads

  1. Catalog of patterns.
    By leonin83 in forum Jewelry Design Software
    Replies: 2
    Last Post: 03-18-2013, 08:13 PM
  2. Purchasable G-Code for 3d Patterns
    By webgeek in forum Benchtop Machines
    Replies: 1
    Last Post: 05-03-2010, 06:56 PM
  3. Patterns
    By bwetsel in forum PlasmaCam
    Replies: 1
    Last Post: 06-14-2009, 09:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •