Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: andiabel on September 02, 2015, 03:44:36 PM

Title: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: andiabel on September 02, 2015, 03:44:36 PM
hi everyone,

my first post so please excuse my asking obvious questions..


ok.. i do build snowboards..using a bzt cncrouter, rhino/madcam to generate code and at the moment mach3 but plan to switch to mach 4 for continious support in the future.

my problem is that doing some sort of semi custom production, i have to manually choose from many existing (some hundreds) different single tp-files and add offsets manually, depending on client's board configuration.
That is time consuming and error prone.


So my idea is to get a friend who is a programmer at UCSD to write me either an external software, maybe to be somehow connected to mach or some sort of plugin or wizard or what ever, sorry have no bloody clue of  programming, some vb class at uni long time ago ;D ???


the design brief would be:
 -some sort of simple selection/scroll down menu to choose between relevant shape parameters (6x6x3x3x3 parameters) and offsets (ca 50 offsets)
=>then relevant existing toolpath files (relatively simple 2D files) get chosen automatically (ca 14 files to be chosen ot of a number of a couple hundred, i would think by their file name), some of them  
     summarised/integrated as defined. total output number of resulting files would be ca 4-5.
=>x/y/z offsets get added automatically into these 4-5 files as defined/chosen in scroll down
=>a great goodie would be if it could mirror single toolpaths around an axis other than 0/0, change the direction they are running (keep it clockwise), add an offset and summarise as said above, would cut down CAD/CAM  
      work to generate exiisting base file significantly, but not sure if that's possible

Also my friend said he could quite easily write something external, maybe webbased so he could use a configurator on my website, but then i would need to manually open the new changed files in mach?
Or he could write some sort of plugin that could doo all that inside of mach 3 or 4?

What do you guys think? any tips will be highly appreciated !!!


As he is no cnc/gcode guy and doesn't know anything about gcodes, i need to provide him with the relevant changes in code that need to be made automatically and the exact positions of tose added code/changes in the existing codes.
My understanding of code is quite basic as well , so i could do with some help, thanks :) ???
An abbreviated example of one of the 2D routing codes generated in Madcam for mach3 would be as follows, i left out the center part, as it is of no importance..:

G00 G49 G40.1 G17 G80 G50 G90 G64
G21
(6mm)
M6 T1
M03 S15000
G01Z30.000
G00X-1284.500Y-420.000
Z16.350
Z15.000
G01Z0.000 F100
X-1284.953Y-420.003F1500
X-1285.407Y-420.011
........
......
X-1391.500Y-645.000
Y-648.000
X-1406.500
G00Z8.175
G00Z16.350
M5 M9
M30

so my questions regarding this:
-where do i insert a global offset of let's say +5mm in x y or z direction and how would the correct spelling be? would that be the same for mach 3 and 4?
-how would i summarise the code above with another code into one tp file? (let's assume i just use the same one twice) how would then header/start and tail end look like? with no pause, with a pause after moving to a  
  predefined position, and with or without different offsets for the two parts?
- is it possible to mirror single toolpaths  around an axis other than 0/0, ( i think you do that with some sort of scaling and -1 ?) AND also change the direction they are running (keep it clockwise), add an offset and summarise as said above, would cut down CAD/CAM work to generate exiisting base file significantly, but  
  not sure if that's possible

hmm my head hurts...i really hope i managed to explain this so it makes some sense..please let me know if not  :)


thanks a lot in advance to everyone..
cheers,
andi
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: andiabel on September 08, 2015, 07:19:12 AM
hi again,

hmm not sure if no answers after a week is normal or if my questions are not clear or dumb ;)

may anyone please enlighten me?

cheers, andi
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: Tweakie.CNC on September 08, 2015, 08:21:05 AM
Hi Andi,

Don't despair, I think your question is clear and it is certainly not dumb.

The problem is that there are not that many people here that fully understand what you are attempting to do and they have not yet picked up on your post to provide a suitable reply.

TP will know the answer - perhaps he will respond.

Tweakie.
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: BR549 on September 08, 2015, 09:12:10 AM
What you are asking is a HUGE undertaking for Gcode applications.  It is BEST left to the Cad side to do what you want. In that realm you would want o be a parametric style Cad like solid works where you can recreate the entire aspect of the object with a single input of a new value.

Basically you want to take a basic shape then stretch or shrink or change it in specific ways defined by the customer. ??

NOW could it be DONE on the Gcode side ?? SURE it can with parametric /conditional Gcode with subs.  IF you think YOUR Head head hurts thinking about it try programming it (;-).

Mach3 and Mach4 are totally different dogs in respect to how it would work in each of them.  Mach3 is very limited in that it does NOT do conditional Gcode. AND Mach4 is NOT far enough developed to insure that it actually would work correctly.

YOU need to talk to one of the CAD manf like Solid Works.  Your project would best be attacked as a 3d object . They work in that realm every day and fully understand what you need/require.

You are NOT the first surboard/snowboard manf that has wanted to do this(;-).  


I THINK what you are looking for is BOARDCAD. It is a free software design program. (;-)

(;-) TP

Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: RICH on September 08, 2015, 09:38:34 AM
Quote
where do i insert a global offset of let's say +5mm in x y or z direction and how would the correct spelling be? would that be the same for mach 3 and 4?

First have an understanding of offsets, the attached should help, but only you can know where to put it.

RICH

Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: RICH on September 08, 2015, 09:59:36 AM
Think I agree with TP on using CAD / CAM to do.

I aware of, but do not use Rhino or Madcam, so can't be of any help on their application.

Sometimes it's easier to just adjust a base design than to try to piece together and modify a bunch of stuff. You spend more time fixing than creating new.
The high end software is costly and I am going to assume that is not in your budget.

Sorry no simple answer to your complex desire.

BTW,
There are some  25000 users of this site and maybe someone will surprise you. Just never know...........

RICH
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: andiabel on September 08, 2015, 11:38:01 AM
thanks guys..was getting nervous;)
R549 you have misunderstood what i meant, i should try to explain it more simply, sorry.
no i am not trying to shrink or scale g code. it's actually just a little programm inside or outside of mach that automatically edits gcode-txt files, it:
chooses the right (postprocessed) toolpath-txt-files out of a couple of hundred txt files by their name, depending on chosen options in scroll down menu.
summarises some of them (just putting one txt behind the other in one single text file?.. maybe gcode-autostart the next one after running the one before, but not essential)
entering some global offsets into those txt files depending on choice in scroll down menu.

as a bonus: mirror some and change direction of toolpath, but that's just a nice to have. i was told mirroring can be done with a scaling command and using -1 as a variable/degree.
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: andiabel on September 08, 2015, 11:46:46 AM
oops wasnt done typing yet..
if someone could help me  how to correctly edit the txt files/how to spell that new code bits and where to put them exactly, that would be of great help:

-how to enter global offsets correctly in a code like above..
-how to summarize (with pause between parts at a toolchange position or with autostart? changes to headers and foots in code?)
- how to mirror and change direction if possible?

thanks guys, highly appreciated
andi

Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: BR549 on September 08, 2015, 01:41:08 PM
I understood exactly what you were referring too (;-). There is NOTHING simple about what you want to do. I do parametric conditional SUB programming all the time for FAMILIES of parts where as the PART is defined by the required parameter (options). It can take 100's of hours to create the master CODE. After that it is as simple as inputting a new #var to change what you are creating on the machine.

You may want to take a look at BoardCad.  

(;-) TP
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: RICH on September 08, 2015, 10:19:56 PM
Hey...hey  there TP,

I thought you were joking about the BoardCad.  :D
Darn there is free program for it and andiabel should have a look.

andiabel,
Posted  basic info you need to understand about global offsets. Read and apply the knowledge if even needed.
I may also suggest that you  purchase CNC Programing Handbook by Smid.
More info on gcode in that book and how to use it than any guidance that we can provide.

RICH
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: andiabel on September 10, 2015, 05:47:02 AM
guys, thanks a lot for telling me about boardcad, i do appreciate it... i do know that program, but it does not work for me.. it can't do some advanced geometries i need, snowboards are similar, yes, and i do surf myself, but still a bit different than snowboards really..
also, no, I DO NOT WANT TO STRETCH GCODE!!! really, trust me!! ;););)

i have already done the stretchin, scaleng etc in CAD/CAM and have already created all tp files i need and am not looking for another cad/cam program. i know solid works is great and all but i am not spending 10thousand€ or more on a software... i am just looking for a way to automatically organize and edit the existing txt files with some small changes like automatic global offsets written into the codes' header, etc

so it's actually more some sort of customized editing program or an editing plugin in mach that i need.
again, if noone has a specific idea about how to implement a program or plugin like that, my programmer mate said he can do an external programm, said he would need some time but that its not at all hard to do..just that he needs the correct info on the gcode syntax changes..(it's only header and foot that will be changed the rest obviously remains the same!!!!):

I do know that there's loads of info in books, and i have read through the mach handbook ;)..still not sure about how to exactly do it..thanks for the tip regarding smid book, RICH, have just orderd it. it's just that i had hoped to avoid reading through too many books but find a faster way..
so could maybe someone at least please help me with the correct syntax of where and how to add the codes into the existing headers & foots (it's only header and foot that will be changed the rest obviously remains the same!!!!):
-for global offsets (x/y/z)
-how to summarize correctly with (with pause between parts at a toolchange position or with autostart?
-how to mirror and change direction if possible?

thanks again..
andi
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: RICH on September 10, 2015, 09:13:53 AM
Here something you may want to consider since all you want to do is piece various existing code together.
So to speak.......... ;D
Your programing friend can manipulate / use some generic programing to accomplish it.

Would work like this:
1. Select  from a list, directory, whatever the existing gcode files
2. Backplot selected  files from created  list into CAD such that they would be on different layers / levels / color etc.
3. Now you can see what needs to be modified or moved, or adjusted
4. Generate the gcode for the new file which would take care of the things you want to do, or optionally generate a new file type
to be used by CAD/CAM or whatever.

This above has already been done by some, so with a LOT of work your friend can create something for you, BUT, he will need to understand
what he is doing beyond just knowing how to program. There is no short cut to learning gcode.

Quote
help me with the correct syntax


The correct coding format for Mach3 can be found in the Mach Manual. Read that section of the manual.

Quote
how to add the codes into the existing headers

You  may  just code the first line or add additional lines so that part of the code could be run based
on current modal conditions and use an offset if code is based on a different setup.
Now be realistic in what you are asking ....... How in the heck are we to tell you exactly  what to do when we have no idea of your code
and the basis of it.  ;)

Quote
-for global offsets (x/y/z)

The correct code format is in the manual. I gave you basic info for understanding but you probably didn't even read it. :(

Quote
-how to summarize correctly

Don't know what you are asking. Summarize what?

Quote
pause between parts at a to lchange position or with autostart

You could code (G4 P) a dwell and have a LED blink warning you that a tool change is manually being done and
a counter is showing you how much time you have left to do it. OR After the defined pause time just hit the start button the code will
continue to run.    Be carefull! Safety is important. See how others address tool changing / do macros. Lots of stuff posted.


Enjoy the learning curve,

RICH
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: andiabel on September 10, 2015, 12:17:24 PM
rich, thanks, i do really appreciate your help. i am sorry, i seem to not explain it properly.


backplotting into cad/cam doesn't seem to make any sense to me as it makes things more complicated instead of faster and easier. i need some automatism,  manual changing of each new fille wil not make any difference.
maybe this makes it more clear, what i am doing now manually in mach 3 is the following: click open and start/run each needed toolpath (ca 14 files total to be chosen each time, out of a number of a couple hundred existing ones) one after the other, some after manually changing/chosing an x/y offset (G59 P...) in mach3, some after manually changing an Z offset (G59 P...) after manually changing to a different tool.
that's it. simple but error prone and slow. the only thing that is changed are the offsets.
so  if you still think i should backplot, then for what? only headers and footers in some text files need to be changed. what i wrote about mirroring is just a nioce to have but not essential, see also below.

what i need some probably external little software to do is make me work faster and avoid errors entering offsets manually by adding them automatically into the code after i have choosen some offsets and names of text files to use in a scrolldown menu. it should not touch the underlying base files just use them to write new ones that can be discarded after use. obviously i also still want to have to click start manually;)



please see my code example in my first post. guess you haven't read it ;)   :)
here again for your convenience:

G00 G49 G40.1 G17 G80 G50 G90 G64
G21
(6mm)
M6 T1
M03 S15000
G01Z30.000
G00X-1284.500Y-420.000
Z16.350
Z15.000
G01Z0.000 F100
X-1284.953Y-420.003F1500
X-1285.407Y-420.011
........ center bit remains unchchainged..
......
X-1391.500Y-645.000
Y-648.000
X-1406.500
G00Z8.175
G00Z16.350
M5 M9
M30



i have read the manual. it's not so helpful as to exact syntax and poition in code.
i have also read the pdf you sent me, thank you very much, it explains offsets but not the syntax or where it needs to be written in headers and footers? also may i kindly say it's not very clear explanations, sorry;) ;)




regarding offsets:
i should think there are two possiblities, either i do define the needed 50 x-offsets times the 2 z-offsets for 2 different tools = total 100 offsets (semi manual change system, z always the same for each tool) in mach 3 or 4 as the G59 P6 - 106 and let the programm enter into the headers each G59 P.. as chosen and also G54 in the footers (where?) into each code or i let the program enter a G52 X.. Y.. Z..into each header and G52 X0 Y0 Z0 into footer...but where?
like this?

G00 G49 G40.1 G17 G80 G50 G90 G64
G21
G59 P..   or G52 X.. Y.. Z.. ????????????????
(6mm)
M6 T1
M03 S15000
....
.....
X-1391.500Y-645.000
Y-648.000
X-1406.500
G00Z8.175
G00Z16.350
G54    or    G52 X0 Y0 Z0   ??????????
M5 M9
M30




regarding 'summarizing?:
what i mean by this is take the code and enter it again one behind the other assuming they where two different ones.
in between these two could be the command to go to a safe tool change position, and then some manually start the next one, something like:

......
X-1391.500Y-645.000
Y-648.000
X-1406.500
G00Z8.175
G00Z16.350
M5 M9
M30

F1500
G01 Z 20
G01 X-500 Y-2000

how do i make the software restart from here? just press start?  do not need a pause for a certain time or autostart after ta certain time as this might be dangerous.
another version would be no tool change just a break and restart the next one manually, so just empty between the two?


G00 G49 G40.1 G17 G80 G50 G90 G64
G21
(6mm)
M6 T1
M03 S15000
G01Z30.000
G00X-1284.500Y-420.000
Z16.350
Z15.000
G01Z0.000 F100
X-1284.953Y-420.003F1500
X-1285.407Y-420.011
....



hope this all makes more sense now.
the offsets and summarizing as above is the minimum i need.

a bonus would be:

if the software could enter a command that lets the cnc run mirrored coordinates (mirrored about a defined axis, something eg along coordinates X-500 Y-2000 and X-500 Y0 )
i read this could maybe be done by entering into the code
G51 X-1
...
G50 X1

but this would mirror it only around the y axis lile eg X0 Y-200 and  X0 Y0 ?????
is there also a way to make the cnc run the code backwards, i.e. start from the end and run the other way round?

mirroring and running backwards would allow me to reduce the number of code files i have to generate in cad/cam significantly..




i do like steep learning curves and i'd love to have the time to read through all books and i hope i will eventually learn a lot more about codes and programming, it's just a matter of having the time to do so;)

so thanks again..andi


Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: BR549 on September 10, 2015, 01:41:33 PM
AHHHHH  I see , You already HAVE the Code Segments You just need a way to assemble a list of them and maybe apply a fixture offset to each segment. THEN it would be 1 long program for the router to run.

Is that correct ?  Is so I already have something close to that. I use it for plasma work to assemble a JOB which may be 10-12 different elements with offsets(G54-G*********) to place each segment where it belongs. That way I can cut an entire sheet full of parts un attended. Then just toss the file when done as it only applies to that particular group of elements ( one time job with NO cad cam ).

HOW many different Files do you use PER JOB ??  What needs to be applied to a file to place it correctly ??

IF you can, email me a couple of your simple files so I can take a look at them for structure.

This can be done on a PAGE inside of MAch3 that way as you add each segment you can SEE it added into the toolpath on screen. That way you can make SURE it is correct. IF not undo and adjust it until it works .




(;-) TP
Title: Re: plugin/wizard/external editor to automatically organise and edit tp-files
Post by: andiabel on September 10, 2015, 02:59:50 PM
BR549 yes! sorry i thought i had said so the whole time;) maybe i made it sound more complicated..

out of a number of a couple hundred code files( which are just variations of 14 types of files) there are ca 14 files per job to be assembled into ca 4-5 total files per job. (different parts of jobs will be made at different times so needs to be more than one)
What needs to be applied to a file to place it correctly ??
place it? not sure what you mean by that?

hmm thanks for teh offer i do appreciate it..please do understand that i cannot pass on whole files as i need to protect my designs..but they are all pretty simple 2D as the one posted before and just a couple 2.5D files. just outline contour milling mostly, plus some simple pocket milling/drilling for insert holes and a handful of 2.5D profiling files for the core..pretty simple stuff..headers & ends of files all just look like the one posted, see before..

sounds great if i could do that inside of mach. how would you create that page?
to be futureproof wouldn't it make more sense to do it in mach 4 or is it not quite there yet developmentwise?..i had a look at the demoversion but am not so sure about all functionalities compared to mach3..would be sad to make the effort to program something if sooner or later mach3 becomes redundant?

cheers, andi