PDA

View Full Version : Newbie Want to import 2D DXF & convert it to 2D step & dir



cnc2
12-15-2008, 03:46 PM
Hi everybody,

I'm planning to write a program that imports 2D DXF & drives two stepper motors for a kind of simple printer... the printer will have a cylinder that feeds the paper(1st axis) & i need the cylinder to turn in only one direction to feed the paper while the print head (2nd axis) goes from left to right (or right to left, i don't think it matters). Driving the print head will be as easy as to drive a relay.

So, cylinder position + print head position + close the relay, would be the basic program routine.

My problems :

1) I don't know the DXF format so, i have no idea on how to interpret or convert it.
2) I don't know how to implement printing speed, does it need some multi threading programming skills ?
3) I have an idea on how to drive a stepper from LPT port (with ULN2003 & INPOUT32.DLL under WIN XP) , but don't know anything about step/dir, Is it the same concept ?


My questions:

1) Is the DXF format (vector) the right choice for this kind of machine ? (because some told me bitmap would be more apropriate for a cylinder going in only one direction)

2) What programming language should be the more apropriate for such a program ? (i'm a biginner in the C language but have an idea about OOP & JAVA)

3) Do you think i'm all wrong about the way this program should work & Why ?
4) Is it in my reach & how long should it take to dev it ?
5) Did i forget something ?

I'm waiting for your help...

Thanks !

cnc2.

Superman
12-15-2008, 04:27 PM
Just to make things more complicated

Have you considered using HPGL format ?
import DXF ===> export HPGL

This is usually a format for plotters ie using vectors, pen up, pen down, pen colour, etc
your 1st axis is bi-directional as well as your 2nd axis

http://www.sxlist.com/techref/language/hpgl/commands.htm

cnc2
12-15-2008, 05:08 PM
Just to make things more complicated

Have you considered using HPGL format ?
import DXF ===> export HPGL

This is usually a format for plotters ie using vectors, pen up, pen down, pen colour, etc
your 1st axis is bi-directional as well as your 2nd axis

http://www.sxlist.com/techref/language/hpgl/commands.htm
Thanks for your reply Superman !

Man i need the 1st axis (the cylinder) to be uni-directional & the second axis to be bi-directional, it's a must for me because i don't need the paper going in&out the printer.

Just imagine the printer's area is only the cylinder (cylinder_width*cylinder_length) so the paper gets printed as it passes the cylinder.

If HPGL makes it possible it will be worth the effort of DXF=>HPGL & i'll still have to convert HPGL to step/dir because i'm planning to use common steppermotor step/dir driver boards.

Thanks !

cnc2.

Superman
12-15-2008, 05:19 PM
No probs.

it was just a thought to use a drum type plotter driver

it looks as if you are leaning to a printer type driver

cnc2
12-15-2008, 05:44 PM
No probs.

it was just a thought to use a drum type plotter driver

it looks as if you are leaning to a printer type driver

Oh Thanks a lot man !

As english isn't my mother tongue i didn't know the true name of the machine i want to make... & thanks a lot you gave it to me... yea it's a drum plotter that i want to build & control with my own program.

Looking for "Drum type plotter" on Google i found this picture that looks pretty much like what i want to do http://www.teach-ict.com/gcse/hardware/output/miniweb/images/plotter2.jpg

About the driver you're talking about, what will it drive ? will i still have to convert HPGL to step/dir ?

Thanks !

cnc2.

Superman
12-15-2008, 05:59 PM
Try "Roland" plotters as a suggestion
I am sure they use a "HPGL" format

These may well only roll the drum in 1 direction
you would have to configure the driver to your application

to use it :-
you would only have to "print/plot" what you have on screen straight to the plotter, same as you would print a drawing ( you would also be able to control the scale of the drawing )

This is about the limit of my knowledge

cnc2
12-15-2008, 06:27 PM
Try "Roland" plotters as a suggestion
I am sure they use a "HPGL" format

These may well only roll the drum in 1 direction
you would have to configure the driver to your application

to use it :-
you would only have to "print/plot" what you have on screen straight to the plotter, same as you would print a drawing ( you would also be able to control the scale of the drawing )

This is about the limit of my knowledge
http://ltl13.exp.sis.pitt.edu/Website/Courses/Graphics/book/Chapter11_files/DrumPlotter.gif the basic principle.

I also found this (http://ltl13.exp.sis.pitt.edu/Website/Courses/Graphics/book/Chapter11.htm)

When you say try Roland plotters, do you want me to use Roland driver ?
What does the driver do & don't do ? is it a ready made program to configure or it is a code library to use in my program ? (newbie here)

At first i wasn't planning to print the drawing to the screen, i just wanted my program to browse for the file to print & print it or plott it.

Thakns !

cnc2.

Dennis Bohlke
12-15-2008, 06:48 PM
The problem of going from DXF or HPGL to step and direction signals at the parallel port is not a trivial task.

Took me a few months to get the HPGL conversion working, it is easier because it works with integers for amounts of movement. But that was in the DOS era.

After fifteen years I think I pretty much got it the way I originally wanted.

The timing part of creating the step signals is very difficult and with an Windows host computer it's almost always subject to being messed with by the operating system.

You should look into the EMC program. It's open source and has a motion engine you could adapt to. It works with Linux.

Dennis
www.super-tech.com

Superman
12-15-2008, 06:51 PM
Sorry, from here I am not much help

The "roland" was only a suggestion as a step forward as an example
not knowing what your application is to be used for, drawing size, etc.

I have used "roland" plotters on flat beds and drum in a previous job for accurate plots for customer samples and cutting "ruby" sheets for photographic purposes

I thought it may be of use to you.
My application required the bed and drum to be bi-directional for speed and accuracy of the plot ( ie accuracy to 1/2 the line thickness to overlay onto photo negatives and die-lines to suit the customer requirements )

cnc2
12-15-2008, 08:11 PM
The problem of going from DXF or HPGL to step and direction signals at the parallel port is not a trivial task.

Took me a few months to get the HPGL conversion working, it is easier because it works with integers for amounts of movement. But that was in the DOS era.

After fifteen years I think I pretty much got it the way I originally wanted.

The timing part of creating the step signals is very difficult and with an Windows host computer it's almost always subject to being messed with by the operating system.

You should look into the EMC program. It's open source and has a motion engine you could adapt to. It works with Linux.

Dennis
www.super-tech.com
Thanks for the reply Dennis !

You mean it took you fifteen years to achive it ? (wow man, i don't have that time)

I'm thinking about using the inpout32.dll for "talking" to the parallel port under Win Xp & i'm not planning to go over 2000Hz on a 200step motor so i think & hope it'll be ok, what do you think ?

I'm stuck with windows because a lot of people are using it including my "school" & have no linux programming skills (not yet).

My first concept was to represent the paper as an array or matrix of dots (dot/nodot)
and to get the head to print dots on each line. The cylinder feeds(changes) the lines to be printed by the pen, but no turning back, what HPGL doesn't permit(from what i understood a few minuts ago). Anyone has an idea on how to do it & about the aproriate file format to use ?

Thanks !


Superman
Sorry, from here I am not much help

The "roland" was only a suggestion as a step forward as an example
not knowing what your application is to be used for, drawing size, etc.

I have used "roland" plotters on flat beds and drum in a previous job for accurate plots for customer samples and cutting "ruby" sheets for photographic purposes

I thought it may be of use to you.
My application required the bed and drum to be bi-directional for speed and accuracy of the plot ( ie accuracy to 1/2 the line thickness to overlay onto photo negatives and die-lines to suit the customer requirements )


Thanks Superman, thanks to you i know that HPGL doesn't suite my needs & it takes me a step further in my searching.

My machine doesn't need much accuracy, +-1mm would be enough. the paper size is approx 600mm wide by n millimeters long that's why i need the cylinder to turn in only one direction imagine the time it would take to draw a 500mm square with a 400mm dia circle inside the square or a 1000mm*550mm rectangle instead of the square ...etc HPGL provides "high" accuracy & i need "speed".

Thanks !

cnc2.

Superman
12-15-2008, 10:27 PM
Thanks Superman, thanks to you i know that HPGL doesn't suite my needs & it takes me a step further in my searching.

My machine doesn't need much accuracy, +-1mm would be enough. the paper size is approx 600mm wide by n millimeters long that's why i need the cylinder to turn in only one direction imagine the time it would take to draw a 500mm square with a 400mm dia circle inside the square or a 1000mm*550mm rectangle instead of the square ...etc HPGL provides "high" accuracy & i need "speed".

My last word for you
do not be surprised about the speed of bi-directional drum plotter

to draw a 1000mm * 500mm rectangle = perimeter is 3000mm

speeds range from 25mm-500mm per second
so to draw a 1000 * 500 rectangle = 6.0 seconds

reference is http://easyaid.en.ecplaza.net/1.asp MODEL:HX720 720mm 630X unlimited length

note! you can use a pen instead of a vinyl cutter

Time to plot uni-directional will be unbeleivable ( 2 dots per across pass @ 500mm apart - to give a dot pitch of 0.25mm then 1000mm= 250 passes * 500mm travel @ 500mm per second = 250 seconds = 4.17 minutes
Time will increase if you want dots closer together if you want a "line or arc"

Superman
12-15-2008, 10:29 PM
by the way
Where on "earth" are you?

cnc2
12-16-2008, 09:14 AM
My last word for you
do not be surprised about the speed of bi-directional drum plotter

to draw a 1000mm * 500mm rectangle = perimeter is 3000mm

speeds range from 25mm-500mm per second
so to draw a 1000 * 500 rectangle = 6.0 seconds

reference is http://easyaid.en.ecplaza.net/1.asp MODEL:HX720 720mm 630X unlimited length

note! you can use a pen instead of a vinyl cutter

Time to plot uni-directional will be unbeleivable ( 2 dots per across pass @ 500mm apart - to give a dot pitch of 0.25mm then 1000mm= 250 passes * 500mm travel @ 500mm per second = 250 seconds = 4.17 minutes
Time will increase if you want dots closer together if you want a "line or arc"
Thanks Superman this message was an eye opener !

I focused on the software and forgot about the hardware limits, after more figuring i found that my first figure that had the drum going 200 rpm needed the head to print more than 100 000 dot per minute for one dot per line & 0.25mm between lines (IMPOSSIBLE with a traveling print head) even if i want the lines 2mm from each other it would still be impossible...now i see the benefits of going b-directional, only a beginner like me could under-estimate it.

I think making the machine bi-directional won't be too hard i can add a drum on each side of the printing drum for preventing the paper from "cleaning the floor"...HPGL is back in business.


by the way
Where on "earth" are you?

I'm in Algiers, Algeria.

Thanks !

cnc2.

Dennis Bohlke
12-16-2008, 10:53 AM
If you use a by directional drum my USB CamPod and SuperCamXp program can get you running straight away. With HPGL or DXF files.
http://www.super-tech.com/root/grp.asp?p1=CamPod

I got my original ideas watching a drum plotter pen plotting autocad drawings. That was a huston instruments plotter that had little rollers on each side with a cam lever to hold the paper down.

Dennis
www.super-tech.com

cnc2
12-16-2008, 02:28 PM
If you use a by directional drum my USB CamPod and SuperCamXp program can get you running straight away. With HPGL or DXF files.
http://www.super-tech.com/root/grp.asp?p1=CamPod

I got my original ideas watching a drum plotter pen plotting autocad drawings. That was a huston instruments plotter that had little rollers on each side with a cam lever to hold the paper down.

Dennis
www.super-tech.com
Thanks for your reply Dennis !

I've got a lot of respect to the level you've reached & how easy you've made it for people, setting'em up & running with a complete package, unfortunately i have to write the soft by myself, it's for my school's final project & if i find it too hard to get it working i'll have to find myself another project that i'll be able to achive.

Since i'm too far from the US, shipping the CamPod will double its price, that's why i'll have to assemble the electronics by myself (from common DIY stepper board projects) & hope it to work.

Thanks !

cnc2.

Dennis Bohlke
12-16-2008, 02:39 PM
If you do not concern your self with accelleration and decelleration it greatly simplifies the task.

And with HPGL all the math can be integer math.

Best Wishes

Dennis
www.super-tech.com

cnc2
12-16-2008, 03:21 PM
If you do not concern your self with accelleration and decelleration it greatly simplifies the task.

And with HPGL all the math can be integer math.

Best Wishes

Dennis
www.super-tech.com
Thanks a lot for those tips Dennis, i'll keep'em in mind.

Thanks !

cnc2.

bdahmet
01-10-2009, 08:44 AM
Hi CNC2,
now I understand.
Let me summarize:
First you wanted to build a drum "printer". By having a pen "peck" (Like a woodpecker) onto the paper instead of some "inkjet drops".
At this time, the idea of having the drum turn in one direction only was OK. Like a regular printer. Then the idea of using bitmaps was better suited to your needs as "theoretically" every pixel in the bitmap would somehow (scaled or not scaled) correspond to your pecks.

A Drum pen plotter, mostly used for vinyl self adhesive film cutting uses mainly HPGL. İt is easier tu inerpret as it gives you X-Y positions some commands (circle center - radius - arc etc) and whether the pen is up or down, speed etc.

In this case the paper will have to move forward and back, but fortunately this is achieved by friction rollers. So you dont need two rollers that are synchronized. It is sufficient if you squeeze the paper inbetween without friction.

Acceleration: There's no such thing as no acceleration as long as you are not talking about objects standing still. If you want to have an object change its state from standing still to any speed, there is a time that the object accelerates.

On the other hand I dont know what your main task for the school is but you should drive your "plotter/printer" through another software program. As far as I have lerned here is that it is espcially with windows, a very difficult task, as windows is not a realtime operating system (as opposed to DOS or Linux).
So your commands given from your apllication are qued bfore given out to the printer port... (anyone correct me if I'm wrong)
Try MACH3 , there you can adjust the acceleration ramps, stepper speed, you can maybe have your "pecker" defined like a laseer and its pulses. I mean the program is infinitely customizable....

Give it a thought.

Ahmet