PDA

View Full Version : copying A "TIFF" File


jackk36
02-19-2003, 12:40 PM
I Would Like To Bring In A "TIFF" File Into An
ME-10 Session... I want to Overdraw It So As To Create An ME-10 Entity .... Is This Possible?? I Have Attached A Typical File ..

jkramer
02-25-2003, 10:26 PM
Hi,
sorry for the late reply. I just realized that I have an answer to this question.
What I did a couple of times is this:
-open the TIFF image in a graphics program that has the ability to save the file as HPGL (plotter language). Sometimes this function is called "vectorize" (I used Graphic Converter on a Mac).
-open the saved HPGL file in a text editor. Hopefully it looks something like this:

IN;
VS32,1;
VS32,2;
VS32,3;
VS32,4;
VS32,5;
VS32,6;
VS32,7;
VS32,8;
WU0;
PW0.350,1;
PW0.350,2;
PW0.350,3;
PW0.350,4;
PW0.350,5;
PW0.350,6;
PW0.350,7;
PW0.350,8;
SP1;
LT;
PU-3657 -2523;
PD-3668 -1247;
PD-3673 -608;
PD-3676 28;
PD-3675 665;
etc., etc....

You'll need only the lines beginning with PD.
- Remove the header/footer of the file (anything without "PD")
- Then, use Find and Replace to remove the "PD" and the ";".
- Then replace the "space" between the numbers with a comma.
- Now you have a coordinates list, that can be read by ME10.
You start a polygon, and then choose File > Import > Macro > Input. Type a "*" in the "Name" box, so that you can choose any file as input. If you open the converted HPGL-file, ME10 draws your picture (choose "fit" afterwards; the drawing may be outside your screen!).

In SolidDesigner, I use a Lisp Routine to read the coordinates file and draw them on a Workplane.

Good luck,
Jaap Kramer

jackk36
02-26-2003, 01:39 AM
Hello Jaap,
I received you note this A.M., ThankYou very much for the tip re. TIFF file conversion. I have a question concerning
the macro used to read the coordinate file ... Is it in the ME Users Group Macro file??? By the way i have an alternate E-mail address at jtk@ll.mit.edu....
Thanks again Japp,
Jack Kelly

jkramer
02-26-2003, 01:49 AM
Hi,

no, I wrote something myself (although I borrowed some bits and pieces :-) ). Here's the listing:



(in-package :EXAMPLES)
(use-package :OLI)

(sd-defdialog 'draw_hpgl
:dialog-title "draw_hpgl"

:variables
'((FILENAME :value-type :filename
:title "Filename"
:direction :input))


:ok-action
'(progn
(create_workplane :new)
(c_line_inf :horizontal 0)
(c_line_inf :vertical 0)
(setq file-stream (open (first filename) :direction :input))
(setq v1 (read-line file-stream nil 'eof))
;maybe this next line is very wrong... but it works
(when (eq v1 'eof) (return))
(setf regel (sd-string-split v1 ","))
(setf x (read-from-string(first regel)))
(setf y (read-from-string(second regel)))
(loop
(setq v1 (read-line file-stream nil 'eof))
(when (eq v1 'eof) (return))
(setf regel (sd-string-split v1 ","))
(setf xoud x)
(setf youd y)
(setf x (read-from-string(first regel)))
(setf y (read-from-string(second regel)))
(setf punt (make-gpnt2d :x x :y y))
(setf punt2 (make-gpnt2d :x xoud :y youd))
(line :two_points punt punt2)
)
(close file-stream)
)
)



As said in my previous post, the coordinates list should only contain lines like:

-345,456
23,567
98,345

etc., so x-coordinate,y-coordinate

Good luck!
Jaap

jkramer
02-26-2003, 01:54 AM
Ooops.... probably misinterpreted your question.

the Lisp routine I posted is for importing the coordinates in SolidDesigner.
For ME10 you don't need a macro. Your coordinates list is the macro :-). You start the polygon command, and by loading the coordinates file as a "macro", the polygon is feeded with the coordinates in the file. That's all!

Regards,
Jaap

jackk36
02-26-2003, 02:08 AM
Hi Again,
Thanks again !!!
jack