PDA

View Full Version : plotting so it looks hand drawn



richpetchey
11th Jul 2003, 03:10 pm
is it possible to plot a 2d drawing so that it looks as if it's hand drawn?

f700es
11th Jul 2003, 03:22 pm
is it possible to plot a 2d drawing so that it looks as if it's hand drawn?

Try this.....

;================================================= ==================================
; FREEHAND.lsp (Command function for AutoCAD)
; (c) Copyright 2000 TimeSavers for CAD
; from: www.timesaversforcad.com
;-----------------------------------------------------------------------------------
; Description:
;
; Modifies lines and polylines to appear as if drawn freehand.
; Two things occur:
; 1. Corners are given slight overlap.
; 2. Lines are given slight "wiggle" to them.
; User can specify degree of both overlap & wiggle [1 small - 5 large, 0-none]
; Accomplished by first lengthening each line, then replacing line
; with LWPOLYLINE(R14) or POLYLINE(<R14) and adding slightly offset vertices.
;
; Globals: fh_scal(freehand scale), fh_oscl (overlap scale), fh_wscl (wiggle scale)
;================================================= ==================================
(alert "\nChanges made by FREEHAND cannot \nbe restored once you leave drawing.")

(defun c:freehand (/ *fh:err* o_m c_e fh_s fh_os fh_ws x ss ssp e ed llc p1 p2 d el ne
vertno ang vertd offd offang vlst elst lp dsf)
;-ERROR HANDLING
(defun *fh:err* (m)
(or (member m '("Function cancelled" "quit / exit abort" "console break"))
(prompt (strcat "\n< " m " >\n"))
)
(setvar "osmode" o_m)(setvar "cmdecho" c_e)
(setq *error* *e*)(princ)
)

;-GET VALUES/SETUP
(setq *e* (cond (*e*)(*error*))
*error* *fh:err*
c_e (getvar "cmdecho")
o_m (getvar "osmode")
dsf (getvar "dimscale") ;TSC (scale)
)
(setvar "cmdecho" 0)
(command "undo" "e" "undo" "g")
(setvar "osmode" 0)
(or (= (type fh_scl) 'REAL)(setq fh_scl 1.0))
(or (= (type fh_oscl) 'INT)(setq fh_oscl 3))
(or (= (type fh_wscl) 'INT)(setq fh_wscl 3))

;-GET FREEHAND SCALE FACTOR
(if (setq fh_s (getreal (strcat "\nFreehand Scale <" (rtos fh_scl 2) ">: ")))
(setq fh_scl fh_s)
)

;-GET AMOUNT OF OVERLAP
(initget "0 1 2 3 4 5")
(if (setq fh_os (getint (strcat "\nLine OVERLAP amount [1 small-5 large, 0 none] <"(itoa fh_oscl)">: ")))
(setq fh_oscl fh_os)
)
(cond ((= fh_oscl 0)(setq fh_os nil))
((= fh_oscl 1)(setq fh_os 0.2))
((= fh_oscl 2)(setq fh_os 0.7))
((= fh_oscl 3)(setq fh_os 1.2))
((= fh_oscl 4)(setq fh_os 1.7))
((= fh_oscl 5)(setq fh_os 2.2))
)
(initget "0 1 2 3 4 5")

;-GET AMOUNT OF WIGGLE
(if (setq fh_ws (getint (strcat "\nLine WIGGLE amount [1 small-5 large, 0 none] <"(itoa fh_wscl)">: ")))
(setq fh_wscl fh_ws)
)
(cond ((= fh_wscl 0)(setq fh_ws nil))
((= fh_wscl 1)(setq fh_ws 0.02))
((= fh_wscl 2)(setq fh_ws 0.07))
((= fh_wscl 3)(setq fh_ws 0.12))
((= fh_wscl 4)(setq fh_ws 0.17))
((= fh_wscl 5)(setq fh_ws 0.22))
)

;-SELECT OBJECTS
(if (setq ss (ssget '((-4 . "<OR")(0 . "LINE")(0 . "LWPOLYLINE")(0 . "POLYLINE")(-4 . "OR>"))))
(progn
(prompt "\nFREEHAND in progress...")
(if (setq ssp (ssget "P" '((-4 . "<NOT")(0 . "LINE")(-4 . "NOT>"))))
(progn
(setq el (entlast) x 0)
(while (setq ne el el (entnext el)))
(while (< x (sslength ssp))
(ssdel (setq e (ssname ssp x)) ss)
(command ".explode" e)
(setq x (1+ x))
)
(while (setq ne (entnext ne))(ssadd ne ss))
)
)
(setq x 0)
(while (< x (sslength ss))
(setq e (ssname ss x) ed (entget e))
;-GET NEEDED INFO FROM LINE
(setq llc (list (assoc 8 ed)) ;start Layer/Ltype/Color list
p1 (cdr (assoc 10 ed))
p2 (cdr (assoc 11 ed))
ang (angle p1 p2)
d (distance p1 p2)
)
(if (assoc 6 ed)(setq llc (cons (assoc 6 ed) llc)))
(if (assoc 62 ed)(setq llc (cons (assoc 62 ed) llc)))
;-CREATE OVERLAP
(if (and fh_os (> d 0))
(progn
;*-overlap distance, adjust number after "dsf" - larger=less
(setq ovlpd (+ (* (/ dsf 160) fh_scl)(* fh_os fh_scl))
p1 (polar p1 ang (- ovlpd))
p2 (polar p2 ang ovlpd)
)
(setq ed (subst (cons 10 p1)(assoc 10 ed) ed)
ed (subst (cons 11 p2)(assoc 11 ed) ed)
)
(entmod ed)
(setq d (distance p1 p2))
)
)
;-CREATE WIGGLE
(if (and fh_ws (> d 0))
(progn
(setq vlst nil
lp p1
;*-number of vertices, adjust number after "dsf" -larger=more
vertno (fix (/ d (+ (* (/ dsf 16) fh_scl)(* 3 fh_scl)))) ;;;(+ (* (/ dsf 16) fh_scl) 3)))
vertd (if (> vertno 0)(/ d (1+ vertno)))
;*-offset distance for vertices, adjust number after "dsf" -larger=less
offd (+ (* (/ dsf 480) fh_scl)(* fh_ws fh_scl))
offang (+ ang (/ pi 2))
)
;-MAKE LIST OF VERTICES FOR NEW PLINE
(repeat vertno
(setq lp (polar lp ang vertd)
vlst (cons (polar lp offang offd) vlst)
offang (+ offang pi)
)
)
;-DELETE LINE
(entdel e)(setq e nil)
(if (= (substr (getvar "acadver") 1 2) "14")
(progn
(setq elst (list (cons 10 p2)'(40 . 0.0)'(41 . 0.0)'(42 . 0.0)))
(foreach v vlst
(setq elst (append (list (cons 10 v)'(40 . 0.0)'(41 . 0.0)'(42 . 0.0)) elst))
)
(setq elst (append (list (cons 10 p1)'(40 . 0.0)'(41 . 0.0)'(42 . 0.0)) elst))
(entmake (append '((0 . "LWPOLYLINE")(100 . "AcDbEntity"))
llc
(list '(100 . "AcDbPolyline")
(cons 90 (/ (length elst) 4))
'(70 . 0)
)
elst
))
)
(progn
;-REPLACE WITH PLINE
(entmake (append '((0 . "POLYLINE")(70 . 128)(66 . 1)) llc))
(entmake (append (list '(0 . "VERTEX")(cons 10 p2)) llc))
(foreach n vlst (entmake (append (list '(0 . "VERTEX")(cons 10 n)) llc)))
(entmake (append (list '(0 . "VERTEX")(cons 10 p1)) llc))
(entmake (cons '(0 . "SEQEND") llc))
)
)
)
)
(setq x (1+ x))
)
(command "undo" "e")
(prompt "\nFreehand complete. ")
)
)

;-RETURN VALUES
(setvar "osmode" o_m)(setvar "cmdecho" c_e)
(setq *error* *e*)
(princ)
)
;-END FILE

CADTutor
11th Jul 2003, 04:50 pm
...or you could try the 15 day free trial of Sqiggle.

http://www.aay.com/squiggle.htm

Why do you want your CAD drawings to look hand drawn?

richpetchey
11th Jul 2003, 05:11 pm
because i'm an architecture student, and that hand drawn effect adds to the presentation

f700es
11th Jul 2003, 07:35 pm
because i'm an architecture student, and that hand drawn effect adds to the presentation
Do you have Architectural Desktop? If so, then you can get the napkin effect that works with ADT. I have it at work and can get the site I got it from for you. It only works on ADT though. :(

CADTutor
11th Jul 2003, 10:22 pm
because i'm an architecture student, and that hand drawn effect adds to the presentation

Surely we should be striving to work with new media by developing new drawing aesthetics rather than simply trying to copy old ones.

Just one of my many hobby horses...

billsta
14th Jul 2003, 01:15 pm
why dont you trace it after you plot them.
i dont know why you're trying to mimic something thats not suppose to be.
if you're going to use CAD to draw up your presentation then make it obvious make it good, or you free hand / pen your presentation on butter paper...
computer will never be able to do what a drafting pen can do...

hyposmurf
14th Jul 2003, 09:50 pm
It does seem strange to be using CAD to draw something that looks hand drawn,as the great end result of using CAD software is that your end result doesnt look handrawn and in fact alot more accurate/tidy,but I guess thats architecture for you :) .Ive found this site that has a a sketch program on it that you can download.Not sure if its free.Its called SketchIt 1.0 http://www.cadwerx.net/

superjari
14th Jul 2003, 10:58 pm
Although this looks more like a program for 3D-models, I'll just paste the link here so you can look at it...

http://www.informatix.co.uk/piranesi/gallery.shtml

gcp310
15th Jul 2003, 06:36 am
or you could plot to a raster file and use one of the filters
in photoshop or corelPHOTO.

My 2 cents
:D
G

f700es
15th Jul 2003, 01:13 pm
It does seem strange to be using CAD to draw something that looks hand drawn,as the great end result of using CAD software is that your end result doesnt look handrawn and in fact alot more accurate/tidy,but I guess thats architecture for you :) .Ive found this site that has a a sketch program on it that you can download.Not sure if its free.Its called SketchIt 1.0 http://www.cadwerx.net/
Looks cool but it seems that either their site has a few broken links or it is no longer available to download.
I still like SketchUp 3D (www.sketchup.com). Very slick little program.

richpetchey
15th Jul 2003, 05:17 pm
all i am trying to do is take an A1/A0 drawing into photoshop. but i want it to look hand drawn. i could draw it by hand and scan, but with just an A4 scanner it's extremely time consuming, and irritating. therefore is there a way that my A1 autocad could look hand drawn, then i could import that?

f700es
15th Jul 2003, 08:27 pm
all i am trying to do is take an A1/A0 drawing into photoshop. but i want it to look hand drawn. i could draw it by hand and scan, but with just an A4 scanner it's extremely time consuming, and irritating. therefore is there a way that my A1 autocad could look hand drawn, then i could import that?

Did you try the lisp file I added? It will do it.

before

http://picserver.student.utwente.nl/getpicture.php?id=204212

after

http://picserver.student.utwente.nl/getpicture.php?id=204215

not the greatest but not bad for free :)

f700es
15th Jul 2003, 09:26 pm
Here's one from Sketchup3D, although it is only 2D.

http://picserver.student.utwente.nl/getpicture.php?id=204322

It is not finished but you get the idea.

richpetchey
16th Jul 2003, 01:35 pm
i've downloaded the free freehand.lsp from 'Time Savers for cad' but how do i add an lsp file to cad? Do i have to download one of the free trial packages first?

hyposmurf
16th Jul 2003, 01:39 pm
Type APPLOAD at the command line,you can then load the lisp file you need.You can also go to your start up file through this feature and add it so that whenever AutoCAD starts up your lisp is ready and active.Don't download the software yet,just try this out beforehand.

Sepult
16th Jul 2003, 05:45 pm
To add a lisp to CAD there a number of different ways. save the lisp file you have downloaded, say in a temp folder on your desktop, or anywhere you want. Go back into Cad and at the Command line type APPLOAD. When it asks for the file name hit load and go to the folder you have put it in and select it. close the folder. Make sure you know the name of the lisp, than type that at your command line. :D

Hameed
1st Aug 2003, 05:18 pm
Did you try the lisp file I added? It will do it...
A very nice script, but here is a sugestions that I believe will make it look that bit more believable. Make it random!
I mean something along the lines of asking the user to enter a range for the extension and wigling then the script randomly chooses a value to be used for each object.