Log in

View Full Version : Lost In Stupid Parenthesis


the_lone_wolf
16-11-07, 01:17 PM
Anyone out there know anything about LISP? specifically autolisp. this little routine i wrote:

(defun C:implay ()
(if (setq file (open "H:/AutoCAD Tools/Linetypes/layers.txt" "r"))
(progn
(while (read-line file)
(setq
linestring (read-line file)
layername (substr linestring 1 30)
layercolour (atoi (substr linestring 31 10))
layerlinetype (substr linestring 41 20)
layerlineweight (substr linestring 61 10)
) ;setq
(command "-layer" "M" layername "L" layerlinetype "" "LW" layerlineweight "" "C" layercolour "" "")
) ;while
) ;progn
(princ "\n Error - File not found!")
) ;if
(princ)
) ;defun

should import layer names, linetypes, weights and clolours into a new autocad drawingfrom a text file "layers.txt," :

EAVES 210 LOCAL_GOVERNMENT 0.13
G528_M_CASTINGS 7 Continuous 0.18
G910_M_SITE_INFO 7 Continuous 0.18
G917_M_EXIST_BLDG 174 Continuous 0.35
G923_M_SPOT_HEIGHT 7 Continuous 0.18
G930_M_LAND_DRAINAGE 10 COUNTY_BOUNDARY_2 0.18
G936_M_VALVES 7 Continuous 0.18
G941_M_TREE_EXIST 90 Continuous 0.18
G950_M_ROADS_CHANGESURFACE 25 Continuous 0.25
G950_M_ROADS_PAVING 7 EASEMENT_2 0.25
G952_M_KERBS 170 Continuous 0.25
G952_M_KERBS_DROP 170 DOT_2_0MM 0.25
G967_M_COMMS 7 Continuous 0.18
G970_M_HARDSCAPE 7 Continuous 0.18
G971_M_FENCING 75 FENCE 0.25
G978_M_LIGHTING 7 Continuous 0.18
G995_M_VEGETATION 84 HEDGE_1 0.25
ROADMARKINGS-CENTRELINE 7 04 0.25
ROADMARKINGS-GENERIC 7 Continuous 0.18
TEXT 7 Continuous 0.20
Z030_M_GRIDS 7 Continuous 0.20


but it crashes giving the error:

; error: bad argument type: stringp nil

when entering the layername to apply the colour to. it only does this however, when trying to apply it to the TEXT layer, all the ones previously work fine, and if i remove the TEXT line from layers.txt it completes just fine

i even tried adding a caveat to the script to change the layername "TEXT " to "TEXT" immideately after the main group of set quotients:

(if (= layername "TEXT ") (setq layername (substr layername 1 4))) ;if

but this didn't change anything

any ideas? nerd/geek jokes on the back of an x-men comic please:smt023

hovis
16-11-07, 01:19 PM
i had a lisp when i had my tounge pierced, i have taken it out now though (the piercing not my tounge)

DanDare
16-11-07, 01:42 PM
i had a lisp when i had my tounge pierced, i have taken it out now though (the piercing not my tounge)

:smt082:smt082:smt082:smt082 Genius!

My tea is all over my keyboard now

Pedro68
16-11-07, 01:48 PM
Don't encourage him please :rolleyes:

the_lone_wolf
16-11-07, 02:39 PM
hovis, more surprising than the fact that you posted the first reply was the quality of it:D

made me smile

but seriously, anyone here use LISP, or is it like asking if anyone knows a bit of aramaic?

Pedro68
16-11-07, 02:44 PM
hovis, more surprising than the fact that you posted the first reply was the quality of it:D

made me smile

but seriously, anyone here use LISP, or is it like asking if anyone knows a bit of aramaic?
I only did a bit of LISP during the AI module of my MSc. and so all the LISP I learnt was for defining logical predicates within the program itself and not imported from a file (IIRC), so I've not encountered the sorts of LISP commands that you are using.

At least I knew what LISP was ... WTF is aramaic?!? LOL

the_lone_wolf
16-11-07, 02:47 PM
At least I knew what LISP was ... WTF is aramaic?!? LOL
a little known programming language used by jesus:

http://esotericaofleesburg.com/jane/jesussavesJtn.jpg

Pedro68
16-11-07, 02:53 PM
So Jesus wasn't a carpenter then ... more of a "hacker" :-P