SV650.org - SV650 & Gladius 650 Forum



Idle Banter For non SV and non bike related chat (and the odd bit of humour - but if any post isn't suitable it'll get deleted real quick).
There's also a "U" rating so please respect this. Newbies can also say "hello" here too.

Reply
 
Thread Tools
Old 16-11-07, 01:17 PM   #1
the_lone_wolf
Captain Awesome
Mega Poster
 
the_lone_wolf's Avatar
 
Join Date: Jan 2007
Location: Hamble
Posts: 4,266
Default Lost In Stupid Parenthesis

Anyone out there know anything about LISP? specifically autolisp. this little routine i wrote:

Code:
(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," :

Code:
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:

Code:
; 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
Code:
"TEXT                          "
to "TEXT" immideately after the main group of set quotients:

Code:
(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
__________________
Official "Dumbass of the Year" 2011
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Deal with it...
the_lone_wolf is offline   Reply With Quote
Old 16-11-07, 01:19 PM   #2
hovis
Guest
 
Posts: n/a
Default Re: Lost In Stupid Parenthesis

i had a lisp when i had my tounge pierced, i have taken it out now though (the piercing not my tounge)
  Reply With Quote
Old 16-11-07, 01:42 PM   #3
DanDare
Guest
 
Posts: n/a
Default Re: Lost In Stupid Parenthesis

Quote:
Originally Posted by hovis View Post
i had a lisp when i had my tounge pierced, i have taken it out now though (the piercing not my tounge)
Genius!

My tea is all over my keyboard now
  Reply With Quote
Old 16-11-07, 01:48 PM   #4
Pedro68
Guest
 
Posts: n/a
Default Re: Lost In Stupid Parenthesis

Don't encourage him please
  Reply With Quote
Old 16-11-07, 02:39 PM   #5
the_lone_wolf
Captain Awesome
Mega Poster
 
the_lone_wolf's Avatar
 
Join Date: Jan 2007
Location: Hamble
Posts: 4,266
Default Re: Lost In Stupid Parenthesis

hovis, more surprising than the fact that you posted the first reply was the quality of it

made me smile

but seriously, anyone here use LISP, or is it like asking if anyone knows a bit of aramaic?
__________________
Official "Dumbass of the Year" 2011
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Deal with it...
the_lone_wolf is offline   Reply With Quote
Old 16-11-07, 02:44 PM   #6
Pedro68
Guest
 
Posts: n/a
Default Re: Lost In Stupid Parenthesis

Quote:
Originally Posted by the_lone_wolf View Post
hovis, more surprising than the fact that you posted the first reply was the quality of it

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
  Reply With Quote
Old 16-11-07, 02:47 PM   #7
the_lone_wolf
Captain Awesome
Mega Poster
 
the_lone_wolf's Avatar
 
Join Date: Jan 2007
Location: Hamble
Posts: 4,266
Default Re: Lost In Stupid Parenthesis

Quote:
Originally Posted by Pedro68 View Post
At least I knew what LISP was ... WTF is aramaic?!? LOL
a little known programming language used by jesus:

__________________
Official "Dumbass of the Year" 2011
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Deal with it...
the_lone_wolf is offline   Reply With Quote
Old 16-11-07, 02:53 PM   #8
Pedro68
Guest
 
Posts: n/a
Default Re: Lost In Stupid Parenthesis

So Jesus wasn't a carpenter then ... more of a "hacker"
  Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stupid stupid stupid snow and ice!!! Giggsy Idle Banter 6 14-12-08 03:38 PM
Nearly lost it!! Jester666 Photos 13 02-07-08 01:57 PM
Have I lost all of my NCB? SVeeedy Gonzales Bikes - Talk & Issues 15 08-06-06 04:44 PM
Lost key MattTheLoony SV Talk, Tuning & Tweaking 15 13-03-05 01:47 PM


All times are GMT. The time now is 02:09 PM.


Powered by vBulletin® - Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.