I've lost count; I think this is the sixth or seventh attempt to make a website using TiddlyWiki. Don't get me wrong -- there's nothing wrong with TiddlyWiki, I just tried umpteen different variants -- with and without an assortment of plugins as well as customizing the style sheet code like crazy. In the end I decided to just use the core TiddlyWiki code and go vanilla as much as possible. TiddlyWiki does a mighty fine job "out of the can" and I want to minimize "upgrade" woes down the road.\n----\nMy only real complaint so far is the rendering of mono space text (used for code snippettes) under Internet Explorer (see [[details|http://www.tiddlywiki.com/#InternetExplorer]]). It just wrecks it -- all "superfluous" spaces are stripped, competely slaying any attempts to format the code so it's readable by humans. Of course, it looks fine under FireFox <snicker>. Still, I hope this malady is fixed soon so it can display code snips consistantly accross browsers.\n----\nOther than that, woo hoo, this TiddlyWiki thing is very cool. The non linear [[Wiki]] linking thing is perfect for a code library. I can't believe I found such a great little gem. It was the result of buying David Allen's "[[Getting Things Done|http://www.davidco.com/store/catalog/Getting-Things-Done-Paperback-p-16175.php]]" book and performing some subsequent searches on the topic. One related website is [[43folders.com|http://www.43folders.com]], and it has it's own [[Wiki]]. I got to thinking that a personal [[Wiki]] would be great for a code library and abracadabra -- subsequent searches lead me to numeropus personal [[Wiki]] engines. In the end I liked TiddlyWiki the best.\n----\n<<tiddler CoolSmiley>>
Added QuoteOfTheDay and a couple other great add-ins from TiddlyTools. What a great community of developers TiddlyWiki has; w00t!\n----\nDid some experimentation trying to circumvent the mono spaced text problem ([[incorrectly rendered in Internet Explorer|http://www.tiddlywiki.com/#InternetExplorer]]). ~IFrames work, though it's a lot of effort for each [[Tiddler]] that hosts code snips. Saddy, TiddlyWiki doesn't recognize html object tags. //Still working on it ...//
Changed the site menuing system (at the upper left). Looks very clean to me now.\n----\nNow if I could just get that [[mono spaced text|http://www.tiddlywiki.com/#InternetExplorer]] to work; grrrr!
Learning a bit about css -- too cool -- great way to maintain and tweak the appearance of a web site.
Well -- tried my first stab at javascript tonight by massaging the listAll function written by Joseph Reisinger (found [[here|http://tiddlywikitips.com/#%5B%5BTip%20%2304%3A%20Tag%20Listing%20*%5D%5D]]) to produce listAllReverse (for listing blogs in reversed sort; last topmost). See [[Site Blogs]] to see it in actual use.
Added some more posts tonight, namely --\n\nAddXDictToEntity\nDistanceOf\nHiRes //and// LoRes\nIsFolderWriteable\nLayerProperties\nLoadSupport\nSetVersusSetQ
Added a couple more articles tonight --\n\n[[Children]]\n[[Evaluate]]\nFindFilesInTree\nGetDimAssocFlag\nGetDwgVersion\nGetFolders\nGetGroupNames\nIs3DPoint\nIsDigit\nIsPoint\nIsZero\nPicksetToEnames\nPurgeUnusedGroups\nSetSupportPath\nSSRedraw\n[[Replace]]\nTextpadHighlightDefuns\nUCSClassic\nGetVlaAtoms\nGetVlaMethods\nGetVlaProperties
And added yet more articles tonight --\n\nDCLProgramming\n[[Every]]\nGetPoints\nLSet\nMatrix-O-Matic\nRemoveFromPickSetIf\nRSet\nSetProjectPath\n[[Some]]\nToBinary\nToggleTabs
Today's posted articles --\n\nGetAttributesDXF\nGetAttributesActiveX\nSnapIsoPair
Few people succeed at what they do without the help, support, encouragement, perspective, prodding, dialogues and challenges provided by others. While I can't possibly note everyone who helped me get to this point in time, here's a short list of folks I'd like to give a nod --\n*Alex Januszkiewicz\n*Andrew Shalley\n*Bobby Jones\n*Bryan Gilbert\n*Charles (Chuck) Chauvin\n*Charles Alan Butler\n*Charlie Peppard\n*Damian Willcox\n*David Bethel\n*David Doanne\n*David Kozina\n*Dennis Shin\n*Doug Broad\n*Doug Brooks\n*Frank Oquendo\n*Ian Wright\n*James Davidson\n*Jeff Mishler\n*John Cleese\n*John Davies\n*John Kaul\n*Jürg Menzi\n*Keith Blackie\n*Kerry Brown\n*Linda Puckett\n*Luis Esquivel\n*Marc'Antonio Alexi\n*Mark Thomas\n*Mike Williams\n*Randy Culp\n*Reg Judd\n*Reini Urban\n*Ron Perez\n*Steve Doman\n*Stig Madsen\n*Tim Riley\n*Tim Willey\n*Tony Tanzillo\n*Vladimir Nesterovsky\n*Will ~DeLoach\n^^I reserve the right to add to this list as my conscience / memory dictates.^^
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=2646.msg33944#msg33944]]\n\n{{{\n(defun AddXDictToEntity ( ename / data xdict )\n\n ;;\n ;; Copyright © 2003 Michael Puckett\n ;;\n ;; add an xdictionary to an entity if it does not\n ;; have one, otherwise return the existing one\n ;;\n\n (cond\n\n ;; this works with every entity\n ;; and object I've tried, thus far\n\n ( (< 14 (atoi (getvar "acadver")))\n (if\n (setq xdict\n (vlax-invoke-method\n (vlax-ename->vla-object ename)\n 'GetExtensionDictionary\n )\n )\n (vlax-vla-object->ename xdict)\n )\n )\n\n ;; xdictionary exists, return it\n\n ( (cdr\n (assoc 360\n (member\n '(102 . "{ACAD_XDICTIONARY")\n (setq data (entget ename))\n )\n )\n )\n )\n\n ;; i've only tested "normal" entities, table\n ;; entities, and 3dsolids, so far code below\n ;; works for all except viewports and linetype\n ;; continuous ...\n\n ( (setq xdict\n (entmakex\n (list\n '(0 . "DICTIONARY")\n (cons\n (if\n (vl-member-if\n '(lambda (x)\n (member x\n '( (100 . "AcDbSymbolTable")\n (100 . "AcDbModelerGeometry")\n (100 . "AcDbViewport")\n )\n )\n )\n data\n )\n 330\n 360\n )\n ename\n )\n '(100 . "AcDbDictionary")\n '(280 . 1)\n )\n )\n )\n (if\n (entmod\n (append\n (reverse (member (assoc 5 data) (reverse data)))\n (list\n '(102 . "{ACAD_XDICTIONARY")\n (cons 360 xdict)\n '(102 . "}")\n )\n (cdr (member (assoc 5 data) data))\n )\n )\n xdict\n )\n )\n )\n)\n\n\n;; example:\n\n\n(AddXDictToEntity (tblobjname "layer" "0"))\n\n\n;=======================================================================\n;\n; Typical data\n;\n;=======================================================================\n; IAcadDictionary: A container object for storing and retrieving objects\n; Property values:\n; Application (RO) = #<VLA-OBJECT IAcadApplication 00b07a68>\n; Count (RO) = 0\n; Document (RO) = #<VLA-OBJECT IAcadDocument 00f58f8c>\n; Handle (RO) = "7059"\n; HasExtensionDictionary (RO) = 0\n; Name = AutoCAD.Application: Not applicable\n; ObjectID (RO) = 1074258440\n; ObjectName (RO) = "AcDbDictionary"\n; OwnerID (RO) = 1074257984\n; Methods supported:\n; AddObject (2)\n; AddXRecord (1)\n; Delete ()\n; GetExtensionDictionary ()\n; GetName (1)\n; GetObject (1)\n; GetXData (3)\n; Item (1)\n; Remove (1)\n; Rename (2)\n; Replace (2)\n; SetXData (2)\n; DXF Group Codes:\n; (-1 . <Entity name: 4007e208>)\n; (0 . "DICTIONARY")\n; (330 . <Entity name: 4007e040>)\n; (5 . "7059")\n; (100 . "AcDbDictionary")\n; (280 . 1)\n; (281 . 1)\n\n\n(defun AddDictToEntityXDict ( ename symbol / xdict dict )\n\n ;;\n ;; Copyright © 2003 Michael Puckett\n ;;\n ;; add a named, hard owned dictionary to an entity's\n ;; xdictionary if the dictionary already exists return\n ;; it\n ;;\n\n (if (setq xdict (AddXDictToEntity ename))\n (cond\n ( (setq dict (dictsearch xdict symbol))\n (cdr (assoc -1 dict))\n )\n ( (dictadd xdict symbol\n (entmakex\n '( (0 . "DICTIONARY")\n (100 . "AcDbDictionary")\n (280 . 1)\n )\n )\n )\n )\n )\n )\n)\n\n\n;; example:\n\n\n(AddDictToEntityXDict (tblobjname "layer" "0") "MyHardOwnedDick")\n\n\n;=======================================================================\n;\n; Typical data\n;\n;=======================================================================\n; IAcadDictionary: A container object for storing and retrieving objects\n; Property values:\n; Application (RO) = #<VLA-OBJECT IAcadApplication 00b07a68>\n; Count (RO) = 0\n; Document (RO) = #<VLA-OBJECT IAcadDocument 00f58f8c>\n; Handle (RO) = "705B"\n; HasExtensionDictionary (RO) = 0\n; Name = "MyHardOwnedDick"\n; ObjectID (RO) = 1074258456\n; ObjectName (RO) = "AcDbDictionary"\n; OwnerID (RO) = 1074258448\n; Methods supported:\n; AddObject (2)\n; AddXRecord (1)\n; Delete ()\n; GetExtensionDictionary ()\n; GetName (1)\n; GetObject (1)\n; GetXData (3)\n; Item (1)\n; Remove (1)\n; Rename (2)\n; Replace (2)\n; SetXData (2)\n; DXF Group Codes:\n; (-1 . <Entity name: 4007e218>)\n; (0 . "DICTIONARY")\n; (5 . "705B")\n; (102 . "{ACAD_REACTORS")\n; (330 . <Entity name: 4007e210>)\n; (102 . "}")\n; (330 . <Entity name: 4007e210>)\n; (100 . "AcDbDictionary")\n; (280 . 1)\n; (281 . 1)\n}}}
config.options.chkHttpReadOnly = true;\n
[[Swamp post.|http://www.theswamp.org/index.php?topic=2688.msg34326#msg34326]]\n\nAn abbreviated discussion about apply, mapcar and lambda --\n\n----\n\n''Apply'' is functionally similar to, and streamlines this --\n\n{{{\n(eval (cons item list))\n\ne.g. --\n\n(eval (cons '+ '(1 2 3)))\n\n=> 6\n}}}\n\nUsing ''Apply'' --\n\n{{{\n(apply '+ '(1 2 3))\n\n=> 6\n}}}\n\nApply a function to a list of items --\n\n''Mapcar'' is a function which lets you apply a function to every item in a list, and return the result as a list. e.g. --\n\n{{{\n(mapcar 'strcase '("a" "b" "c"))\n\n=> ("A" "B" "C")\n}}}\n \n''Lambda'' allows you to define a function (an anonymous one) on the fly, right where you need it, and after it's used, *poof*, it's gone. e.g. --\n\nInstead of :\n\n{{{\n(defun foo (num) (rtos num 2 3))\n\n(setq lst (list pi (sqrt pi) (expt pi (/ 1 3.0))))\n\n(mapcar 'foo lst)\n\n=> ("3.142" "1.772" "1.465")\n}}}\n\nUse ''lambda'' --\n\n{{{\n(mapcar \n '(lambda (num) (rtos num 2 3))\n lst\n)\n\n=> ("3.142" "1.772" "1.465")\n}}}\n\n''//:)//''
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=9467.msg122213#msg122213]]\n\n''APPLY''\n\nThe apply function is frequently used in conjunction with mapcar. Yet, because of that association the assumption is that it somehow //"doesn't stand on its own"//. While it can work very well in concert with mapcar there are many uses for the apply function that are fully independent of mapcar. The following attempts to help the reader understand apply a little more clearly so it can be more readily exploited -- //especially if you do wish to use it in tandem with mapcar// (smiley goes here).\n \nThe ~AutoLISP on line help sports a succint definition of apply, stating //"Passes a list of arguments to a specified function"//. While this description is perfectly adequate, the brevity may leave a noob scratching his or her respective head.\n\nI find examples the most illuminating so here we go ...\n\nAssume we have a number of integers, 8 2 5 1 14 4 5 3 and we want to find the largest one. Normally you would use the max function, which takes numbers as its arguments --\n\n{{{\n(max 8 2 5 1 14 4 5 3) => 14\n}}}\n\nWhich returns 14 (shown above as => 14, the convention used for the balance of this discussion).\n\nThis is fine, but what if the numbers are stored in a list?\n\n{{{\n(setq numbers '(8 2 5 1 14 4 5 3))\n}}}\n\nHow would you use the max function with a list, since it takes numbers, not lists as it arguments?\n\nYou cannot use --\n\n{{{\n(max numbers) => error => bad argument type.\n}}}\n\nBut you can use --\n\n{{{\n(apply 'max numbers) => 14\n}}}\n\nIf you are familiar with the eval and cons functions it would be equivalent to --\n\n{{{\n(eval (cons 'max numbers)) => 14\n}}}\n\nOr (using eval and append) --\n\n{{{\n(eval (append '(max) numbers)) => 14\n}}}\n\nOr (using eval, append and list) --\n\n{{{\n(eval (append (list 'max) numbers)) => 14\n}}}\n\nObviously apply is more elegant and succinct.\n\nLet's explore some more examples (remember the variable 'numbers' is set to '(8 2 5 1 14 4 5 3)) --\n\n{{{\n(apply 'min numbers) => 1\n(apply '+ numbers) => 42\n(apply '* numbers) => 67200\n}}}\n\nCan you visualize what's happening above?\n\nLet's abandon the numbers and concatenate a simple list of strings ...\n\n{{{\n(apply 'strcat '("A" "B" "C")) => "ABC"\n}}}\n\nEasy stuff.\n\nHope this little discussion and these simple examples help you understand the apply function, it's a convenient little creature I dare say.\n\n----\n\nFor an abbreviated discussion of ''mapcar'' / ''lambda'' please see MapcarLambdaOhMy.
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=5185.0]]\n\nResponding to a challenge in [[this|http://www.theswamp.org/phpBB2/viewtopic.php?topic=5176]] thread (thanks Chuck!) I wrote [[AxProps|http://www.theswamp.org/lilly_pond/mp/lisp/axprops.fas?nossi=1]] (use your logon name / password to download), a little utility that provides a simple gui interface to display all the properties and methods exposed to ~AutoLISP (via vla-*, vlax-get/put/invoke etc.) for a specified entity or object -- \n\n[img[http://cadlabs.com/images/axprops01.png]]\n\nDouble clicking an entry in the dialog will invoke the help system and display the appropriate help (if a topic for that item exists) --\n\n[img[http://cadlabs.com/images/axprops02.png]]\n\n[img[http://cadlabs.com/images/coordshelp.png]]\n\nFinally, when there is a difference in the result returned by vlax-get and vlax-get-property (the former generally returning data types native to ~AutoLISP, the latter data types native to ~ActiveX), it shows both results separate by a " | " (pipe) symbol --\n\n[img[http://cadlabs.com/images/axprops03.png]]\n\nDownload -- \n\n[[AxProps.fas|http://www.theswamp.org/lilly_pond/mp/lisp/axprops.fas?nossi=1]] (use your logon name / password).\n\nCommand / Functions --\n*''c:~AxProps'' -- prompts you to to select an entity.\n*''c:~NAxProps'' -- prompts you to to select a nested entity.\n*''~AxProps'', syntax: ''(~AxProps x)'', where x is any valid object, ename or handle.\nFeel crazy? Try this ''(axprops "1")'', lol.\n\nI plan to add the ability to dump the whole mess to notepad so you can use the info in other ways, print off etc. Other ideas welcome, will try to incorporate ideas keeping with it's simple philosophy and lightweight footprint when I've the time.\n\nFinal note: I wrote this quick under Windows XP Pro and vanilla ~AutoCAD 2006. When this crashes on your system please provide the noted information, you'll be helping me out a lot. Thanks.\n\nEnjoy.\n\n<<tiddler Smiley>>
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=3952.0]]\n\nThis is a ~BenchMarking tool I use to profile the relative performance of ~VisualLISP functions. It's not perfect, nor is it without errors. It is free though.\n\n{{{\n(defun Benchmark\n\n ;;=================================================================\n ;;\n ;; Benchmark.lsp | © 2005 Michael Puckett | All Rights Reserved\n ;;\n ;;=================================================================\n ;;\n ;; Purpose:\n ;;\n ;; Compare the performance of various statements.\n ;;\n ;; Notes:\n ;;\n ;; I make no claims that this is definitive benchmarking. I\n ;; wrote this utility for my own purposes and thought I'd\n ;; share it. Many considerations go into evaluating the\n ;; performance or suitability of an algorythm for a given\n ;; task. Raw performance as profiled herein is just one.\n ;;\n ;; Please note that background dramatically affect results.\n ;;\n ;; Disclaimer:\n ;;\n ;; This program is flawed in one or more ways and is not fit\n ;; for any particular purpose, stated or implied. Use at your\n ;; own risk.\n ;;\n ;;=================================================================\n ;;\n ;; Syntax:\n ;;\n ;; (Benchmark statements)\n ;;\n ;; Where statements is a quoted list of statements.\n ;;\n ;;=================================================================\n ;;\n ;; Example:\n ;;\n ;; (BenchMark\n ;; '(\n ;; (1+ 1)\n ;; (+ 1 1)\n ;; (+ 1 1.0)\n ;; (+ 1.0 1.0)\n ;; )\n ;; )\n ;;\n ;;=================================================================\n ;;\n ;; Output:\n ;;\n ;; Elapsed milliseconds / relative speed for 32768 iteration(s):\n ;;\n ;; (1+ 1)..........1969 / 1.09 <fastest>\n ;; (+ 1 1).........2078 / 1.03\n ;; (+ 1 1.0).......2125 / 1.01\n ;; (+ 1.0 1.0).....2140 / 1.00 <slowest> \n ;;\n ;;=================================================================\n\n (\n statements\n /\n _LSet\n _RSet\n _ToString\n _Eval\n _Princ\n _Main\n )\n\n ;;=================================================================\n ;;\n ;; (_LSet text len fillChar)\n ;;\n ;;=================================================================\n\n (defun _LSet ( text len fillChar / padding result )\n\n (setq\n padding (list (ascii fillChar))\n result (vl-string->list text)\n )\n\n (while\n (< (length\n (setq padding\n (append padding padding)\n )\n )\n len\n )\n )\n\n (while\n (< (length\n (setq result\n (append result padding)\n )\n )\n len\n )\n )\n\n (substr (vl-list->string result) 1 len)\n\n )\n\n ;;=================================================================\n ;;\n ;; (_RSet text len fillChar)\n ;;\n ;;=================================================================\n\n (defun _RSet ( text len fillChar / padding result )\n\n (setq\n padding (list (ascii fillChar))\n result (vl-string->list text)\n )\n\n (while\n (< (length\n (setq padding\n (append padding padding)\n )\n )\n len\n )\n )\n\n (while\n (< (length\n (setq result\n (append padding result)\n )\n )\n len\n )\n )\n\n (substr\n (vl-list->string result)\n (1+ (- (length result) len))\n )\n\n )\n\n ;;=================================================================\n ;;\n ;; (_ToString x)\n ;;\n ;;=================================================================\n\n (defun _ToString ( x / result )\n (if\n (< (strlen\n (setq result\n (vl-prin1-to-string x)\n )\n )\n 40\n )\n result\n (strcat (substr result 1 36) "..." (chr 41))\n )\n )\n\n ;;=================================================================\n ;;\n ;; (_Eval statement iterations)\n ;;\n ;;=================================================================\n\n (defun _Eval ( statement iterations / start )\n\n (gc)\n (setq start (getvar "millisecs"))\n (repeat iterations (eval statement))\n (- (getvar "millisecs") start)\n\n )\n\n ;;=================================================================\n ;;\n ;; (_Princ x)\n ;;\n ;;=================================================================\n\n (defun _Princ ( x )\n (princ x)\n (princ) ;; forces screen update\n )\n\n ;;=================================================================\n ;;\n ;; (_Main statements)\n ;;\n ;;=================================================================\n\n (defun _Main\n\n ( statements\n /\n boundary\n iterations\n timings\n slowest\n fastest\n lsetLen\n rsetLen\n index\n count\n )\n\n (setq\n boundary 1000\n iterations 1\n )\n\n (_Princ "Benchmarking ...")\n\n (while\n (or\n (< (apply 'max\n (setq timings\n (mapcar\n '(lambda (statement)\n (_Eval statement iterations)\n )\n statements\n )\n )\n )\n boundary\n )\n (< (apply 'min timings)\n boundary\n )\n )\n (setq iterations\n (* 2 iterations)\n )\n (_Princ ".")\n )\n\n (_Princ\n (strcat\n "\srElapsed milliseconds / relative speed for "\n (itoa iterations)\n " iteration(s):\sn\sn"\n )\n )\n\n (setq\n slowest (float (apply 'max timings))\n fastest (apply 'min timings)\n )\n\n (setq lsetLen\n (+ 5\n (apply 'max\n (mapcar 'strlen\n (setq statements\n (mapcar '_ToString\n statements\n )\n )\n )\n )\n )\n )\n\n (setq rsetLen\n (apply 'max\n (mapcar\n '(lambda (ms) (strlen (itoa ms)))\n timings\n )\n )\n )\n\n (setq\n index 0\n count (length statements)\n )\n\n (foreach pair\n\n (vl-sort\n (mapcar 'cons statements timings)\n '(lambda (a b) (< (cdr a) (cdr b)))\n )\n\n ( (lambda ( pair / ms )\n (_Princ\n (strcat\n " "\n (_LSet (car pair) lsetLen ".")\n (_RSet\n (itoa (setq ms (cdr pair)))\n rsetLen\n "."\n )\n " / "\n (rtos (/ slowest ms) 2 2)\n (cond\n ((eq 1 (setq index (1+ index))) " <fastest>")\n ((eq index count) " <slowest>")\n ("")\n )\n "\sn"\n )\n )\n )\n pair\n )\n )\n\n (princ)\n\n )\n\n ;;=================================================================\n ;;\n ;; Program is defined, let's rock and roll ...\n ;;\n ;;=================================================================\n\n (_Main statements)\n\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4064.0]]\n\nOk, so I'm making up new terminology.\n\nMany years ago I had competed in a contest to write a function to flatten a nested list (no dotted pairs) to a non nested list.\n\n''Example:''\n\n{{{\n(setq lst\n '(1 (2 (3 (4 (5 (6 (7 (8))))))))\n)\n\n(flatten lst)\n\n=> (1 2 3 4 5 6 7 8)\n}}}\n\nThe winner in my mind (based on eloquence) was one by Doug Broad, a very pretty recursive one --\n\n{{{\n(defun flatten ( lst )\n ;; by Doug Broad\n (cond\n ((null lst) nil)\n ((atom lst) (list lst))\n ((atom (car lst)) (cons (car lst) (Flatten (cdr lst))))\n ((append (Flatten (car lst))(Flatten (cdr lst))))\n )\n)\n}}}\n\nI recently had need (like yesterday) to flatten a nested list and thought I'd take a stab at writing a new one with fresh eyes. Well ... I ended up penning a funny one that is 'bicursive', that is, two functions keep calling each other until the problem is solved. While Doug's beats it when small lists are being processed, it smokes when processing larger lists (when you really need the performance) --\n\n{{{\n(defun Squish ( lst )\n ;; © 2005 Michael Puckett\n (apply 'append\n (mapcar 'SquishEx lst)\n )\n)\n\n(defun SquishEx ( x / a )\n ;; © 2005 Michael Puckett\n (if (listp x)\n (if (listp (setq a (car x)))\n (append (Squish a) (Squish (cdr x)))\n (cons a (Squish (cdr x)))\n )\n (list x)\n )\n)\n\n(squish lst)\n\n=> (1 2 3 4 5 6 7 8)\n}}}\n\nSome [[BenchMarking|Benchmark]] --\n\n{{{\n(progn\n\n (defun Flatten ( lst )\n ;; by Doug Broad\n (cond\n ((null lst) nil)\n ((atom lst) (list lst))\n ((atom (car lst)) (cons (car lst) (Flatten (cdr lst))))\n ((append (Flatten (car lst))(Flatten (cdr lst))))\n )\n )\n \n (defun Squish ( lst )\n ;; © 2005 Michael Puckett\n (apply 'append\n (mapcar 'SquishEx lst)\n )\n )\n\n (defun SquishEx ( x / a )\n ;; © 2005 Michael Puckett\n (if (listp x)\n (if (listp (setq a (car x)))\n (append (Squish a) (Squish (cdr x)))\n (cons a (Squish (cdr x)))\n )\n (list x)\n )\n )\n\n (setq big_list \n (setq small_list \n '(1 (2 (3 (4 (5 (6 (7 (8))))))))\n )\n )\n \n (Benchmark\n '( (flatten small_list)\n (squish small_list)\n )\n )\n \n (repeat 8\n (setq big_list\n (append big_list big_list)\n )\n )\n \n (Benchmark\n '( (flatten big_list)\n (squish big_list)\n )\n )\n \n)\n}}}\n\n''Results --''\n\n{{{\nMilliseconds / relative speed for 16384 iteration(s):\n\n (FLATTEN SMALL_LIST).....1750 / 1.36 <fastest>\n (SQUISH SMALL_LIST)......2375 / 1.00 <slowest>\n \nMilliseconds / relative speed for 64 iteration(s):\n\n (SQUISH BIG_LIST).......1672 / 7.05 <fastest> YEOW!\n (FLATTEN BIG_LIST).....11781 / 1.00 <slowest>\n}}}\n\n''Couple questions --''\n*Do you see any potential problems or flaws in my logic?\n*Can you write one that has a flatter performance, i.e. performs equally well at both ends of the spectrum (small versus large lists)?\n\n[[Discussion here.|http://www.theswamp.org/index.php?topic=4064.0]]
[[Swamp Post.|http://www.theswamp.org/index.php?topic=9201.msg118677#msg118677]]\n\nReturn a list of entity names that are a child of the specified entity, like attributes or vertices (for block sand polylines respectively).\n\n{{{\n(defun Children ( parent / result )\n (if (assoc 66 (entget parent))\n (reverse\n (while\n (/= "SEQEND"\n (cdr\n (assoc 0\n (entget\n (setq parent\n (entnext parent)\n )\n )\n )\n )\n )\n (setq result (cons parent result))\n )\n )\n )\n)\n}}}
''Existing clients --''\n<<<\nPlease use your client logon at:\n\nhttp://www.cadlabs.net\n<<<\n''What do we do?''\n<<<\nWe provide CADD Management and Visual BASIC / Visual LISP Programming for companies that need to outsource all / portions of these duties (immediate / short / long term).\n\nOur client base is by referral though we do select cold call work.\n<<<\n''Inquiries?''\n<<<\n<<tiddler Inquiries>>\n<<<\nThank you.\n\nMichael Puckett.
<<tag ActiveX>>\n<<tag Atoms>>\n<<tag Attributes>>\n<<tag Blocks>>\n<<tag BoundingBoxes>>\n<<tag Collections>>\n<<tag DCL>>\n<<tag Dictionaries>>\n<<tag Dimensions>>\n<<tag DXF>>\n<<tag Entities>>\n<<tag Files>>\n<<tag Folders>>\n<<tag Frivolous>>\n<<tag Groups>>\n<<tag GrRead>>\n<<tag Hex>>\n<<tag Lambda>>\n<<tag Layers>>\n<<tag Lists>>\n<<tag Mapcar>>\n<<tag Methods>>\n<<tag ModelSpace>>\n<<tag Networks>>\n<<tag Numerics>>\n<<tag ObjectDBX>>\n<<tag Objects>>\n<<tag PaperSpace>>\n<<tag Points>>\n<<tag Properties>>\n<<tag Reactors>>\n<<tag Recursion>>\n<<tag Registry>>\n<<tag SelectionSets>>\n<<tag Strings>>\n<<tag SystemVariables>>\n<<tag Techniques>>\n<<tag Textpad>>\n<<tag Tips>>\n<<tag Tools>>\n<<tag UCS>>\n<<tag Urls>>\n<<tag Variables>>\n<<tag Vectors>>\n<<tag Versions>>\n<<tag ViewPorts>>\n<<tag XData>>\n<<tag XDictionaries>>\n<<tag XRecords>>\n<<tag XRefs>>\n<<tag Zooms>>
/%<<tag VisualLISP>>\n<<tag VisualBASIC>>\n<<tag Python>>%/<<tiddler VisualLISP>>
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=2694.0]]\n\nPosted to comp.cad.autocad many years ago in response to a challenge posted by Reini Urban.\n\n{{{\n(defun Combinations ( lst n / bits-sum bits-list-m combos )\n\n ;;--------------------------------------------------------------------\n ;;\n ;; Combinations.lsp\n ;;\n ;; Written by Michael Puckett 1999/07/30.\n ;;\n ;; Released to public domain same date.\n ;;\n ;;--------------------------------------------------------------------\n ;;\n ;; Written for a contest posted on comp.cad.autocad 1999/07/29.\n ;;\n ;; See discussion here:\n ;;\n ;; http://xarch.tu-graz.ac.at/autocad/stdlib/archive/7/msg00043.html\n ;;\n ;; From my original coding: This can handle a maximum of 31 items\n ;; for the combination, although if you try it with 31 items, you\n ;; might as well go for a holiday. This ain't the fastest routine,\n ;; but it does work (albeit tested very little).\n ;;\n ;; The version presented here has been cleaned up but algorythmically\n ;; is identical to the one at the link above.\n ;;\n ;;--------------------------------------------------------------------\n ;;\n ;; Example:\n ;;\n ;; (combinations '(A B C D E) 4)\n ;;\n ;; Returns:\n ;;\n ;; ((A B C D) (A B C E) (A B D E) (A C D E) (B C D E))\n ;;\n ;;--------------------------------------------------------------------\n\n (defun bits-sum ( n / i result )\n (setq result 0)\n (repeat (setq i (1+ n))\n (setq result\n (+ result\n (expt 2\n (setq i (1- i))\n )\n )\n )\n )\n )\n\n (defun bits-list-m ( n m / power result )\n (repeat (setq power (fix (+ 1.5 (/ (log n) (log 2)))))\n (if (not (zerop (logand n (expt 2 (setq power (1- power))))))\n (setq result (cons power result))\n )\n )\n (if (eq m (length result)) result)\n )\n\n (defun combos ( lst n / len mask bits result )\n (if (and (< (setq len (length lst)) 32) (< n len))\n (repeat (1- (setq mask (1+ (bits-sum (1- len)))))\n (if (setq bits (bits-list-m (setq mask (1- mask)) n))\n (setq result\n (cons\n (mapcar '(lambda (m) (nth m lst)) bits)\n result\n )\n )\n )\n )\n )\n result\n )\n\n (combos lst n)\n\n)\n}}}
[img[http://cadlabs.com/images/coolsmiley.gif]]
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=9433.0]]\n\nI use this in conjunction with some other tools to do quick diagnostics / post mortems on drawings.\n\n{{{\n(defun Counts\n\n ;;········································································\n ;;\n ;; Counts\n ;;\n ;; Copyright © 2003 Michael Puckett. All Rights Reserved.\n ;;\n ;; Diagnostic counts of all primary collections.\n ;;\n ;;········································································\n\n ( document\n /\n _ActiveX\n _GetProperty\n _InvokeMethod\n _GetName\n _PrintCount\n _PrintCountx\n _Main\n )\n\n ;;········································································\n ;;\n ;; local (_ActiveX Action Object ParameterList)\n ;;\n ;; an error trapped wrapper for vlax-invoke-method and\n ;; vlax-get-property called directly by InvokeMethod and\n ;; GetProperty ( defined in this same source )\n ;;\n ;;········································································\n\n (defun _ActiveX ( Action Object ParameterList / Result )\n (if\n (null\n (vl-catch-all-error-p\n (setq Result\n (vl-catch-all-apply\n Action\n (cons\n Object\n ParameterList\n )\n )\n )\n )\n )\n Result\n )\n )\n\n ;;········································································\n ;;\n ;; local (_GetProperty Object Property)\n ;;\n ;; an error trapped wrapper for vlax-get-property.\n ;;\n ;;········································································\n\n (defun _GetProperty ( Object Property )\n (_ActiveX\n 'vlax-get-property\n Object\n (list Property)\n )\n )\n\n ;;········································································\n ;;\n ;; local (_InvokeMethod Object Method ParameterList)\n ;;\n ;; an error trapped wrapper for vlax-invoke-method\n ;;\n ;;········································································\n\n (defun _InvokeMethod ( Object Method ParameterList )\n (_ActiveX\n 'vlax-invoke-method\n Object\n (cons\n Method\n ParameterList\n )\n )\n )\n\n ;;········································································\n ;;\n ;; local (_GetName Object)\n ;;\n ;;········································································\n\n (defun _GetName ( Object / Name Handle ObjectID )\n ;; variables Groups, Layouts and PlotConfigurations\n ;; assumed to be set to valid objects (as appropriate)\n ;; by the calling function\n (cond\n ( (setq Name (_GetProperty Object 'Name))\n Name\n )\n ( (equal Groups Object)\n "Groups"\n )\n\n ( (equal Layouts Object)\n "Layouts"\n )\n\n ( (equal PlotConfigurations Object)\n "PlotConfigurations"\n )\n ( (setq Handle (_GetProperty Object 'Handle))\n (strcat "Nameless, Handle=" Handle)\n )\n ( (setq ObjectID (_GetProperty Object 'ObjectID))\n (strcat "Nameless, ObjectID=" (vl-princ-to-string ObjectID))\n )\n ( "N/A" )\n )\n )\n\n ;;········································································\n ;;\n ;; local (_PrintCount Object ObjectName)\n ;;\n ;;········································································\n\n (defun _PrintCount ( Object ObjectName / Count )\n (cond\n ( (and\n Object\n (setq Count\n (_GetProperty\n Object\n 'Count\n )\n )\n )\n (princ\n (strcat\n ObjectName\n ".Count = "\n (itoa Count)\n "\sn"\n )\n )\n )\n ( (null Object)\n (princ\n (strcat\n "Error attempting <"\n ObjectName\n "> object access.\sn"\n )\n )\n )\n ( (null Count)\n (princ\n (strcat\n ObjectName\n " has no <Count> property.\sn"\n )\n )\n )\n )\n )\n\n ;;········································································\n ;;\n ;; local (_PrintCountX Object)\n ;;\n ;;········································································\n\n (defun _PrintCountX ( Object / ObjectName Count )\n (cond\n ( (and\n Object\n (setq Count\n (_GetProperty\n Object\n 'Count\n )\n )\n )\n (princ\n (strcat\n " "\n (_GetName Object)\n ".Count = "\n (itoa Count)\n "\sn"\n )\n )\n )\n ( (null Object)\n (princ\n (strcat\n " "\n "Error attempting object "\n "access <null>.\sn"\n )\n )\n )\n ( (null Count)\n (princ\n (strcat\n " "\n (_GetName Object)\n " has no <Count> property.\sn"\n )\n )\n )\n )\n )\n\n ;;········································································\n ;;\n ;; local (_Main)\n ;;\n ;; gather and execute localized functions etc.\n ;;\n ;;········································································\n\n (defun _Main\n\n ( document\n /\n table\n object\n count\n groups\n layouts\n plotConfigurations\n )\n\n (setq groups\n (vlax-get-property\n document\n 'Groups\n )\n )\n\n (setq layouts\n (vlax-get-property\n document\n 'Layouts\n )\n )\n\n (setq plotConfigurations\n (vlax-get-property\n document\n 'PlotConfigurations\n )\n )\n\n ;;\n ;; scan the primary collections (tables)\n ;;\n\n (foreach tableName '( "Blocks" "Dictionaries" )\n\n (_PrintCount\n (setq table\n (_GetProperty\n document\n (read TableName)\n )\n )\n tableName\n )\n\n (vlax-for entry table\n (_PrintCountX entry)\n )\n\n )\n\n ;;\n ;; finish the primary collections (tables)\n ;;\n\n (foreach tableName\n\n (quote\n ( "DimStyles"\n "Groups"\n "Layers"\n "Layouts"\n "Linetypes"\n "RegisteredApplications"\n "Modelspace"\n "Paperspace"\n )\n )\n\n (_PrintCount\n (setq table\n (_GetProperty\n document\n (read tableName)\n )\n )\n tableName\n )\n\n )\n\n (princ)\n\n )\n\n ;;········································································\n ;;\n ;; call (_Main)\n ;;\n ;;········································································\n\n (_Main document)\n\n)\n}}}\n\nCommand wrapper for active document --\n\n{{{\n(defun c:Counts ( )\n (counts\n (vla-get-activedocument\n (vlax-get-acad-object)\n )\n )\n (princ)\n)\n}}}
Most of these are Will Rogers quotes --\n<<<\n*Always drink upstream from the herd.\n*Diplomacy is the art of saying "Nice doggie" until you can find a rock.\n*Don't squat with your spurs on.\n*If you find yourself in a hole stop digging.\n*If you're riding' ahead of the herd, take a look back every now and then to make sure it's still there.\n*Never approach a bull from the front, a horse from the rear, or a fool from any direction.\n*Never ask a barber if you need a haircut.\n*Never kick a cow chip on a hot day.\n*Never miss a good chance to shut up.\n*Never slap a man who's chewing tobacco.\n*Talk slowly, think quickly.\n*The best way out of a difficulty is through it.\n*There's two theories to arguing with a woman. Neither one works.\n*Timing has a lot to do with the outcome of a rain dance.\n*What the country needs is dirtier fingernails and cleaner minds.
[[Swamp post.|http://www.theswamp.org/index.php?topic=6741.msg83220#msg83220]]\n\nI've frequently heard how difficult or laborious dcl programming is and I just don't see it. While a dcl based dialog can't challenge one defined by a more modern application like Delphi or Visual BASIC, they're a snap to make (and since they're plain text, can be written on the fly, though that's another discussion), particularly if you build sub assemblies to use in your dialog. Once you define sub assemblies the only thing, generally speaking, that varies from instance to instance is the key (and sometimes the label).\n\nFor example, in the dcl Alan authored (in the Swamp link above) it could be broken down as follows (this would all be in one file, but breaking it up like this for discussion makes it easier to digest) --\n\n''General dcl settings'' -- \n\n{{{\n//\n// general dcl settings \n//\n\ndcl_settings : default_dcl_settings\n\n{ audit_level = 3; }\n}}}\n\n''Sub assembly definitions'' --\n\n{{{\n//\n// sub assembly definitions\n//\n\nattribute_prompt : text {\n value = "Attribute Prompt" ;\n width = 30;\n fixed_width = true;\n}\n\nattribute_value : edit_box {\n edit_width = 34;\n edit_limit = 200;\n fixed_width = true;\n}\n\nattribute_state : image_button {\n height = 1;\n width = 2;\n fixed_width = true;\n fixed_height = true;\n aspect_ratio = 1;\n color = -15;\n}\n\nmybutton : button {\n width = 12;\n fixed_width = true;\n}\n}}}\n\n''Dialog definition'' --\n\n{{{\n//\n// dialog definition\n//\n\nMyAttEdit : dialog {\n \n label = " MyAttEdit by CAB v1.0";\n \n : text {\n value = "Block Name: My Block";\n key = "txtblock";\n width = 50;\n } \n\n : text {\n value = "Page # ";\n key = "page";\n width = 10;\n alignment = right;\n } \n \n spacer_1;\n \n // use the sub assemblies we defined\n \n : row {\n : attribute_prompt { key = "txt1"; } \n : attribute_value { key = "eb1"; } \n : attribute_state { key = "im1"; } \n }\n \n : row {\n : attribute_prompt { key = "txt2"; } \n : attribute_value { key = "eb2"; } \n : attribute_state { key = "im2"; } \n }\n \n : row {\n : attribute_prompt { key = "txt3"; } \n : attribute_value { key = "eb3"; } \n : attribute_state { key = "im3"; } \n }\n \n : row {\n : attribute_prompt { key = "txt4"; } \n : attribute_value { key = "eb4"; } \n : attribute_state { key = "im4"; } \n }\n \n : row {\n : attribute_prompt { key = "txt5"; } \n : attribute_value { key = "eb5"; } \n : attribute_state { key = "im5"; } \n }\n \n : row {\n : attribute_prompt { key = "txt6"; } \n : attribute_value { key = "eb6"; } \n : attribute_state { key = "im6"; } \n }\n \n : row {\n : attribute_prompt { key = "txt7"; } \n : attribute_value { key = "eb7"; } \n : attribute_state { key = "im7"; } \n }\n \n : row {\n : attribute_prompt { key = "txt8"; } \n : attribute_value { key = "eb8"; } \n : attribute_state { key = "im8"; } \n }\n \n spacer_1;\n\n : row { \n : mybutton { key = "ok"; label = "&OK"; }\n : mybutton { key = "cancel"; label = "&Cancel"; is_cancel = true; }\n : mybutton { key = "prev"; label = "&Previous"; }\n : mybutton { key = "next"; label = "&Next"; }\n : mybutton { key = "help"; label = "&Help"; }\n }\n\n}\n}}}\n\nThis greatly speeds up dcl development, moreover, it makes maintenance a snap. Did ya note how I right aligned the key values for all the instanced sub assemblies? Makes it easy to assign and ensure the keys are correct (typically numerically incremented). \n\nBut more on maintenance ...\n\nFor example, if the {{{attribute_prompt}}} sub assembly width is found to be too wide, the {{{width = 30;}}} statement could be changed to {{{width = 25;}}} and all 8 instances will reflect same. Really takes the chore out of maintenance and makes it a lot easier to achieve consistancy throughout a dialog. \n\nAnother example: Say we decide to change the {{{attribute_state}}} sub assembly to a {{{text tile}}} from an {{{image_button}}}. No Problem --\n\n{{{\n/*attribute_state : image_button {\n height = 1;\n width = 2;\n fixed_width = true;\n fixed_height = true;\n aspect_ratio = 1;\n color = -15;\n}*/\n\nattribute_state : text {\n fixed_width = true;\n width = 1;\n is_bold = true;\n}\n}}}\n\nNow all 8 instances of {{{attribute_state}}} are {{{text tiles}}} instead of {{{image buttons}}} (ps: I think if you made the image buttons just image tiles there may not be a border around them Alan). \n\nOf course the code would have to reflect same:\n\n{{{\n(defun asterisk ( tile / x y )\n\n (set_tile tile "*")\n \n ;| <comment out former code>\n \n (setq \n X (dimx_tile tile)\n Y (dimy_tile tile)\n )\n (start_image tile)\n (fill_image 0 0 x y -15)\n (mapcar 'vector_image; Color 1\n (list 5 1 1 0)\n (list 0 9 1 5)\n (list 5 9 9 10)\n (list 10 1 9 5)\n (list 1 1 1 1)\n )\n (end_image)\n\n </comment out former code> |;\n)\n}}}\n\nAnd:\n\n{{{\n(defun ast_clear ( tile / x y )\n\n (set_tile tile "")\n \n ;| <comment out former code>\n\n (setq \n X (dimx_tile tile)\n Y (dimy_tile tile)\n )\n (start_image tile)\n (fill_image 0 0 x y -15)\n (end_image)\n\n </comment out former code> |;\n)\n}}}\n\nFinal tip: Read up on the {{{@include}}} statement (in the context of dcl source files and subassembly discussion above).\n\n:-D
[[Swamp discussion|http://www.theswamp.org/index.php?topic=8304.0]]\n\nI penned this quick and dirty for a colleague. It illuminates how to read ~AutoCAD registry entries.\n\n{{{\n(defun c:DblClickToggle ( )\n\n (cond\n ( (zerop\n (vl-registry-read\n (strcat\n "HKEY_CURRENT_USER\s\s"\n (vlax-product-key)\n "\s\sprofiles\s\s"\n (vla-get-activeprofile\n (vla-get-profiles\n (vla-get-preferences\n (vlax-get-acad-object)\n )\n )\n )\n "\s\sGeneral"\n )\n "DoubleClickEdit"\n )\n )\n (command ".dblclkedit" "_on")\n (if (zerop (getvar "pickfirst"))\n (setvar "pickfirst" 1)\n )\n )\n ((command ".dblclkedit" "_off"))\n )\n\n (princ)\n\n)\n}}}
[[cadlabs.com]]
[[Swamp post.|http://www.theswamp.org/index.php?topic=9780.msg125327#msg125327]]\n\n{{{\n(defun DistanceOf ( x / result )\n (vl-catch-all-apply\n '(lambda ( )\n (vl-some\n '(lambda (units) (setq result (distof x units)))\n (list (getvar "lunits") 4 5 2 1)\n )\n )\n ) \n result\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=3020.msg37746;topicseen#msg37746]]\n\nQuick and dirty -- \n\n{{{\n(defun c:DrawingToByLayer\n\n ;;-----------------------------------------------------------------\n ;;\n ;; Copyright © 2004 Michael Puckett. All Rights Reserved\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; Forces the entire drawing to "ByLayer" (even xrefs for\n ;; the lifetime of the session or until an xref reload\n ;; occurs).\n ;;\n ;; Forces block definition child entities to layer "0".\n ;;\n ;; Existing attributes are forced to the same layer the\n ;; parent block reside on.\n ;;\n ;; Nominally tested, let me know if you find anything wonky.\n ;;\n ;; * Use at your own risk. Please test on a dummy dwg *\n ;;\n ;;-----------------------------------------------------------------\n\n ( /\n _UnLockAllLayers\n _LockLayers\n _ObjectToLayerZero\n _ObjectToByLayer\n _DocumentToByLayer\n _Main\n )\n\n (defun _UnLockAllLayers ( document / result )\n (vlax-for layer\n (vlax-get-property\n document\n 'Layers\n )\n (cond\n ( (eq :vlax-true\n (vlax-get-property\n layer\n 'Lock\n )\n )\n (vlax-put-property\n layer\n 'Lock\n :vlax-false\n )\n (setq result\n (cons layer\n result\n )\n )\n )\n )\n )\n result\n )\n\n (defun _LockLayers ( layers )\n (foreach layer layers\n (vlax-put-property\n layer\n 'Lock\n :vlax-true\n )\n )\n )\n\n (defun _ObjectToLayerZero ( object )\n (vlax-put-property object\n 'Layer\n "0"\n )\n )\n\n (defun _ObjectToByLayer ( obj / layer )\n (foreach property '((Color . 256)(Linetype . "ByLayer"))\n (vl-catch-all-apply\n 'vlax-put\n (list\n obj\n (car property)\n (cdr property)\n )\n )\n )\n (cond\n ( (and\n (eq "AcDbBlockReference"\n (vlax-get\n obj\n 'ObjectName\n )\n )\n (eq :vlax-true\n (vlax-get-property\n obj\n 'HasAttributes\n )\n )\n )\n (setq layer (vlax-get-property obj 'Layer))\n (foreach child (vlax-invoke obj 'GetAttributes)\n (_ObjectToByLayer child)\n (vlax-put-property child 'Layer layer)\n )\n )\n )\n )\n\n (defun _DocumentToByLayer ( document )\n (vlax-for block (vlax-get-property document 'Blocks)\n (if\n (eq :vlax-true\n (vlax-get-property block\n 'IsLayout\n )\n )\n (vlax-for object block\n (_ObjectToByLayer object)\n )\n (vlax-for object block\n (_ObjectToByLayer object)\n (_ObjectToLayerZero object)\n )\n )\n )\n )\n\n (defun _Main ( / document lockedLayers )\n (setq lockedLayers\n (_UnlockAllLayers\n (setq document\n (vlax-get-property\n (vlax-get-acad-object)\n 'ActiveDocument\n )\n )\n )\n )\n (_DocumentToByLayer document)\n (_LockLayers lockedLayers)\n (princ)\n )\n\n (_Main)\n\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=2550.0]]\n\nA quick and dirty version of a function that addresses a very common request -- //how can I dump attributes?//\n\n{{{\n(defun DumpAttribs\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; DumpAttribs 1.0\n ;;\n ;; Copyright © 2004 Michael Puckett. All Rights Reserved.\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Written Quick and Dirty for Greg X, Daron X & TheSwamp.org\n ;;\n ;; 2004/09/24 : Original code : Michael Puckett\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Syntax (DumpAttribs document blockNameSpec sortByYcordFlag)\n ;;\n ;; If the document contains attributed blocks that match the block name\n ;; spec export the data to a CSV file (same name as the document w/a\n ;; ".CSV" extension).\n ;;\n ;; The document object can be a document opened in the AutoCAD editor\n ;; or one opened by ObjectDBX.\n ;;\n ;; NOTE: The caller is responsible for ensuring a valid document object\n ;; and block name spec is passed to this function. Said spec could be\n ;; something like "BOM", "BOM*" or "*"; typical wcmatch spec'ing.\n ;;\n ;; If the sort by ycord flag is non null the data will be sorted by\n ;; the y coordinate of the block references, otherwise it will be\n ;; ordered per the block reference's residency in paperspace and then\n ;; modelspace.\n ;;\n ;;-----------------------------------------------------------------------\n\n ( document\n blockNameSpec\n sortByYcordFlag\n /\n _BlockReference->CSV\n _GetAttributes\n _GetBlockReferences\n _GetTextString\n _MakeExportName\n _Replace\n _SortObjectsByYCord\n _Trim\n blockReferences\n exportName\n handle\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_BlockReference->CSV blockReference)\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Convert a block's attribute data to a single CSV stream, prefixed\n ;; with the name of the block. Ensures raw data contains no embedded\n ;; commas (converts them to cedillas which look like a commas ("¸")\n ;; but won't confuse parsers) as well as removing leading / trailing\n ;; white space.\n ;;\n ;; Assumes caller will provide a valid blockReference.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _BlockReference->CSV ( blockReference / textStrings )\n (if\n (setq textStrings\n (mapcar\n (function\n (lambda (textString)\n (_Trim\n (_Replace "," (chr 184)\n textString\n )\n )\n )\n )\n (mapcar '_GetTextString\n (_GetAttributes blockReference)\n )\n )\n )\n (apply 'strcat\n (cons\n (vlax-get blockReference 'Name)\n (mapcar\n (function\n (lambda (textString)\n (strcat "," textString)\n )\n )\n textStrings\n )\n )\n )\n ""\n )\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_GetAttributes blockReference)\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Find all the attributeObjects for the blockReference. Not error\n ;; coded, call appropriately (like only call with an blockReference).\n ;;\n ;; Return as list of attribute objects.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _GetAttributes ( blockReference / result )\n (vlax-invoke\n blockReference\n 'GetAttributes\n )\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_GetBlockReferences document blockNameSpec )\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Cycle thru the document (can be active document or object dbx\n ;; document) and find all the blocks matching blockNameSpec.\n ;;\n ;; Assumes caller passes legitimate document and block name spec.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _GetBlockReferences ( document blockNameSpec / blockReferences )\n\n (setq blockNameSpec (strcase blockNameSpec))\n\n (mapcar\n (function\n (lambda (space)\n (vlax-for object space\n (if\n (and\n (eq "AcDbBlockReference"\n (vlax-get\n object\n 'ObjectName\n )\n )\n (eq :vlax-true\n (vlax-get-property\n object\n 'HasAttributes\n )\n )\n (wcmatch\n (strcase\n (vlax-get\n object\n 'Name\n )\n )\n blockNameSpec\n )\n )\n (setq blockReferences\n (cons\n object\n blockReferences\n )\n )\n )\n )\n )\n )\n (mapcar\n (function (lambda (space) (vlax-get document space)))\n '(PaperSpace ModelSpace)\n )\n )\n\n blockReferences\n\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_GetTextString attributeReference)\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Get an attribute entity's text string.\n ;;\n ;; Assumes caller will provide valid attribute reference.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _GetTextString ( attributeReference )\n (vlax-get\n attributeReference\n 'TextString\n )\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_MakeExportName)\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Using the document's path and name construct a suitable file name\n ;; for exporting the CSV data.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _MakeExportName ( document / fullName pathName )\n (strcat\n (setq pathName\n (vl-filename-directory\n (setq fullName\n (vlax-get\n document\n (if (vlax-property-available-p document 'FullName)\n 'FullName\n 'Name\n )\n )\n )\n )\n )\n (if (eq 92 (last (vl-string->list pathName))) "" "\s\s")\n (vl-filename-base fullName)\n ".CSV"\n )\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_Replace pattern newString string)\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Assumes caller is smart enough to use properly, i.e. will likely\n ;; bomb (endless loop) if pattern and newString are the same etc. Coded\n ;; to be fast not bullet proof.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _Replace ( pattern newString string / i )\n\n (while\n\n ;; pattern found\n\n (setq i\n (vl-string-search\n pattern\n string\n )\n )\n\n ;; replace it\n\n (setq string\n (vl-string-subst\n newString\n pattern\n string\n i\n )\n )\n\n )\n\n string\n\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_SortBlockReferencesByYCord blockReferences)\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Sort a list of block references by the y cordinate of the insert\n ;; point.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _SortBlockReferencesByYCord ( blockReferences )\n (mapcar 'car\n (vl-sort\n (mapcar\n (function\n (lambda (blockReference)\n (cons blockReference\n (cadr\n (vlax-get\n blockReference\n 'InsertionPoint\n )\n )\n )\n )\n )\n blockReferences\n )\n (function (lambda (a b)(< (cdr a) (cdr b))))\n )\n )\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; local defun (_Trim string)\n ;;\n ;;-----------------------------------------------------------------------\n ;;\n ;; Trim leading / trailing white space.\n ;;\n ;;-----------------------------------------------------------------------\n\n (defun _Trim ( string )\n (vl-string-trim\n " \st\sn\sr"\n string\n )\n )\n\n ;;-----------------------------------------------------------------------\n ;;\n ;; 'Main'\n ;;\n ;;-----------------------------------------------------------------------\n\n (cond\n\n ;; we have data and succesfully opened the export file\n\n ( (and\n\n (setq blockReferences\n (_GetBlockReferences document blockNameSpec)\n )\n\n (setq handle\n (open\n (setq exportName\n (_MakeExportName document)\n )\n "w"\n )\n )\n\n )\n\n ;; iterate the list of block references\n ;; and export the data formatted for CSV\n\n (foreach blockReference\n (if sortByYcordFlag\n (_SortBlockReferencesByYCord blockReferences)\n blockReferences\n )\n (princ\n (strcat\n (_BlockReference->CSV blockReference)\n "\sn"\n )\n handle\n )\n )\n\n (close handle)\n\n ;; we're done\n\n (princ\n (strcat\n "Data written to <"\n exportName\n ">.\sn"\n )\n )\n )\n\n ;; no data to process\n\n ( (null blockReferences)\n\n (princ "Nothing to export.\sn")\n\n )\n\n ;; error opening the export file\n\n ( (and (null handle) exportName)\n\n (princ\n (strcat\n "Could not open <"\n exportName\n "> for output.\sn"\n )\n )\n )\n )\n\n (princ)\n\n)\n}}}
When you tire of command prompting in the graphics area (which I did in about 3 seconds) you change said behavior (dynamic input) here:\n\n[img[http://cadlabs.com/images/cmdpmt.png]]\n\nSaid dialog is available if you type ''dsettings'' at the command prompt.
[[Swamp post.|http://www.theswamp.org/index.php?topic=10028.msg128497#msg128497]]\n\nA good friend of mine wanted an attribute editor that kinda worked like ddedit, that is, it would allow you to select and edit attributes one at a time rather than en masse (like ddatte). Despite written quick and dirty this seems to fullfill that want --\n\n[img[http://cadlabs.com/images/editattrib.gif]]\n\n{{{\n(defun c:EditAttrib ( / _ExeFooAtPoint _Foo _EditAttrib _MakeDCL _Main )\n\n ;;=================================================================\n ;;\n ;; utility function that allows one to execute an arbitrary \n ;; function on a point selected by the user. While the user\n ;; moves the cursor about it will optionally dynamically hilite \n ;; entities that match the hilite match string, e.g. ATTRIBS.\n ;;\n ;;=================================================================\n\n (defun _ExeFooAtPoint ( foo pmt hilite / _Hilite data key value done enames )\n\n ;;=============================================================\n ;; foo is an arbitrary function that takes one argument, a \n ;; point. What is does we care not. It is up to foo to ensure \n ;; it addresses any and all potential errors.\n ;;=============================================================\n ;; pmt is a prompt string\n ;;=============================================================\n ;; hilight is an entity type match string, e.g. "ATTRIB". The \n ;; function will hilite matching entities as it goes.\n ;;=============================================================\n\n (defun _Hilite ( point hilite / ename etype match )\n ;; uses local global enames \n (cond\n ( (setq ename (car (nentselp point)))\n (setq etype (cdr (assoc 0 (entget ename))))\n (cond\n ( (setq match (wcmatch etype hilite))\n (cond\n ( (null (member ename enames))\n (redraw ename 3)\n (setq enames (cons ename enames))\n )\n )\n )\n ( enames\n (foreach ename enames (redraw ename 4))\n (setq enames nil)\n )\n )\n )\n ( enames\n (foreach ename enames (redraw ename 4))\n (setq enames nil)\n )\n )\n )\n\n (setq hilite (strcase hilite))\n\n (princ pmt)\n\n (while (not done)\n ;; stay in the loop until the\n ;; user presses <enter> or <esc>\n (vl-catch-all-apply\n '(lambda ( )\n (setq\n data nil\n data (grread t 13 2)\n )\n )\n )\n (setq\n key (car data)\n value (cadr data)\n )\n (cond\n ;; user pressed <enter> or <esc> exit quietly\n ((member data '(nil (2 13))) (setq done t value nil))\n ;; user hit right mouse button, consider done\n ((eq 25 key)(setq done t value nil))\n ;; user picked a point, let's roll\n ((eq 3 key) (foo value))\n ((eq 5 key) (_Hilite value hilite))\n )\n )\n\n (foreach ename enames (redraw ename 4))\n\n )\n \n ;;=================================================================\n ;;\n ;; utility function used to determine if other functions should be \n ;; invoked; this function will be passed to the _ExeFooAtPoint\n ;; function.\n ;;\n ;;=================================================================\n\n (defun _Foo ( point / ename data )\n (if (setq ename (car (nentselp point)))\n (if (setq data (entget ename))\n (if (eq "ATTRIB" (cdr (assoc 0 data)))\n (_EditAttrib (vlax-ename->vla-object ename))\n (princ "<not an attribute>")\n )\n (princ "<no data for entity>")\n\n )\n (princ "<no entity at point>")\n )\n )\n\n ;;=================================================================\n ;;\n ;; allow the user to edit the attribute value via a dialog\n ;;\n ;;=================================================================\n\n (defun _EditAttrib ( attribObject / _Text _Cancel _Accept text )\n\n ;; note, uses local global dclid\n\n (defun _Text ( value )\n ;; update local global\n (setq text value)\n )\n\n (defun _Cancel ( )\n ;; just bail\n (done_dialog)\n )\n\n (defun _Accept ( )\n ;; uses local glabal text\n (vla-put-textstring\n attribObject\n text\n )\n (done_dialog)\n )\n\n (new_dialog "EdAtt" dclid)\n\n (set_tile "title"\n (strcat "Edit attribute <"\n (vla-get-tagstring attribObject)\n ">"\n )\n )\n\n (set_tile "text"\n (setq text\n (vla-get-textstring attribObject)\n )\n )\n\n (action_tile "text" "(_Text $value)")\n (action_tile "cancel" "(_Cancel)")\n (action_tile "accept" "(_Accept)")\n (start_dialog)\n\n )\n\n ;;=================================================================\n ;;\n ;; create a dcl file on the fly, return the filename to the caller\n ;;\n ;;=================================================================\n\n (defun _MakeDCL ( / fname handle )\n\n (setq\n fname (vl-filename-mktemp "1.dcl")\n handle (open fname "w")\n )\n\n (mapcar '(lambda (x) (write-line x handle))\n '(\n "EdAtt : dialog {"\n " label = \s"Edit Attribute <TagString>\s";"\n " key = \s"title\s";"\n " initial_focus = \s"text\s";"\n " spacer;"\n " : edit_box {"\n " label = \s"Attribute value:\s";"\n " key = \s"text\s";"\n " edit_width = 30;"\n " edit_limit = 2048;"\n " allow_accept = true;"\n " }"\n " spacer;"\n " ok_cancel;"\n " spacer;"\n "}"\n )\n )\n\n (close handle)\n\n fname\n\n )\n\n ;;=================================================================\n ;;\n ;; invoke functions defining the solution\n ;;\n ;;=================================================================\n\n (defun _Main ( / dclname dclid )\n (cond\n ( (setq dclid\n (load_dialog\n (setq dclname (_MakeDCL))\n )\n )\n (_ExeFooAtPoint \n _Foo \n "Pick an attribute <esc|enter to end>: " \n "ATTRIB"\n )\n (unload_dialog dclid)\n (vl-file-delete dclname)\n )\n )\n (princ)\n )\n\n ;;=================================================================\n ;;\n ;; do it\n ;;\n ;;=================================================================\n\n (_Main)\n\n)\n}}}
Excerpt from http://www.tiddlywiki.com/#EmbeddedImages --\n<<<\n{{{\n[img[title|filename]]\n[img[filename]]\n[img[title|filename][link]]\n[img[filename][link]]\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7259.msg89772#msg89772]]\n\n{{{\n(defun Evaluate ( expression / result )\n (setq result\n (vl-catch-all-apply\n '(lambda ( )\n (eval\n (if (eq 'str (type expression))\n (read expression)\n expression\n )\n )\n )\n )\n ) \n result\n)\n}}}\n\nContrived example use --\n\n{{{\n(defun c:Test ( / expression result texteval )\n (setq texteval (getvar "texteval"))\n (setvar "texteval" 0)\n (if \n (vl-catch-all-error-p\n (setq result\n (Evaluate\n (setq expression\n (getstring\n "Enter an expression: "\n t\n )\n ) \n )\n )\n )\n (princ\n (strcat\n "Error: "\n expression\n " => "\n (vl-catch-all-error-message result)\n )\n )\n (princ\n (strcat\n expression\n " => "\n (vl-prin1-to-string result)\n )\n )\n )\n (setvar "texteval" texteval)\n (princ)\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7806.msg99009#msg99009]]\n\nIn the noted swamp post I attempted to illuminate what the ''vl-some'' and ''vl-every'' functions do. Here's the code for [[Every]] --\n\n''Every'' --\n\n{{{\n(defun Every ( foop lst / failed )\n (if (listp foop) (setq foop (eval foop)))\n (vl-catch-all-apply\n '(lambda ( )\n (foreach x lst\n (if (null (foop x))\n (progn\n (setq failed t)\n (exit)\n )\n )\n )\n ) \n )\n (null failed)\n)\n}}}\n\n''Example'' --\n\n{{{\n(Every\n '(lambda (x) (eq 'str (type x)))\n '("a" "b" 42 "d" "e")\n)\n}}}\n\nSee related article -- [[Some]].
From http://www.tiddlywiki.com/#ExtendedFormatting --\n<<<\nLike most wikis, TiddlyWiki supports a range of simplified character formatting:\n| !To get | !Type this |h\n| ''Bold'' | {{{''Bold''}}} |\n| ==Strikethrough== | {{{==Strikethrough==}}} |\n| __Underline__ | {{{__Underline__}}} (that's two underline characters) |\n| //Italic// | {{{//Italic//}}} |\n| Superscript: 2^^3^^=8 | {{{2^^3^^=8}}} |\n| Subscript: a~~ij~~ = -a~~ji~~ | {{{a~~ij~~ = -a~~ji~~}}} |\n| @@highlight@@ | {{{@@highlight@@}}} |\n\nThe highlight can also accept CSS syntax to directly style the text:\n@@color:green;green coloured@@\n@@background-color:#ff0000;color:#ffffff;red coloured@@\n@@text-shadow:black 3px 3px 8px;font-size:18pt;display:block;margin:1em 1em 1em 1em;border:1px solid black;Access any CSS style@@\n//For backwards compatibility, the following highlight syntax is also accepted://\n{{{\n@@bgcolor(#ff0000):color(#ffffff):red coloured@@\n}}}\n@@bgcolor(#ff0000):color(#ffffff):red coloured@@
[[Swamp post.|http://www.theswamp.org/index.php?topic=9184.msg118471#msg118471]]\n\n{{{\n(defun FindFilesInTree ( path spec / result )\n (vl-remove-if 'null\n (mapcar\n '(lambda ( path / result )\n (if (setq result (vl-directory-files path spec 1))\n (cons path result)\n )\n )\n (GetFolders path)\n )\n )\n)\n}}}
What can I say, a great browser. Not perfect but more perfect than Internet Explorer and Opera in my opinion. \n\nFireFox ([[download here|http://www.mozilla.com/firefox]]) correctly renders mono spaced text (used in all code snippettes herein) unlike Internet Explorer ([[details here|http://www.tiddlywiki.com/#InternetExplorer]]) which makes a complete mess of it. \n\n[[Flock]], FireFox's leaner cousin, also renders mono spaced text correctly, though it's still a pre-release (technology review) product.\n\n''Links --''\n<<<\n[[www.mozilla.com/firefox|http://www.mozilla.com/firefox]]\n\n[[http://www.flock.com|http://www.flock.com]]
Flock is a light weight internet browser built using the open source mozilla code base. In incorporates or integrates more seamlessly with services like [[del.icio.us|http://del.icio.us]] and [[flickr|http://www.flickr.com]], [[blogging|http://www.blogger.com]] too. \n\nI like it, but it's not quite there yet for me. Understandable, it's currently just a techno preview release. But I have hopes for it, I like the minimalism of it.\n\nCurious? See [[www.flock.com|http://www.flock.com]].
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4777.msg57473#msg57473]]\n\nGeneral utility function that was spawned form the development of the LayerMods function (if I recall correctly).\n\n{{{\n(defun ForEachObject ( collection predfunc thenfunc elsefunc / func )\n\n ;; trivial code, nonetheless © 2005 Michael Puckett\n ;; you are free to use in your code, just give a nod\n ;; to the author and where you found this ;]\n ;;\n ;; the predicate function must take one parameter, an\n ;; object and return a nil or non nil result\n ;;\n ;; the then function must take one parameter, an object;\n ;; what it actually does is up to the caller. It may\n ;; be nil if the caller wishes to do nothing when the\n ;; predicate function returns a non nil result.\n ;;\n ;; the else function must take one parameter, an object;\n ;; what it actually does is up to the caller. It may\n ;; be nil if the caller wishes to do nothing when the\n ;; predicate function returns a nil result.\n ;;\n ;; no error trapping is done here in the interests of\n ;; svelte programming, the caller is charged with that\n ;; resposibility\n\n ( (lambda ( then else )\n (eval\n (append\n '(defun func (object))\n (cond\n ( (and then else)\n '( (if (predfunc object)\n (thenfunc object)\n (elsefunc object)\n )\n )\n )\n ( then\n '( (if (predfunc object)\n (thenfunc object)\n )\n )\n )\n ( else\n '( (if (null (predfunc object))\n (elsefunc object)\n )\n )\n )\n ( t\n '((predfunc object))\n )\n )\n )\n )\n )\n (eq 'subr (type thenfunc))\n (eq 'subr (type elsefunc))\n )\n\n ;; why all the above crud you may ask yourself\n ;; well ... the above is done only once per\n ;; call, rather than checking the then and else\n ;; functions each iteration thru the collection\n ;; just a wee bit more efficient :]\n\n (vlax-for object collection\n\n (func object)\n\n )\n\n (princ)\n\n)\n}}}
There is currently no ~VisualBASIC or Python code snips herein. Perhaps when I've time; the interest is certainly there.
[[Swamp post.|http://www.theswamp.org/index.php?topic=UPDATEME]]\n\n//Forthcoming.//\n\nSee related article -- GetAttributesDXF.
[[Swamp post.|http://www.theswamp.org/index.php?topic=7412.msg92563#msg92563]]\n\nIn dxf coding group 66 is used to flag whether a block has entites (attributes) that follow, a 0 indicating none, a 1 indicating at least 1.\n\nFor example, in your data --\n\n{{{\n( (-1 . <Entity name: 7dd0a590>)\n (0 . INSERT) \n (330 . <Entity name: 7da62cf8>) \n (5 . 182) \n (100 . AcDbEntity) \n (67 . 1) \n (410 . Layout1) \n (8 . 0)\n (100 . AcDbBlockReference) \n (66 . 1) <== has attributes.\n (2 . A1_SHEET) \n (10 0.0 0.0 0.0) \n (41 . 1.0)\n (42 . 1.0) \n (43 . 1.0) \n (50 . 0.0) \n (70 . 0) \n (71 . 0) \n (44 . 0.0) \n (45 . 0.0) \n (210 0.0 0.0 1.0)\n)\n}}}\n\nBut how do you get them? \n\nBlock instances and attributes (or head polyline entity and vertices) utilize a scheme that is loosely based on linked lists: Have a head item, and if there are associated items, each item points to the next item unitil you reach the last item, which either points to the first item or nothing. And so it is with block inserts and attributes.\n\nExample insert with 3 attributes --\n\n{{{\n(\n (-1 . <Entity name: 7ef60ee8>)\n (0 . "INSERT")\n (330 . <Entity name: 7ef60cf8>)\n (5 . "95")\n (100 . "AcDbEntity")\n (67 . 0)\n (410 . "Model")\n (8 . "0")\n (100 . "AcDbBlockReference")\n (66 . 1) ;; <== has entities that follow\n (2 . "IMPLODE-00000")\n (10 18.1549 14.9443 0.0)\n (41 . 1.0)\n (42 . 1.0)\n (43 . 1.0)\n (50 . 0.0)\n (70 . 0)\n (71 . 0)\n (44 . 0.0)\n (45 . 0.0)\n (210 0.0 0.0 1.0)\n)\n\n(\n (-1 . <Entity name: 7ef60ef0>)\n (0 . "ATTRIB")\n (330 . <Entity name: 7ef60ee8>)\n (5 . "96")\n (100 . "AcDbEntity")\n (67 . 0)\n (410 . "Model")\n (8 . "0")\n (100 . "AcDbText")\n (10 17.3741 14.852 0.0)\n (40 . 0.2)\n (1 . "Default Value")\n (50 . 0.0)\n (41 . 1.0)\n (51 . 0.0)\n (7 . "Standard")\n (71 . 0)\n (72 . 0)\n (11 17.3741 14.952 0.0)\n (210 0.0 0.0 1.0)\n (100 . "AcDbAttribute")\n (2 . "ATTRIB_01")\n (70 . 0)\n (73 . 0)\n (74 . 2)\n)\n\n(\n (-1 . <Entity name: 7ef60ef8>)\n (0 . "ATTRIB")\n (330 . <Entity name: 7ef60ee8>)\n (5 . "97")\n (100 . "AcDbEntity")\n (67 . 0)\n (410 . "Model")\n (8 . "0")\n (100 . "AcDbText")\n (10 17.3741 13.7294 0.0)\n (40 . 0.2)\n (1 . "Default Value")\n (50 . 0.0)\n (41 . 1.0)\n (51 . 0.0)\n (7 . "Standard")\n (71 . 0)\n (72 . 0)\n (11 17.3741 13.8294 0.0)\n (210 0.0 0.0 1.0)\n (100 . "AcDbAttribute")\n (2 . "ATTRIB_02")\n (70 . 0)\n (73 . 0)\n (74 . 2)\n)\n\n(\n (-1 . <Entity name: 7ef60f00>)\n (0 . "ATTRIB")\n (330 . <Entity name: 7ef60ee8>)\n (5 . "98")\n (100 . "AcDbEntity")\n (67 . 0)\n (410 . "Model")\n (8 . "0")\n (100 . "AcDbText")\n (10 17.3741 12.5506 0.0)\n (40 . 0.2)\n (1 . "Default Value")\n (50 . 0.0)\n (41 . 1.0)\n (51 . 0.0)\n (7 . "Standard")\n (71 . 0)\n (72 . 0)\n (11 17.3741 12.6506 0.0)\n (210 0.0 0.0 1.0)\n (100 . "AcDbAttribute")\n (2 . "ATTRIB_03")\n (70 . 0)\n (73 . 0)\n (74 . 2)\n)\n\n(\n (-1 . <Entity name: 7ef60f08>)\n (0 . "SEQEND") ;; <== flags "end of the list"\n (330 . <Entity name: 7ef60ee8>)\n (5 . "99")\n (100 . "AcDbEntity")\n (67 . 0)\n (410 . "Model")\n (8 . "0")\n (-2 . <Entity name: 7ef60ee8>) ;; <== points to the block insert\n)\n}}}\n\nBla, bla, I just want the attributes!\n\nOk, ok. The following function (from article [[Children]]), if passed the ename of a block with attributes (or heavyweight 2d/3d poly w/vertices) will return an ordered list of all the child entity names. From that point you can the perform entgets, entmods etc. to suit.\n\n<<tiddler Children>>\nExample ---\n\n{{{\n(Children (car (entsel))\n}}}\n\nMight return --\n\n{{{\n( <Entity name: 7ef60ef0> \n <Entity name: 7ef60ef8> \n <Entity name: 7ef60f00>\n)\n}}}\n\nLet me know if you want more info.\n\n//Ackkk, it's way to early for a post like this.//\n\nSee related article -- GetAttributesActiveX.
[[Swamp post.|http://www.theswamp.org/index.php?topic=7788.msg99023#msg99023]]\n\n{{{\n(defun GetDimAssocFlag ( dimobj / result )\n (if (eq :vlax-true (vla-get-hasextensiondictionary dimobj))\n (vl-catch-all-apply\n '(lambda ( )\n (setq result\n (cdr\n (assoc 90\n (entget\n (vlax-vla-object->ename\n (vla-getobject\n (vla-getextensiondictionary dimobj)\n "ACAD_DIMASSOC"\n )\n ) \n )\n )\n )\n ) \n )\n )\n )\n result\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=6774.msg83200#msg83200]]\n\n{{{\n(defun GetDwgVersion ( DwgName / Path Handle Header )\n (if (setq Path (FindFile DwgName))\n (cond\n ( (setq Handle (open Path "r"))\n (setq Header (substr (read-line Handle) 1 6))\n (close Handle)\n (cond\n ((eq Header "AC1018") 16)\n ((eq Header "AC1015") 15)\n ((eq Header "AC1014") 14)\n ((eq Header "AC1012") 13)\n ((eq Header "AC1009") 12)\n ((eq Header "AC1006") 10)\n ((eq Header "AC1004") 9)\n ((eq Header "AC1002") 2.6)\n ((eq Header "AC1.50") 2.05)\n (t 0) ; 0 = undeterminable\n )\n )\n )\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=9184.msg118471#msg118471]]\n\n{{{\n(defun GetFolders ( path / _GetFolders _Main )\n\n (defun _GetFolders ( path / folders )\n (defun _GetFolders ( path )\n (cddr\n (vl-directory-files path nil -1)\n )\n )\n (if (vl-position "."\n (setq folders\n (vl-directory-files path nil -1)\n )\n )\n (cddr folders)\n folders\n )\n )\n\n (defun _Main ( path )\n (mapcar\n '(lambda ( folder / temp )\n (cons\n (setq temp (strcat path "\s\s" folder))\n (apply 'append (_Main temp))\n )\n )\n (_GetFolders path)\n )\n )\n\n (apply 'append (_Main path))\n\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=8342.msg106665#msg106665]]\n\n{{{\n(defun GetGroupNames ( ename )\n (mapcar\n '(lambda (x) (vlax-get (vlax-ename->vla-object (cdr x)) 'Name))\n (vl-remove-if-not\n '(lambda (x)\n (and (eq 330 (car x))\n (member '(0 . "GROUP") (entget (cdr x)))\n )\n )\n (entget ename)\n )\n )\n)\n}}}
[[Swamp post|http://www.theswamp.org/index.php?topic=4272.msg51618#msg51618]].\n\n{{{\n(defun FindItemInFile ( PredicateFunction filename / handle item )\n\n ;; © 2005 Michael Puckett\n\n (if\n (and\n (eq 'str (type filename))\n (setq handle (open filename "r"))\n )\n (vl-catch-all-apply\n '(lambda ( / stream )\n (while (setq stream (read-line handle))\n (cond\n ( (PredicateFunction stream)\n (close handle)\n (setq item stream)\n (exit)\n )\n )\n )\n (close handle)\n )\n )\n )\n item\n)\n\n(defun HiddenShellInPgpFile ( / filepath filebackup handle )\n\n ;; © 2005 Michael Puckett\n\n (or\n (FindItemInFile\n (lambda (stream)\n (wcmatch\n (strcase (vl-string-trim " \st\sn" stream))\n "HIDDENSHELL`,`,4`,`*OS COMMAND:`,"\n )\n )\n (setq filepath (findfile "acad.pgp"))\n )\n (and\n filepath\n (setq filebackup (vl-filename-mktemp filepath))\n (vl-file-copy filepath filebackup)\n (setq handle (open filepath "a"))\n (princ "\snHiddenShell,,4,*OS Command:,\sn" handle)\n (null (close handle))\n (setvar "re-init" 16)\n )\n )\n)\n\n(defun HiddenShell ( statement / cmdecho )\n\n ;; © 2005 Michael Puckett\n\n (cond\n (\n (HiddenShellInPgpFile)\n (setq cmdecho (getvar "cmdecho"))\n (setvar "cmdecho" 0)\n (command "HiddenShell" statement)\n (setvar "cmdecho" cmdecho)\n t\n )\n )\n)\n\n(defun GetIPAddress ( / tempfile ipAddressStream ipAddress )\n\n ;; © 2005 Michael Puckett\n\n (if\n (and\n\n (HiddenShell\n (strcat "ipconfig.exe > "\n (setq tempfile\n (vl-filename-mktemp "ipconfig.txt")\n )\n )\n )\n\n (setq ipAddressStream\n (FindItemInFile\n (lambda (stream)\n (wcmatch\n (strcase stream)\n "*IP ADDRESS*"\n )\n )\n tempfile\n )\n )\n\n )\n\n (setq ipAddress\n (vl-string-trim " "\n (vl-list->string\n (cdr\n (member 58\n (vl-string->list ipAddressStream)\n )\n )\n )\n )\n )\n )\n\n (if tempfile (vl-file-delete tempfile)) ;; clean up our mess\n\n ipAddress\n\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4002.0]]\n\nSome things are just easier using dxf codes, like xdata. Do-able using vla-* functions but meh, going that route is just superfluous calisthenics to me.\n\n{{{\n(defun GetLayersFrozenInViewport ( viewportEname )\n ;; © 1999-2005 Michael Puckett\n ( (lambda ( xdata / pair result )\n (while (setq pair (assoc 1003 xdata))\n (setq\n xdata (cdr (member pair xdata))\n result (cons (cdr pair) result)\n )\n )\n )\n (cdadr\n (assoc -3\n (entget\n viewportEname\n '("acad")\n )\n )\n )\n ) \n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=5003.0]]\n\nThis has probably been covered ad nauseum, but a colleague asked if I'd show him how to do this so I penned this for him quick and dirty ...\n\n{{{\n(defun GetOrAddDict ( parentDict dictName )\n\n ;; no error checking in the interests of speed,\n ;; caller responsible for ensuring appropriate \n ;; data is passed\n\n (cond\n ( (cdr\n (assoc -1\n (dictsearch \n parentDict \n dictName\n )\n )\n ) \n )\n ( (dictadd parentDict dictName\n (entmakex\n '( (0 . "DICTIONARY") \n (100 . "AcDbDictionary")\n )\n )\n )\n ) \n )\n)\n}}}\n\n{{{\n(defun AddOrReplaceXrec ( parentDict xrecName xrecData / xrec )\n\n ;; no error checking in the interests of speed,\n ;; caller responsible for ensuring appropriate \n ;; data is passed\n\n (if \n (setq xrec\n (dictsearch\n parentDict\n xrecName\n )\n )\n (entdel \n (cdr \n (assoc -1 xrec)\n )\n )\n )\n \n (dictadd\n parentDict\n xrecName\n (entmakex\n (append \n '( (0 . "XRECORD")\n (100 . "AcDbXrecord")\n )\n xrecData\n )\n )\n )\n)\n}}}\n\nTest drive it --\n\n{{{\n(defun c:test ( / dict1 dict2 xrec1 xrec2 )\n\n ;; dict1 is child of primary dictionary\n\n (setq dict1\n (GetOrAddDict \n (namedobjdict) \n "MyDictionary1"\n )\n )\n \n ;; dict2 is a child of dict1\n \n (setq dict2\n (GetOrAddDict \n dict1\n "MyDictionary2"\n )\n )\n \n ;; add xrec to dict1\n \n (setq xrec1\n (AddOrReplaceXrec\n dict1\n "MyXrecord1"\n '( (1 . "KOOL")\n (10 0.0 0.0 0.0)\n (70 . 42)\n )\n )\n )\n \n ;; add xrec to dict2\n \n (setq xrec2\n (AddOrReplaceXrec\n dict2\n "MyXrecord2"\n '( (1 . "KOOL")\n (10 0.0 0.0 0.0)\n (70 . 42)\n )\n )\n )\n\n ;; show what we made ...\n \n (mapcar\n '(lambda (ename) \n (princ (strcat (chr 40) "\sn"))\n (foreach pair (entget (eval ename))\n (princ " ")\n (princ pair)\n (princ "\sn")\n )\n (princ (strcat (chr 41) "\sn\sn"))\n )\n '(\n dict1\n dict2\n xrec1\n xrec2\n )\n ) \n \n (princ)\n \n)\n}}}\n\nRunning {{{c:Test}}} might produce something like this ...\n\n{{{\n(\n (-1 . <Entity name: 4007ce50>)\n (0 . DICTIONARY)\n (5 . 72)\n (102 . {ACAD_REACTORS)\n (330 . <Entity name: 4007cc60>)\n (102 . })\n (330 . <Entity name: 4007cc60>)\n (100 . AcDbDictionary)\n (280 . 0)\n (281 . 1)\n (3 . MyDictionary2)\n (350 . <Entity name: 4007ce58>)\n (3 . MyXrecord1)\n (350 . <Entity name: 4007ce60>)\n)\n\n(\n (-1 . <Entity name: 4007ce58>)\n (0 . DICTIONARY)\n (5 . 73)\n (102 . {ACAD_REACTORS)\n (330 . <Entity name: 4007ce50>)\n (102 . })\n (330 . <Entity name: 4007ce50>)\n (100 . AcDbDictionary)\n (280 . 0)\n (281 . 1)\n (3 . MyXrecord2)\n (350 . <Entity name: 4007ce68>)\n)\n\n(\n (-1 . <Entity name: 4007ce60>)\n (0 . XRECORD)\n (5 . 74)\n (102 . {ACAD_REACTORS)\n (330 . <Entity name: 4007ce50>)\n (102 . })\n (330 . <Entity name: 4007ce50>)\n (100 . AcDbXrecord)\n (280 . 1)\n (1 . KOOL)\n (10 0.0 0.0 0.0)\n (70 . 42)\n)\n\n(\n (-1 . <Entity name: 4007ce68>)\n (0 . XRECORD)\n (5 . 75)\n (102 . {ACAD_REACTORS)\n (330 . <Entity name: 4007ce58>)\n (102 . })\n (330 . <Entity name: 4007ce58>)\n (100 . AcDbXrecord)\n (280 . 1)\n (1 . KOOL)\n (10 0.0 0.0 0.0)\n (70 . 42)\n)\n}}}\n\nCheers.\n\n<<tiddler Smiley>>
[[Swamp post.\n\nIncluded only for ideas ... I wrote this long ago (like < 1999) and abused it by adding escape code (should be completely rewritten but other stuff demands attention). Anyway, run and and observe the behavior if you wish, this is how I'd expect a function to behave when hitting escape.\n\n{{{\n(defun GetPoints ( / GetPointAux i point result cancelled )\n\n (defun GetPointAux ( from message / result )\n (setq cancelled ;; note, local global\n (vl-catch-all-error-p\n (vl-catch-all-apply\n '(lambda ( )\n (initget 32)\n (setq result\n (if from\n (getpoint from message)\n (getpoint message)\n )\n )\n )\n )\n )\n )\n result\n )\n\n (cond\n\n ( (car\n (setq result\n (list\n (GetPointAux\n nil\n "\snPick start point: "\n )\n )\n )\n )\n\n (while\n (setq point\n (GetPointAux\n (car result)\n "Next point: "\n )\n )\n (grdraw point\n (cadr\n (setq result\n (cons point result)\n )\n )\n -7\n )\n )\n\n (setq i 0)\n\n (while (< i (1- (length result)))\n (grdraw\n (nth i result)\n (nth (setq i (1+ i)) result)\n -7\n )\n )\n \n (if (null cancelled) ;; the local global\n (reverse result)\n ) \n )\n )\n)\n}}}\n\n
[[Swamp post.|http://www.theswamp.org/index.php?topic=8163.msg104627#msg104627]]\n\n{{{\n(defun GetVlaAtoms ( )\n (vl-remove-if-not\n '(lambda (symbol) \n (wcmatch\n (vl-symbol-name symbol)\n "vla-*"\n )\n )\n (atoms-family 0)\n )\n)\n}}}\n\nSee GetVlaMethods and GetVlaProperties.
[[Swamp post.|http://www.theswamp.org/index.php?topic=8163.msg104627#msg104627]]\n\n{{{\n(defun GetVlaMethods ( atoms )\n (vl-sort\n (mapcar\n '(lambda (symbolname) (substr symbolname 5))\n (vl-remove-if\n '(lambda (symbolname) \n (wcmatch\n symbolname\n "vla-get-*,vla-put-*" ;; need 'put'\n )\n )\n (mapcar 'vl-symbol-name atoms)\n )\n ) \n '<\n ) \n)\n}}}\n\nSee GetVlaAtoms and GetVlaProperties.
[[Swamp post.|http://www.theswamp.org/index.php?topic=8163.msg104627#msg104627]]\n\n{{{\n(defun GetVlaProperties ( atoms )\n (vl-sort\n (mapcar\n '(lambda (symbolname) (substr symbolname 9))\n (vl-remove-if-not\n '(lambda (symbolname) \n (wcmatch\n symbolname\n "vla-get-*" ;; don't need 'put'\n )\n )\n (mapcar 'vl-symbol-name atoms)\n )\n )\n '<\n ) \n)\n}}}\n\nSee GetVlaAtoms and GetVlaMethods.
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=6318.0]]\n\nRetrieve a block's (or xref's) xclip entity. If you want the actual coordinates (and xclip type; rectangular etc.) examine the data that resides in the entity's dxf group codes (10, 40 and 70). \n\nSee the [[DXF Reference|http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=5129239]]: Objects Section, Object Section Group Codes, ~SPATIAL_FILTER.\n\n{{{\n(defun GetXclip ( ename / result )\n\n (vl-catch-all-apply\n '(lambda ( / object )\n (if\n (and\n (eq "INSERT"\n (cdr\n (assoc 0\n (entget ename)\n )\n )\n )\n (eq :vlax-true\n (vla-get-HasExtensionDictionary\n (setq object\n (vlax-ename->vla-object ename)\n )\n )\n )\n )\n (setq result\n (entget\n (vlax-vla-object->ename\n (vla-item\n (vla-item\n (vla-getExtensiondictionary object)\n "ACAD_FILTER"\n )\n "SPATIAL"\n )\n )\n )\n )\n )\n )\n )\n\n result\n\n)\n}}}\n\nTypical dump --\n\n{{{\n( (-1 . <Entity name: 7ef53ea8>)\n (0 . "SPATIAL_FILTER")\n (5 . "7D")\n (102 . "{ACAD_REACTORS")\n (330 . <Entity name: 7ef53ea0>)\n (102 . "}")\n (330 . <Entity name: 7ef53ea0>)\n (100 . "AcDbFilter")\n (100 . "AcDbSpatialFilter")\n (70 . 2)\n (10 478.279 86.9639 0.0)\n (10 572.352 143.553 0.0)\n (210 0.0 0.0 1.0)\n (11 0.0 0.0 0.0)\n (71 . 1)\n (72 . 0)\n (73 . 0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . -537.387)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . -113.594)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n)\n}}}\n\nYou can then use vl-remove / remove-if-not to selectively retrieve data from the list.\n\nExample 1, pull out the boundary's coordinates (key 10):\n\n{{{\n(vl-remove-if-not\n '(lambda (pair) (eq 10 (car pair)))\n (GetXclip (car (entsel)))\n)\n}}}\n\n=>\n\n{{{\n(\n (10 478.279 86.9639 0.0)\n (10 572.352 143.553 0.0)\n)\n}}}\n\nExample 2, pull out the transformation matrix data (key 40):\n\n{{{\n(vl-remove-if-not\n '(lambda (pair) (eq 40 (car pair)))\n (GetXclip (car (entsel)))\n)\n}}}\n\n=>\n\n{{{\n(\n (40 . 1.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . -537.387)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . -113.594)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 0.0)\n (40 . 1.0)\n (40 . 0.0)\n)\n}}}\n\nExample 3, is the xclip active?\n\n{{{\n(eq 1 (cdr (assoc 71 (GetXclip (car (entsel))))))\n}}}\n\nEtc.\n\nAs mentioned above, please see the [[DXF Reference|http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=5129239]]: Objects Section, Object Section Group Codes, ~SPATIAL_FILTER for additional information.\n\nCheers.
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=9120.0]]\n\nIn a [[visual basic thread|http://www.theswamp.org/index.php?topic=9106.msg117168#msg117168]] there's a discussion regarding grabbing the attach state (overlay / attach). Quite frankly it's a pain using the object model, at least based on my investigations many years ago.\n\nHere's how I do it in lisp for documents opened via ~ObjectDBX (not for the active documents collection et al, see brief comment in the function declaration). Sorry, it's not overlay documented, and well, I'm playing the "I don't have time card".\n\nAn aside, I made loose reference to the function below (part of a large app I wrote for one of my clients called 'Carnivore') in [[this conversation|http://www.theswamp.org/index.php?topic=3083.msg38439#msg38439]] with Mr. Madsen many moons ago, you may find it interesting; or not.\n\nFWIW ... Cheers.\n\n{{{\n(defun GetXrefsAttachState ( AxDbDocument / _Put _IncHex _Main )\n\n ;; GetXrefsAttachState\n ;;\n ;; Use to get the attach / overlay state from ObjectDBX\n ;; documents. While you can use on 'normal' documents, i.e.\n ;; like the active document, that would be dumb (use\n ;; traditional dxf methods instead).\n ;;\n ;; typical call and results\n ;;\n ;; (GetXrefsAttachState ValidAxDbDocument)\n ;;\n ;; ( \n ;; ("Drawing1" "Attach" 1)\n ;; ("Drawing2" "Overlay" 1)\n ;; ("Drawing3" "Overlay" 2)\n ;; )\n ;;\n ;; The number indicates the xref instances found\n\n (defun _Put ( item position lst )\n ( (lambda ( i ) \n (mapcar\n '(lambda ( x )\n (if (eq position (setq i (1+ i)))\n item\n x\n )\n )\n lst\n )\n )\n -1\n ) \n )\n\n (defun _IncHex ( hex )\n \n ( (lambda ( lst i / j a b )\n\n (while (setq a (nth (setq i (1+ i)) lst))\n (cond\n ( (< 70 a) ; "G" and greater\n (setq lst\n (if (setq b (nth (setq j (1+ i)) lst))\n (_Put (1+ b) j (_Put 48 i lst))\n (append (_Put 48 i lst) (list 49))\n )\n )\n )\n ( (eq 58 a) ; ":"\n (setq lst (_Put 65 i lst)) ; replace w/"A"\n )\n )\n )\n\n (vl-list->string (reverse lst))\n \n )\n\n (cons\n (1+\n (car\n (setq lst\n (reverse\n (vl-string->list\n (strcase hex)\n )\n )\n )\n )\n )\n (cdr lst)\n )\n\n -1\n )\n \n ) \n\n (defun _Main ( AxDbDocument / Object Ename Data Result )\n \n (vlax-for Block\n\n (vlax-get-property\n AxDbDocument\n 'Blocks\n )\n\n (cond\n\n ( (and\n\n (eq :vlax-true\n (vlax-get-property\n Block\n 'IsXref\n )\n )\n\n (null\n (vl-catch-all-error-p\n (setq Object\n (vl-catch-all-apply\n 'vlax-invoke-method\n (list\n AxDbDocument\n 'HandleToObject\n (_IncHex\n (vlax-get-property\n Block\n 'Handle\n )\n )\n )\n )\n )\n )\n )\n\n (null\n (vl-catch-all-error-p\n (setq Ename\n (vl-catch-all-apply\n 'vlax-vla-object->ename\n (list Object)\n )\n )\n )\n )\n\n (null\n (vl-catch-all-error-p\n (setq Data\n (vl-catch-all-apply\n 'entget\n (list Ename)\n )\n )\n )\n )\n (eq "BLOCK" (cdr (assoc 0 Data)))\n ;; If you want this is where'd you'd\n ;; add additional properties like the\n ;; xref path, flag values ad nauseum.\n )\n\n (setq Result\n (cons\n (list\n (cdr (assoc 2 Data))\n (if (eq 8 (logand 8 (cdr (assoc 70 Data))))\n "Overlay"\n "Attach"\n )\n (length\n (vl-remove-if-not\n '(lambda (x) (eq 331 (car x)))\n (entget (vlax-vla-object->ename Block))\n )\n )\n\n )\n Result\n )\n )\n )\n )\n )\n\n Result\n\n )\n \n (_Main AxDbDocument)\n \n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=3816.0]]\n\nRetrieve various properties (name, path, flags ...) for all xrefs that are a child of the document argument (which may be an ~ObjectDBX document).\n\n{{{\n(defun GetXrefsProperties\n\n ;;=================================================================\n ;;\n ;; GetXrefsProperties.lsp\n ;;\n ;; Copyright © 2004-2005 Michael Puckett | All Rights Reserved\n ;;\n ;;=================================================================\n ;;\n ;; Syntax:\n ;;\n ;; (GetXrefsProperties document)\n ;;\n ;; Where document is a document open in the current AutoCAD\n ;; session (including ones opened via ObjectDBX).\n ;;\n ;;=================================================================\n ;;\n ;; Result:\n ;;\n ;; (\n ;; ("Name1" "Path1" Flags1 Count1)\n ;; ("Name2" "Path2" Flags2 Count2)\n ;; ...\n ;; ("NameX" "PathX" FlagsX CountX)\n ;;\n ;; )\n ;;\n ;; Flags is the bitcoded value associated w/dxf group 70 for\n ;; block table entries.\n ;;\n ;; Count is the actual xref instance count in the doc.\n ;; Normally it is 1. Values greater than 1 suggest you may\n ;; have a CADD Bozo who inadvertantly copied an XREF during\n ;; a copy sequence, whereas a instance count of 0 suggests\n ;; said quack deleted the xref during an erase sequence.\n ;;\n ;;=================================================================\n ;;\n ;; Example:\n ;;\n ;; (GetXrefsProperties\n ;; (vlax-get-property\n ;; (vlax-get-acad-object)\n ;; 'ActiveDocument\n ;; )\n ;; )\n ;;\n ;; Result:\n ;;\n ;; (\n ;; ("A" "X:\s\sA.DWG" 44 1)\n ;; ("B" "X:\s\sB.DWG" 44 1)\n ;; ("C" "X:\s\sC.DWG" 44 1)\n ;;\n ;; )\n ;;\n ;; "A" = XREF name in AutoCAD.\n ;; "X:\s\sA.DWG" = Full path to XREF file.\n ;; 44 = flags (see below).\n ; 1 = number of instances found.\n ;;\n ;; Excerpt from DXF Reference for blocks, group 70:\n ;;\n ;; 4 = XREF.\n ;; 8 = Overlay.\n ;; 32 = Resolved (will never be resolved in ObjectDBX).\n ;; ----------------------------------------------------\n ;; 44\n ;;\n ;;=================================================================\n ;;\n ;; Note:\n ;;\n ;; Before you ask me to add each xref's file size, date etc.\n ;; let me tell you I have no intention of doing that as it's\n ;; very inefficient to repeatedly request this info from the\n ;; system. Example: I have 1000 production drawings. Say each\n ;; of these production drawings references the same 10 models.\n ;; Now say I have written a utility to open each of the\n ;; production drawings via ObjectDBX and report on them,\n ;; including their xref info. If GetXrefsProperties reported\n ;; the file size, date, time every time it was invoked the\n ;; system would be prodded 10000 times for file info instead\n ;; of a more modest 10 times.\n ;;\n ;; A better strategy would be to construct a master list of\n ;; drawing info that builds as you progress through the list\n ;; of drawings being processed. Example, if the reference file\n ;; I'm interested in (using full path as a key) exists in my\n ;; master file info list use the data associated with that\n ;; key, otherwise poll the system for that info and add said\n ;; info into my master list. If the system did not return\n ;; info for said file (e.g. not found) make sure you add that\n ;; key to the master list with either a null association or\n ;; some indiction that the info is N/A, like '("N/A" "N/A")\n ;; lest the application continue poll the system for a file\n ;; known to be unavailable.\n ;;\n ;; For example, a master file info list, say global variable\n ;; *fileData* might look something like this:\n ;;\n ;; (\n ;; ("X:\s\sA.DWG" 371917 "2004/03/26" "10:26:58")\n ;; ("X:\s\sB.DWG") ;; file not found\n ;; ("X:\s\sC.DWG" 112872 "2004/03/26" "21:26:21")\n ;; )\n ;;\n ;; A companion function to manage and utilize *fileData* might\n ;; look something like this:\n ;;\n ;; (defun GetFileData ( path / data foo i )\n ;; (cond\n ;; ( (setq data\n ;; (assoc\n ;; (progn\n ;; (while\n ;; (setq i (vl-string-search "/" path))\n ;; (setq path\n ;; (vl-string-subst "\s\s" "/" path i)\n ;; )\n ;; )\n ;; (setq path (strcase path))\n ;; )\n ;; *fileData*\n ;; )\n ;; )\n ;; (cdr data)\n ;; )\n ;; ( (setq data (vl-file-systime path))\n ;; (defun foo ( keys lst divider )\n ;; (apply 'strcat\n ;; (mapcar\n ;; '(lambda (n / i)\n ;; (if (setq i (nth n lst))\n ;; (itoa i)\n ;; divider\n ;; )\n ;; )\n ;; keys\n ;; )\n ;; )\n ;; )\n ;; (setq *fileData*\n ;; (cons\n ;; (cons\n ;; path\n ;; (list\n ;; (vl-file-size path)\n ;; (foo '(0 99 1 99 3) data "/")\n ;; (foo '(4 99 5 99 6) data ":")\n ;; )\n ;; )\n ;; *fileData*\n ;; )\n ;; )\n ;; (GetFileData path)\n ;; )\n ;; ( (setq *fileData*\n ;; (cons (list path)\n ;; *fileData*\n ;; )\n ;; )\n ;; nil\n ;; )\n ;; )\n ;; )\n ;;\n ;; You could then branch accordingly:\n ;;\n ;; (if (setq fileData (GetFileData SomeFilePath))\n ;; (FileDataWasFound)\n ;; (NoFileDataFound)\n ;; )\n ;;\n ;; TIP: Normalizing the keys to all uppercase and all backslashes\n ;; will prevent multiple keys for the same file data.\n ;;\n ;; Marrying the data from GetXrefsProperties and GetFileData is then\n ;; a trivial exercise:\n ;;\n ;; (mapcar\n ;; '(lambda ( xrefProperties )\n ;; (append\n ;; xrefProperties\n ;; (GetFileData (cadr xrefProperties))\n ;; )\n ;; )\n ;; (GetXrefsProperties\n ;; (vlax-get-property\n ;; (vlax-get-acad-object)\n ;; 'ActiveDocument\n ;; )\n ;; )\n ;; )\n ;;\n ;; Example:\n ;;\n ;; (\n ;; ("A" "X:\s\sA.DWG" 44 1 371917 "2004/03/26" "10:26:58")\n ;; ("B" "X:\s\sB.DWG" 44 1) ;; remember, file not found\n ;; ("C" "X:\s\sC.DWG" 44 1 112872 "2004/03/26" "21:26:21")\n ;;\n ;; )\n ;;\n ;; But don't let me take all of the fun out of it for you :p\n ;;\n ;;=================================================================\n ;;\n ;; Thank you for keeping this commented header fully intact.\n ;;\n ;;=================================================================\n\n ( document\n\n /\n\n _NormalizePath\n _GetBlockTableData\n _GetKeyCount\n _SummarizeXrefData\n _Main\n\n )\n\n ;;=================================================================\n ;;\n ;; _NormalizePath ( path )\n ;;\n ;;=================================================================\n\n (defun _NormalizePath ( path / i )\n (while (setq i (vl-string-search "/" path))\n (setq path (vl-string-subst "\s\s" "/" path i))\n )\n (strcase path)\n )\n\n ;;=================================================================\n ;;\n ;; _GetBlockTableData ( blockRecordData )\n ;;\n ;;=================================================================\n\n (defun _GetBlockTableData ( blockRecordData / data blockTableData )\n (vl-catch-all-apply\n (function\n (lambda ()\n (foreach pair (reverse blockRecordData)\n (cond\n ( (and\n (eq 360 (car pair))\n (setq data (entget (cdr pair)))\n (eq "BLOCK" (cdr (assoc 0 data)))\n )\n (setq blockTableData data)\n (exit)\n )\n )\n )\n )\n )\n )\n blockTableData\n )\n\n ;;=================================================================\n ;;\n ;; _GetKeyCount ( key lst )\n ;;\n ;;=================================================================\n\n (defun _GetKeyCount ( key lst / count )\n (setq count 0)\n (while (setq lst (member (assoc key lst) lst))\n (setq\n lst (cdr lst)\n count (1+ count)\n )\n )\n count\n )\n\n ;;=================================================================\n ;;\n ;; _SummarizeXrefData ( blockRecordData blockTableData )\n ;;\n ;;=================================================================\n\n (defun _SummarizeXrefData ( blockRecordData blockTableData )\n (append\n (list\n (cdr (assoc 2 blockTableData))\n (_NormalizePath (cdr (assoc 1 blockTableData)))\n (cdr (assoc 70 blockTableData))\n (_GetKeyCount 331 blockRecordData)\n )\n )\n )\n\n ;;=================================================================\n ;;\n ;; _Main ( document )\n ;;\n ;;=================================================================\n\n (defun _Main ( document / XrefsProperties blockRecordData )\n\n (vlax-for block (vlax-get-property document 'Blocks)\n\n (if\n\n (eq :vlax-true\n (vlax-get-property\n block\n 'IsXref\n )\n )\n\n (setq XrefsProperties\n (cons\n (_SummarizeXrefData\n (setq blockRecordData\n (entget\n (vlax-vla-object->ename\n block\n )\n )\n )\n (_GetBlockTableData blockRecordData)\n )\n XrefsProperties\n )\n )\n )\n )\n\n ;;\n ;; return the result sorted nice\n ;;\n\n (vl-sort\n XrefsProperties\n (function (lambda (a b) (< (car a) (car b))))\n )\n )\n\n ;;=================================================================\n ;;\n ;; ok, let's rock and roll ...\n ;;\n ;;=================================================================\n\n (_Main document)\n\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4041.0]]\n\nGiven the discussion [[here|http://theswamp.org/phpBB2/viewtopic.php?t=4025]] (hmmm, thread has gone 404), I thought "How might I write a simplistic 'globals manager' for values to be retained between function calls within an ~AutoCAD session", i.e. not between ~AutoCAD sessions? A little utility could be written to manage globals by keeping them all in a simple structured list - that is - global. The latter (session to session variable retension) would probably be best in a dictionary or some other permanent data storage mechanism.\n\nThe question looms -- "Couldn't I just use a global like *textheight* to store the global value for my application?" The answer is "Absolutely", but what fun is that for me?\n\nAnyway ...\n\n3 basic functions, naming should spell out the functionality --\n*(''~PutGlobal'' funcName symName symValue)\n*(''~GetGlobal'' funcName symName defaultValue)\n*(''~ClearAllGlobals'')\nLet's say I've written a utility to do some kind of annotating, and I want to have a global for the text height (simplistic example) --\n\n{{{\n(defun c:MyNotes ( / textHeight )\n\n ;; get the text height for this\n ;; app from the global manager\n\n (setq textHeight\n (GetGlobal\n 'c:mynotes ;; funcName\n 'textheight ;; symName\n (/ 3 32.0) ;; defaultValue\n )\n )\n \n ;; do great stuff, which may\n ;; include prompting the user\n ;; for atext height etc (not the\n ;; focus for me here)\n \n (DoGreatStuff)\n \n ;; ok, save the text height we\n ;; used to our global heap before\n ;; we exit this application\n \n (PutGlobal\n 'c:mynotes ;; funcName\n 'textheight ;; symName\n textHeight ;; symValue\n ) \n \n (princ)\n \n)\n}}}\n\n{{{\n(defun GetGlobal ( funcName symName defaultValue / result )\n\n ;;=================================================================\n ;;\n ;; GetGlobal | © 2005 Michael Puckett | All Rights Reserved\n ;;\n ;;=================================================================\n ;;\n ;; Purpose:\n ;;\n ;; Provide a simple mechanism to retrieve the value for the\n ;; symName associated with the funcName in global variable\n ;; *globals*. If there is no such entry return the default\n ;; value.\n ;;\n ;; This is useful where per session values need to be saved\n ;; / restored between function calls. Read "not useful where\n ;; session to session values need to be saved / restored. For\n ;; the latter it would probably be best to use a dictionary.\n ;;\n ;; Syntax:\n ;;\n ;; (GetGlobal funcName symName defaultValue)\n ;;\n ;; Example:\n ;;\n ;; (GetGlobal 'c:MyApp 'rotation (* 2 pi))\n ;;\n ;; Notes:\n ;;\n ;; You can use strings for funcName and symName but then\n ;; there are case issues: "c:myapp" "C:MyApp' and "C:MYAPP"\n ;; are 3 distinct entries. Better to use symbols instead,\n ;; per the example.\n ;;\n ;; If you use this code in your applications you may wish\n ;; to use your own unique name for the global variable\n ;; *globals*.\n ;;\n ;; If you are wide awake the flaw in this utility is that\n ;; you cannot have a global value saved with a null value.\n ;; Well you can, it just would never be retrieved, the\n ;; default value would always be returned instead. Serious\n ;; question -- do you see this as a need?\n ;;\n ;;=================================================================\n\n (if\n (setq result\n (cdr\n (assoc symName\n (cdr\n (assoc funcName *globals*)\n )\n )\n )\n )\n result\n defaultValue\n )\n)\n}}}\n\n{{{\n(defun ClearAllGlobals ( )\n\n ;;=================================================================\n ;;\n ;; ClearAllGlobals | © 2005 Michael Puckett | All Rights Reserved\n ;;\n ;;=================================================================\n ;;\n ;; Purpose:\n ;;\n ;; Set the global variable used by GetGlobal and PutGlobal\n ;; to nil. I know, you're thinking "why bother with a\n ;; wrapper when you could just execute (setq *globals* nil)\n ;; right from your code"? Well, IMO your code should not\n ;; know the implementation details of the Get/Put global\n ;; functions. It should not know that the data is stored in\n ;; the variable *globals*. For one thing it could very likely\n ;; change - should you have to update your code in umpteen\n ;; hundred locations? While this all may seem overkill, in my\n ;; opinion it is better form to go this route. Finally, down\n ;; the road additional functionality might be added to this\n ;; little suite of utilities, who knows, maybe it would use\n ;; an entirely different mechanism for storing the data.\n ;;\n ;; Syntax:\n ;;\n ;; (ClearAllGlobals)\n ;;\n ;;=================================================================\n\n (setq *globals* nil)\n\n (princ)\n\n)\n}}}\n\n{{{\n(defun PutGlobal ( funcName symName symValue / funcSet funcData symPair )\n\n ;;=================================================================\n ;;\n ;; PutGlobal | © 2005 Michael Puckett | All Rights Reserved\n ;;\n ;;=================================================================\n ;;\n ;; Purpose:\n ;;\n ;; Provide a simple mechanism to manage the data hosted by\n ;; a global container variable *globals*. Replace the value\n ;; for the symName associated with the funcName in variable\n ;; *globals*. Return the previous value that had been stored.\n ;; This allows you to toggle values if you wish. If there is\n ;; no such entry in the *globals* variable add an entry and\n ;; return nil.\n ;;\n ;; This is useful where per session values need to be saved\n ;; / restored between function calls. Read "not useful where\n ;; session to session values need to be saved / restored. For\n ;; the latter it would probably be best to use a dictionary.\n ;;\n ;; Syntax:\n ;;\n ;; (PutGlobal funcName symName value)\n ;;\n ;; Example:\n ;;\n ;; (GetGlobal 'c:MyApp 'rotation (* 2 pi))\n ;;\n ;; Notes:\n ;;\n ;; You can use strings for funcName and symName but then\n ;; there are case issues: "c:myapp" "C:MyApp' and "C:MYAPP"\n ;; are 3 distinct entries. Better to use symbols instead,\n ;; per the example.\n ;;\n ;; If you use this code in your applications you may wish\n ;; to use your own unique name for the global variable\n ;; *globals*.\n ;;\n ;; Data Structure of *globals*:\n ;;\n ;; (\n ;; (APP1\n ;; (VAR1 . VALUE1)\n ;; (VAR2 . VALUE2)\n ;; ...\n ;; (VARn . VALUEn)\n ;; )\n ;; (APP2\n ;; (VAR1 . VALUE1)\n ;; (VAR2 . VALUE2)\n ;; ...\n ;; (VARn . VALUEn)\n ;; )\n ;; ...\n ;; (APPn\n ;; (VAR1 . VALUE1)\n ;; (VAR2 . VALUE2)\n ;; ...\n ;; (VARn . VALUEn)\n ;; )\n ;; )\n ;;\n ;; For example:\n ;;\n ;; (progn\n ;;\n ;; (ClearGlobals)\n ;;\n ;; (PutGlobal 'test2 'z 6)\n ;; (PutGlobal 'test2 'y 5)\n ;; (PutGlobal 'test2 'x 4)\n ;;\n ;; (PutGlobal 'test1 'z 3)\n ;; (PutGlobal 'test1 'y 2)\n ;; (PutGlobal 'test1 'x 1)\n ;;\n ;; )\n ;;\n ;; !*global*\n ;;\n ;; ( (TEST1\n ;; (X . 1)\n ;; (Y . 2)\n ;; (Z . 3)\n ;; )\n ;; (TEST2\n ;; (X . 4)\n ;; (Y . 5)\n ;; (Z . 6)\n ;; )\n ;; )\n ;;\n ;;=================================================================\n\n (setq *globals*\n (if\n (setq funcSet\n (assoc\n funcName\n *globals*\n )\n )\n (if\n (setq symPair\n (assoc symName\n (setq funcData\n (cdr funcSet)\n )\n )\n )\n (subst\n (cons funcName\n (subst\n (cons symName symValue)\n symPair\n funcData\n )\n )\n funcSet\n *globals*\n )\n (subst\n (cons funcName\n (cons\n (cons symName symValue)\n funcData\n )\n )\n funcSet\n *globals*\n )\n )\n (cons\n (cons funcName\n (list\n (cons symName symValue)\n )\n )\n *globals*\n )\n )\n )\n (cdr symPair)\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=7089.0]]\n\nThis function was basically in response to a challenge that such a thing couldn't be done, as is its companion, GrVectorsGetPointScaled. Not really practical for real world use, like prompting a user for a block insert point as (in current incarnation) object snaps etc. are not available. Nontheless, it was fun to pen.\n\n{{{\n(defun GrVectorsGetPoint ( vectors / *error* _drawVectors end result key val val2 )\n\n ;;=====================================================\n ;;\n ;; COPYRIGHT © 2005 MICHAEL PUCKETT\n ;;\n ;; You may not (re)distribute this program however\n ;; trivial it may be in whole or in part in any\n ;; electronic or printed form and may not post it to\n ;; forums or news groups without the author's prior\n ;; written consent.\n ;;\n ;;=====================================================\n\n ;; clean up the screen if\n ;; the user bails via esc\n\n (defun *error* ( x )\n (redraw)\n (princ)\n )\n\n ;; draw the vectors relative to the\n ;; specifiedd point using xor ink\n\n (defun _drawVectors ( vectors point )\n (foreach vector\n (mapcar\n '(lambda (vector)\n (mapcar\n '(lambda (point2)\n (mapcar '+ point point2)\n )\n vector\n )\n )\n vectors\n )\n (grdraw\n (car vector)\n (cadr vector)\n -1\n )\n )\n )\n\n ;; while the user cursors about dynamically redraw\n ;; the vectors. When the user finally picks a point\n ;; clear off the vectors and return the point picked.\n ;; I've not written this to handle wonky ucs's etc,\n ;; that's your job. :P\n\n (while (not end)\n (setq\n result (grread t 1 0)\n key (car result)\n val (cadr result)\n )\n (cond\n ( (eq 5 key)\n (cond\n ( (null val2)\n (setq val2 val)\n (_drawVectors vectors val)\n )\n ( t\n (redraw)\n (_drawVectors vectors val)\n (setq val2 val)\n )\n )\n )\n ( (eq 3 key) (setq end t))\n )\n )\n\n ;; clear the screen of any crap we\n ;; drew that remains\n\n (redraw)\n\n ;; return the selected point (if the\n ;; user picked one) to the caller\n\n (if (eq 3 key) val)\n\n)\n}}}\n\nTest drive --\n\n{{{\n(defun c:Test ( / _ScalePoint _ScaleVector _ScaleVectors )\n\n ;; some functions that might be re-useable ...\n\n (defun _ScalePoint ( point scale )\n (mapcar\n '(lambda (coordinate) (* scale coordinate))\n point\n )\n )\n\n (defun _ScaleVector ( vector scale )\n (mapcar\n '(lambda (point) (_ScalePoint point scale))\n vector\n )\n )\n\n (defun _ScaleVectors ( vectors scale )\n (mapcar\n '(lambda (vector) (_ScaleVector vector scale))\n vectors\n )\n )\n\n ;; for this exercise let's make the graphic\n ;; size relative to the screen height ...\n\n (GrVectorsGetPoint\n (_ScaleVectors\n '(\n ((0.38343 -0.04221) (0.40412 -0.06254))\n ((0.40412 -0.06254) (0.44438 -0.06254))\n ((0.46507 -0.04221) (0.44438 -0.06254))\n ((0.38343 0.03861) (0.46507 -0.04221))\n ((0.38343 0.03861) (0.40412 0.05894))\n ((0.40412 0.05894) (0.44438 0.05894))\n ((0.46507 0.03861) (0.44438 0.05894))\n ((0.28222 -0.0018) (0.34243 -0.06254))\n ((0.26224 -0.0018) (0.28222 -0.0018))\n ((0.28222 -0.0018) (0.34243 0.05894))\n ((0.26224 -0.06254) (0.26224 0.05894))\n ((0.20235 0.05894) (0.21917 0.03963))\n ((0.16135 0.05894) (0.20235 0.05894))\n ((0.16135 0.05894) (0.14453 0.03963))\n ((0.14453 0.03963) (0.14453 -0.04323))\n ((0.16135 -0.06254) (0.14453 -0.04323))\n ((0.16135 -0.06254) (0.20235 -0.06254))\n ((0.20235 -0.06254) (0.21917 -0.04323))\n ((0.01783 -0.06254) (0.0993 -0.06254))\n ((0.0993 -0.06254) (0.0993 0.05894))\n ((0.01783 0.05894) (0.0993 0.05894))\n ((0.01783 -0.06254) (0.01783 0.05894))\n ((-0.08276 -0.00297) (-0.02284 -0.06254))\n ((-0.10254 -0.00297) (-0.04152 -0.00297))\n ((-0.04152 -0.00297) (-0.0218 0.01813))\n ((-0.0218 0.03783) (-0.0218 0.01813))\n ((-0.04152 0.05894) (-0.0218 0.03783))\n ((-0.10254 0.05894) (-0.04152 0.05894))\n ((-0.10254 -0.06254) (-0.10254 0.05894))\n ((-0.34783 -0.00297) (-0.28681 -0.00297))\n ((-0.28681 -0.00297) (-0.2671 0.01813))\n ((-0.2671 0.03783) (-0.2671 0.01813))\n ((-0.28681 0.05894) (-0.2671 0.03783))\n ((-0.34783 0.05894) (-0.28681 0.05894))\n ((-0.34783 -0.06254) (-0.34783 0.05894))\n ((-0.38914 -0.06254) (-0.38914 0.05894))\n ((-0.38914 0.05894) (-0.4295 -0.02126))\n ((-0.46987 0.05894) (-0.4295 -0.02126))\n ((-0.46987 -0.06254) (-0.46987 0.05894))\n ((0.5 -0.09292) (-0.5 -0.09292))\n ((0.5 0.09292) (0.5 -0.09292))\n ((-0.5 0.09292) (0.5 0.09292))\n ((-0.5 -0.09292) (-0.5 0.09292))\n )\n (getvar "viewsize")\n )\n )\n\n ;; no final princ so you can see the coordinate returned\n\n)\n}}}\n\nEnjoy.\n\n:)
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=7247.0]]\n\nThis function was basically in response to a challenge that such a thing couldn't be done, as is its companion, GrVectorsGetPoint. Not really practical for real world use, like prompting a user for a block insert point as (in current incarnation) object snaps etc. are not available. Nontheless, it was fun to pen.\n\n{{{\n(defun GrVectorsGetPointScaled\n\n ;;=====================================================\n ;;\n ;; COPYRIGHT © 2005 MICHAEL PUCKETT\n ;;\n ;; You may not (re)distribute this program however\n ;; trivial it may be in whole or in part in any\n ;; electronic or printed form and may not post it to\n ;; forums or news groups without the author's prior\n ;; written consent.\n ;;\n ;;=====================================================\n\n ( vectors\n scalefactor ;; relative to viewsize, eg 0.05 would be 5%\n /\n *error*\n _ScalePoint\n _ScaleVector\n _ScaleVectors\n _drawVectors \n deltay\n scalefactor2\n end\n result\n key\n val\n val2\n )\n\n ;; clean up the screen if\n ;; the user bails via esc \n\n (defun *error* ( x )\n (redraw)\n (princ)\n )\n \n (defun _ScalePoint ( point scale )\n (mapcar\n '(lambda (coordinate) (* scale coordinate))\n point\n )\n )\n\n (defun _ScaleVector ( vector scale )\n (mapcar\n '(lambda (point) (_ScalePoint point scale))\n vector\n )\n )\n\n (defun _ScaleVectors ( vectors scale )\n (mapcar\n '(lambda (vector) (_ScaleVector vector scale))\n vectors\n )\n ) \n\n ;; draw the vectors relative to the\n ;; specified point and scaled according\n ;; to the viewsize using xor ink\n\n (defun _drawVectors ( vectors point )\n (foreach vector\n (mapcar\n '(lambda (vector)\n (mapcar\n '(lambda (point2)\n (mapcar '+ point point2)\n )\n vector\n )\n )\n (_ScaleVectors\n vectors\n (/\n (* scalefactor \n (getvar "viewsize")\n )\n deltay\n ) \n ) \n )\n (grdraw\n (car vector)\n (cadr vector)\n -1\n )\n )\n )\n \n ;; calculate the delta y of the vectors\n \n ( (lambda (yoords)\n (setq deltay\n (apply '-\n (mapcar '(lambda (foo) (apply foo yoords))\n '(max min)\n )\n ) \n )\n )\n (mapcar 'cadr (apply 'append vectors))\n )\n \n ;; while the user cursors about dynamically redraw\n ;; the vectors. When the user finally picks a point\n ;; clear off the vectors and return the point picked.\n ;; I've not written this to handle wonky ucs's etc,\n ;; that's your job. :P\n\n (while (not end)\n (setq\n result (grread t 1 0)\n key (car result)\n val (cadr result)\n )\n (cond\n ( (eq 5 key)\n (cond\n ( (null val2)\n (setq val2 val)\n (_drawVectors vectors val)\n )\n ( t\n (redraw)\n (_drawVectors vectors val)\n (setq val2 val)\n )\n )\n )\n ( (eq 3 key) (setq end t))\n )\n )\n\n ;; clear the screen of any crap we\n ;; drew that remains\n\n (redraw)\n\n ;; return the selected point (if the\n ;; user picked one) to the caller\n\n (if (eq 3 key) val)\n\n)\n}}}\n\nTest drive--\n\n{{{\n(defun c:Test ( / vectors )\n\n (setq vectors\n '(\n ((-9.80687 1.32409 0.0) (-9.80687 -1.17661 0.0))\n ((-9.80687 -1.17661 0.0) (-8.14065 -1.17661 0.0))\n ((-7.30753 1.32409 0.0) (-6.47442 1.32409 0.0))\n ((-6.89098 1.32409 0.0) (-6.89098 -1.17661 0.0))\n ((-7.30753 -1.17661 0.0) (-6.47442 -1.17661 0.0))\n ((-5.64131 -0.76005 0.0) (-5.22476 -1.17661 0.0))\n ((-5.22476 -1.17661 0.0) (-4.39164 -1.17661 0.0))\n ((-4.39164 -1.17661 0.0) (-3.97509 -0.76005 0.0))\n ((-3.97509 -0.76005 0.0) (-5.64131 0.907539 0.0))\n ((-5.64131 0.907539 0.0) (-5.22476 1.32409 0.0))\n ((-5.22476 1.32409 0.0) (-4.39164 1.32409 0.0))\n ((-4.39164 1.32409 0.0) (-3.97509 0.907539 0.0))\n ((-3.14334 -1.17661 0.0) (-3.14334 1.32409 0.0))\n ((-3.14334 1.32409 0.0) (-1.89368 1.32409 0.0))\n ((-1.89368 1.32409 0.0) (-1.47712 0.907539 0.0))\n ((-1.47712 0.907539 0.0) (-1.47712 0.490983 0.0))\n ((-1.47712 0.490983 0.0) (-1.89368 0.0744272 0.0))\n ((-1.89368 0.0744272 0.0) (-3.14334 0.0744272 0.0))\n ((1.85533 -1.17661 0.0) (1.85533 1.32409 0.0))\n ((1.85533 1.32409 0.0) (3.10499 1.32409 0.0))\n ((3.10499 1.32409 0.0) (3.52018 0.907539 0.0))\n ((3.52018 0.907539 0.0) (3.52018 0.490983 0.0))\n ((3.52018 0.490983 0.0) (3.10499 0.0744272 0.0))\n ((3.10499 0.0744272 0.0) (1.85533 0.0744272 0.0))\n ((2.27188 0.0744272 0.0) (3.52018 -1.17661 0.0))\n ((4.3533 -1.17661 0.0) (4.3533 1.32409 0.0))\n ((4.3533 1.32409 0.0) (6.01952 1.32409 0.0))\n ((6.01952 1.32409 0.0) (6.01952 -1.17661 0.0))\n ((6.01952 -1.17661 0.0) (4.3533 -1.17661 0.0))\n ((4.3533 -1.17661 0.0) (4.3533 -1.17661 0.0))\n ((8.51885 -0.76005 0.0) (8.1023 -1.17661 0.0))\n ((8.1023 -1.17661 0.0) (7.26919 -1.17661 0.0))\n ((7.26919 -1.17661 0.0) (6.85263 -0.76005 0.0))\n ((6.85263 -0.76005 0.0) (6.85263 0.907539 0.0))\n ((6.85263 0.907539 0.0) (7.26919 1.32409 0.0))\n ((7.26919 1.32409 0.0) (8.1023 1.32409 0.0))\n ((8.1023 1.32409 0.0) (8.51885 0.907539 0.0))\n ((9.35196 -1.17661 0.0) (9.35196 1.32409 0.0))\n ((11.0168 1.32409 0.0) (9.76852 0.0744272 0.0))\n ((9.76852 0.0744272 0.0) (9.35196 0.0744272 0.0))\n ((9.76852 0.0744272 0.0) (11.0168 -1.17661 0.0))\n ((11.8499 -0.76005 0.0) (12.2665 -1.17661 0.0))\n ((12.2665 -1.17661 0.0) (13.0996 -1.17661 0.0))\n ((13.0996 -1.17661 0.0) (13.5162 -0.76005 0.0))\n ((13.5162 -0.76005 0.0) (11.8499 0.907539 0.0))\n ((11.8499 0.907539 0.0) (12.2665 1.32409 0.0))\n ((12.2665 1.32409 0.0) (13.0996 1.32409 0.0))\n ((13.0996 1.32409 0.0) (13.5162 0.907539 0.0))\n ((-10.5512 2.1176 0.0) (14.2714 2.1176 0.0))\n ((14.2714 2.1176 0.0) (14.2714 -1.87724 0.0))\n ((14.2714 -1.87724 0.0) (-10.5512 -1.87724 0.0))\n ((-10.5512 -1.87724 0.0) (-10.5512 2.1176 0.0))\n ((-10.5512 2.1176 0.0) (-10.5512 2.1176 0.0))\n )\n )\n\n (GrVectorsGetPointScaled\n vectors\n 0.05\n )\n \n (princ)\n\n)\n}}}\n\nRun the above and use the mouse wheel to zoom in and out.\n\nCheers.\n\n:)
[[Swamp post.|http://www.theswamp.org/index.php?topic=7898.msg100407#msg100407]]\n\n{{{\n(defun c:HiRes ( / _HiRes )\n\n (defun _Hires ()\n (foreach pair\n '( (regenmode . 1)\n (hideprecision . 1)\n (facetres . 10)\n (facetratio . 1)\n (dispsilh . 1)\n )\n (setvar (car pair) (cdr pair))\n )\n (command ".viewres" "_yes" 20000)\n )\n\n (setvar 'cmdecho 0)\n\n (cond\n ( (eq 1 (getvar "tilemode"))\n (_HiRes)\n )\n ( (eq 1 (getvar "cvport"))\n (_HiRes)\n (cond\n ( (< 1 (length (vports)))\n (command ".mspace")\n (_HiRes)\n (command ".pspace")\n )\n )\n )\n ( t\n (_HiRes)\n (command ".pspace")\n (_HiRes)\n (command ".mspace")\n )\n )\n\n (setvar 'cmdecho 1)\n\n (princ)\n\n)\n}}}\n\nSee companion function, LoRes.
From [[www.tiddlywiki.com/#HowToUpgrade|http://www.tiddlywiki.com/#HowToUpgrade]].\n<<<\nThe core TiddlyWiki code is regularly updated with bug fixes and new features. If you're using an earlier revision of TiddlyWiki, here's the simple way to upgrade to the latest version:\n* Open your TiddlyWiki file in FireFox (say it's called "mystuff.html")\n* SaveChanges (with SaveBackups switched on) to make sure that you've got a backup of it\n* Without closing that page, right-click on [[this link|http://www.tiddlywiki.com/empty.html]], select 'Save target' or 'Save link' and save it as "mystuff.html", replacing your existing file\n* Now go back to the previously opened copy of "mystuff.html" in your browser and SaveChanges again. It will inherit the newly saved code\n* Refresh the page in the browser to verify that the upgrade has worked\nThe most likely cause of the upgrade process not working properly is that one of the [[Plugins]] you're using is not compatible with a change in the new release. If so, you can use the [[ImportTiddlersPlugin|http://www.tiddlytools.com/#ImportTiddlersPlugin]] from TiddlyTools to selectively import your content and [[Plugins]] into a new empty TiddlyWiki.
Please send all inquiries to --\n\n@@[cadlabs]@@ @@[at]@@ @@[gmail]@@ @@[dot]@@ @@[com]@@\n\n^^(Please forgive the obfuscated email address, sadly necessary to thwart spam bots and their ilk).^^
[[Plugins]] are just tiddlers containing JavaScript code that is tagged with <<tag systemConfig>> (see [[TiddlyWiki/Dev]] for information on writing your own plugins). TiddlyWiki executes any [[Plugins]] as it loads; they can add [[Macros]] or otherwise extend and enhance the base code.\n\nThe recommended way to install a plugin into your own copy of TiddlyWiki is to take it direct from the plugin author's site (see [[Plugins]] for a list of some of the main ones):\n# If you haven't already done so, follow the instructions in DownloadSoftware to make your own local copy of TiddlyWiki\n# Let's assume that you wish to download EricShulman's ImportTiddlersPlugin\n# Open a new browser window and navigate to http://www.tiddlytools.com/#ImportTiddlersPlugin\n# Double click the tiddler, or click the {{{source}}} button (on other sites it will sometimes be a {{{view}}} or {{{edit}}} button)\n# The entire text of the tiddler should be selected; if not select it manually with Control-A or Command-A\n# Copy the entire text of the tiddler to the clipboard\n# Open your TiddlyWiki file in a new browser window\n# Click {{{new tiddler}}} to create a new blank tiddler\n## Paste the contents of the clipboard into it's body\n## Set the title to {{{ImportTiddlersPlugin}}}\n## Add the tag {{{systemConfig}}}\n# Click {{{done}}} on the tiddler\n# SaveChanges\n# Reload your TiddlyWiki in the browser\nThe plugin should now be available for use.
[[Swamp post.|http://www.theswamp.org/index.php?topic=9018.msg115977#msg115977]]\n\n{{{\n(defun Is3DPoint ( point )\n (and\n (listp point)\n (eq 3 (length point))\n (vl-every 'numberp point)\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=8036.msg102534#msg102534]]\n\n{{{\n(defun IsDigit ( x )\n (< 47 (ascii x) 58)\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=9823.msg125961#msg125961]]\n\n{{{\n(defun IsFolderWriteable ( foldername )\n (and\n (vl-file-directory-p foldername)\n ( (lambda ( / fso folder result )\n (setq result\n (zerop\n (logand 1\n (vlax-get\n (setq folder\n (vlax-invoke\n (setq fso\n (vla-getinterfaceobject\n (vlax-get-acad-object)\n "Scripting.FileSystemObject"\n )\n ) \n 'GetFolder\n foldername\n )\n )\n 'Attributes\n ) \n )\n )\n )\n (vlax-release-object folder)\n (vlax-release-object fso)\n result\n )\n )\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=9018.msg115977#msg115977]]\n\n{{{\n(defun IsPoint ( point )\n (and\n (listp point)\n (< 1 (length point) 4)\n (vl-every 'numberp point)\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7774.msg98663#msg98663]]\n\n{{{\n(defun IsZero ( x )\n (or (zerop x)\n (equal x 0 1e-15)\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7389.msg92169#msg92169]]\n\nKinda mimic Visual BASIC's LSet function. \n\n{{{\n(defun LSet ( text padding maxlen )\n (substr\n ( (lambda ( )\n (while \n (<\n (strlen (setq padding (strcat padding padding)))\n maxlen\n )\n )\n (strcat text padding)\n )\n )\n 1\n maxlen\n )\n)\n}}}\n\n''Example'' --\n\n{{{\n(LSet "text" " " 10)\n\n==> "text "\n}}}\n\nSee related article [[RSet]].
[[IronPython 1.0 Beta 6|http://www.microsoft.com/downloads/details.aspx?FamilyId=F5BB7DEF-7C71-40D0-9AD7-81E60E85E3DB&displaylang=en]]\n
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4777.0]]\n\nAn example function that wraps (and traps) bulk method / property calls to the layers collection. Spawned another function ForEachObject that is more generic.\n\n{{{\n(defun LayerMods ( predicateFunction trueFunction elseFunction / foo )\n\n ;; trivial code, nonetheless © 2005 Michael Puckett\n ;; you are free to use in your code, just give a nod\n ;; to the author and where you found this ;]\n ;;\n ;; predicateFunction must take one parameter, a layer\n ;; object and return a nil or non nil result\n ;;\n ;; trueFunction must take one parameter, a layer object;\n ;; what it actually does is up to the caller. It may be\n ;; nil if the caller wishes to do nothing when the\n ;; predicateFunction returns a non nil result.\n ;;\n ;; elseFunction must take one parameter, a layer object;\n ;; what it actually does is up to the caller. It may be\n ;; nil if the caller wishes to do nothing when the\n ;; predicateFunction does not return a non nil result.\n ;;\n ;; no error trapping is done here in the interests of\n ;; svelte programming, the caller is responsible for that\n\n (eval\n (append\n '(defun foo (layer))\n (cond\n ( (and\n (eq 'subr (type trueFunction))\n (eq 'subr (type elseFunction))\n )\n '( (if (predicateFunction layer)\n (trueFunction layer)\n (elseFunction layer)\n )\n )\n )\n ( (eq 'subr (type trueFunction))\n '( (if (predicateFunction layer)\n (trueFunction layer)\n )\n )\n )\n ( (eq 'subr (type elseFunction))\n '( (if (null (predicateFunction layer))\n (elseFunction layer)\n )\n )\n )\n ( t\n ;; apparently caller wants to do nothing\n ;; via the true or else functions. However,\n ;; let's assume something is done in the\n ;; predicate function, and we need to fulfil\n ;; the contract by applying the predicate\n ;; function to every layer object\n '((predicateFunction layer))\n )\n )\n )\n )\n\n (vlax-for layer\n\n (vla-get-layers\n (vla-get-activedocument\n (vlax-get-acad-object)\n )\n )\n\n (foo layer)\n\n )\n\n (princ)\n\n)\n}}}\n\n''Some examples.''\n\nEmploying a true function only --\n\n{{{\n;; lock all layers where the first two characters\n;; are the same, like "AA-Concrete" or "BB-Steel",\n;; otherwise do nothing\n\n(defun c:NameMePlease ( )\n\n (LayerMods \n\n (lambda ( layer / lst )\n (eq\n (car\n (setq lst\n (vl-string->list\n (strcase\n (vla-get-name layer)\n )\n )\n )\n )\n (cadr lst)\n )\n )\n\n (lambda ( layer )\n (vla-put-lock layer :vlax-true)\n )\n\n nil\n\n )\n \n)\n}}}\n\n{{{\n;; thaw and turn on all layers unconditionally\n\n(defun c:ThawAll ( )\n\n (LayerMods \n\n (lambda ( layer ) t)\n\n (lambda ( layer )\n (vl-catch-all-apply\n '(lambda ()\n (vla-put-layeron layer :vlax-true)\n (vla-put-freeze layer :vlax-false)\n )\n )\n )\n\n nil\n\n )\n)\n}}}\n\nEmploying true and else functions --\n\n{{{\n;; lock all layers where the first two\n;; characters are the same, like "AA-Concrete"\n;; or ""BB-Steel", otherwise unlock the layer\n\n(defun c:NameMePlease2 ( )\n\n (LayerMods \n\n (lambda ( layer / lst )\n (eq\n (car\n (setq lst\n (vl-string->list\n (strcase\n (vla-get-name layer)\n )\n )\n )\n )\n (cadr lst)\n )\n )\n\n (lambda ( layer )\n (vla-put-lock layer :vlax-true)\n )\n\n (lambda ( layer )\n (vla-put-lock layer :vlax-false)\n )\n\n )\n \n)\n}}}\n\n{{{\n;; freeze and turn off all xref layers,\n;; otherwise thaw and turn on layer\n\n(defun c:XRefsOff ( )\n\n (LayerMods \n\n (lambda ( layer )\n (wcmatch\n (vla-get-name layer)\n "*|*"\n )\n )\n\n (lambda ( layer )\n ;; error trap an attempt to\n ;; freeze the current layer\n (vl-catch-all-apply\n '(lambda ()\n (vla-put-layeron layer :vlax-false)\n (vla-put-freeze layer :vlax-true)\n )\n )\n )\n\n (lambda ( layer )\n (vl-catch-all-apply\n '(lambda ()\n (vla-put-layeron layer :vlax-true)\n (vla-put-freeze layer :vlax-false)\n )\n )\n )\n \n ) \n\n)\n}}}\n\nEmploying an else function only --\n\n{{{\n;; isolate the current layer\n\n(defun c:Isolate ( / clayer )\n\n (setq clayer (getvar "clayer"))\n\n (LayerMods \n\n (lambda ( layer )\n ;; oh my, using local global\n (eq clayer (vla-get-name layer))\n )\n\n nil\n\n (lambda ( layer )\n (vla-put-layeron layer :vlax-false)\n (vla-put-freeze layer :vlax-true)\n )\n )\n)\n}}}\n\nEmploying neither true or else functions --\n\n{{{\n;; print all colors (don't actually do\n;; anything to any of the layers)\n\n(defun c:LayerColors ( )\n\n (princ "Layer colors:\sn")\n\n (LayerMods \n\n (lambda ( layer )\n (princ\n (strcat\n (vla-get-name layer)\n " => "\n (itoa (vla-get-color layer))\n "\sn"\n )\n )\n )\n\n nil ;; do nothing\n\n nil ;; what ^ said\n\n )\n)\n}}}\n\netc.\n\n(I didn't actually test these examples, if you find an insect let me know).\n\nIf you're still with me I use this technique at a slightly higher level -- rather than code for a specific collection like the layers collection, I use it for any collection, passing the collection to the overall wrapper --\n\n{{{\n(defun ModifyCollection ( collection predicateFunction trueFunction elseFunction )\n\n (eval\n (append\n '(defun foo (object))\n ...\n )\n )\n \n (vlax-for object collection\n (foo object)\n ) \n\n)\n}}}\n\nBut in the interests of initial clarity I coded it as offered above.\n\nOops, did I go and share too much info again?\n\n:)
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=7876.0]]\n\nUsing traditional DXF codes (modify to suit) ...\n\n{{{\n(defun LayerPropsViaDxf ( / data result )\n (while (setq data (tblnext "layer" (null data)))\n (setq result\n (cons\n (mapcar\n '(lambda (key) (cdr (assoc key data)))\n '(2 62 6) ;; name, color, ltype - modify to suit\n )\n result\n )\n )\n )\n)\n}}}\n\nUsing ~ActiveX (modify to suit) ...\n\n{{{\n(defun LayerPropsViaActiveX ( document / result )\n (vlax-for layer (vla-get-layers document)\n (setq result\n (cons\n (mapcar\n '(lambda (property) (vlax-get layer property))\n '(name color linetype) ;; modify to suit\n )\n result\n )\n )\n )\n)\n}}}
http://www.autodesk.com\nhttp://www.theswamp.com
<<tagging Python>>
<<tagging VisualBASIC>>
<<tagging VisualLISP>>
[[Swamp post.|http://www.theswamp.org/index.php?topic=7898.msg100407#msg100407]]\n\n{{{\n(defun c:LoRes ( / _LoRes )\n\n (defun _LoRes ()\n (foreach pair\n '( (regenmode . 1)\n (hideprecision . 0)\n (facetres . 0.5)\n (facetratio . 0)\n (dispsilh . 1)\n )\n (setvar (car pair) (cdr pair))\n )\n (command ".viewres" "_yes" 100)\n )\n\n (setvar 'cmdecho 0)\n\n (cond\n ( (eq 1 (getvar "tilemode"))\n (_LoRes)\n )\n ( (eq 1 (getvar "cvport"))\n (_LoRes)\n (cond\n ( (< 1 (length (vports)))\n (command ".mspace")\n (_LoRes)\n (command ".pspace")\n )\n )\n )\n ( t\n (_LoRes)\n (command ".pspace")\n (_LoRes)\n (command ".mspace")\n )\n )\n\n (setvar 'cmdecho 1)\n\n (princ)\n\n)\n}}}\n\nSee companion function, HiRes.
[[Swamp post.|http://www.theswamp.org/index.php?topic=9211.msg118838#msg118838]]\n\n{{{\n;;=====================================================================\n;;\n;; LoadSupport.lsp © 2005-2006 Michael Puckett. All Rights Reserved.\n;;\n;;---------------------------------------------------------------------\n;;\n;; In short, <safe> load each LISP (lsp|fas|vlx) file found in a flat\n;; or succesively nested folder branch.\n;;\n;;=====================================================================\n\n(defun LoadSupport\n\n ;;=================================================================\n ;;\n ;; Typical folder structures and function calls\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; NESTED FOLDER STRUCTURES\n ;;\n ;; For a huge operation that is split over multiple cities and\n ;; multiple disciplines, each with specilized requirements, the\n ;; LISP files might be distributed in a hiearchy like this --\n ;;\n ;; k:\sCAD\sLISP\sCommon ;; Company's main LISP library\n ;; | ;;\n ;; +-- Calgary ;; LISP specific to Calgary\n ;; | | ;;\n ;; | +-- Civil ;; LISP specific to Civil\n ;; | | ;;\n ;; | +-- Elec ;; LISP specific to Elec\n ;; | | ;;\n ;; | +-- Piping ;; LISP specific to Piping\n ;; | ;;\n ;; +-- Toronto ;; LISP specific to Toronto\n ;; | | ;;\n ;; | +-- Civil ;; LISP specific to Civil\n ;; | | ;;\n ;; | +-- Elec ;; LISP specific to Elec\n ;; | | ;;\n ;; | +-- Piping ;; LISP specific to Piping\n ;; | ;;\n ;; +-- Vancouver ;; LISP specific to Vancouver\n ;; | ;;\n ;; +-- Civil ;; LISP specific to Civil\n ;; | ;;\n ;; +-- Elec ;; LISP specific to Elec\n ;; | ;;\n ;; +-- Piping ;; LISP specific to Piping\n ;;\n ;; Corresponding function call for a Calgary PC, Electrical\n ;; discipline -- \n ;;\n ;; (LoadSupport filename\n ;; '(\n ;; "K:\s\sCAD\s\sLISP\s\sCommon"\n ;; "Calgary"\n ;; "Elec"\n ;; )\n ;; )\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon ...\n ;;\n ;; common1.lsp ... loaded\n ;; common2.lsp ... loaded\n ;; common3.lsp ... loaded\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon\sCalgary ...\n ;;\n ;; Calgary.lsp ... loaded\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon\sCalgary\sElec ...\n ;;\n ;; grounding.lsp ... loaded\n ;; raceway.lsp ... loaded\n ;;\n ;; Please note that the function is not hard coded to a specific\n ;; number of nested folders. Maybe you decide this suits you\n ;; better --\n ;;\n ;; k:\sCAD\sLISP\sCommon ;; common support lisp\n ;; | ;;\n ;; +-- Civil ;; lisp specific to Civil\n ;; | ;;\n ;; +-- Elec ;; lisp specific to Elec\n ;; | ;;\n ;; +-- Piping ;; lisp specific to Piping\n ;;\n ;; Corresponding function call for a Piper's CADD Machine -- \n ;;\n ;; (LoadSupport filename\n ;; '(\n ;; "K:\s\sCAD\s\sLISP\s\sCommon"\n ;; "Piping"\n ;; )\n ;; )\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon ...\n ;;\n ;; common1.lsp ... loaded\n ;; common2.lsp ... loaded\n ;; common3.lsp ... loaded\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon\sPiping ...\n ;;\n ;; isogen.lsp ... loaded\n ;; routing.lsp ... loaded\n ;;\n ;; Note that each tier in the folder structure may | may not have\n ;; LISP files. That is, it is not mandatory for each tier to have\n ;; LISP files. The program will report what files are loaded as\n ;; they are loaded.\n ;;\n ;; Also, this means you can have other related files reside in each\n ;; tier, perhaps text files that host info related to the files\n ;; but not appropriate to reside in the actual LISP source code.\n ;;\n ;; Or maybe you have nothing but compiled vlx files in the\n ;; structure with some accompanying text files, keeping the\n ;; original source code safe in another location.\n ;; \n ;; Because each successive folder depth represents increased\n ;; specalization, said folders tend to contain less and less. To\n ;; me, drilling down thru a directory structure to find and edit\n ;; a LISP file is faster and more organized than piling hundreds\n ;; of LISP files into one flat directory structure, the impetus\n ;; for authoring this beast.\n ;;\n ;; FLAT FOLDER STRUCTURE.\n ;;\n ;; Maybe you decide, meh, all this nested folder nonesence is\n ;; well, just overkill, but you like the idea of having a function\n ;; that will load all LISP files in a specific folder. Simple --\n ;;\n ;; (LoadSupport "K:\s\sCAD\s\sLISP\s\sCommon")\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon ...\n ;;\n ;; common1.lsp ... loaded\n ;; common2.lsp ... loaded\n ;; common3.lsp ... loaded\n ;;\n ;; The function has been coded to accept a single string (a folder\n ;; name) or a list of folders, each successivly nested (as\n ;; previously mentioned).\n ;;\n ;; ERROR HANDLING\n ;;\n ;; The actual LISP loader is error trapped, so if an error is\n ;; encountered during the loading of a LISP file it will attempt\n ;; to report the loading error AND then continue loading the\n ;; balance of the files. For example --\n ;;\n ;; (loadsupport\n ;; '( \n ;; "K:\s\sCAD\s\sLISP\s\sCommon"\n ;; "Calgary"\n ;; "Elec"\n ;; )\n ;; )\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon ...\n ;;\n ;; common1.lsp ... loaded\n ;; common2.lsp ... failed <divide by zero>\n ;; common3.lsp ... loaded\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon\sCalgary ...\n ;;\n ;; Calgary.lsp ... loaded\n ;;\n ;; Loading K:\sCAD\sLISP\sCommon\sCalgary\sElec ...\n ;;\n ;; grounding.lsp ... loaded\n ;; raceway.lsp ... loaded\n ;;\n ;; OTHER MINUTIA / NOTES / SEWERAGE\n ;;\n ;; At this point you may be thinking, why not just use a recursive\n ;; function that loads every LISP file found in a directory tree?\n ;; Well thats not what I want, even though that's easier to code.\n ;;\n ;; Allow me to illuminate. I want to load all LISP files in a\n ;; specific branch of a directory structure --\n ;;\n ;; Only\n ;;\n ;; K:\sCAD\sLISP\sCommon\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sCalgary\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sCalgary\sElec\s *.lsp|fas|vlx\n ;;\n ;; NOT\n ;;\n ;; K:\sCAD\sLISP\sCommon\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sCalgary\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sCalgary\sElec\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sCalgary\sCivil\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sCalgary\sPiping\s *.lsp|fas|vlx \n ;; K:\sCAD\sLISP\sCommon\sToronto\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sToronto\sElec\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sToronto\sCivil\s *.lsp|fas|vlx\n ;; K:\sCAD\sLISP\sCommon\sToronto\sPiping\s *.lsp|fas|vlx \n ;; ...\n ;;\n ;; Ahh you say, why not recursively load starting at the deepest\n ;; node working your way all the way to the parent? The problem\n ;; with that approach is that the parent is likely not what I\n ;; consider the parent. For example, using the sample data above\n ;; the recursively determined parent would be K:\s or perhaps\n ;; K:\sCAD, whereas in reality I don't wish to load any files above\n ;; the K:\sCAD\sCOMMON folder. \n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; Yeah, I don't sleep much.\n ;;\n ;;=================================================================\n\n (\n folderlist\n\n /\n\n _StripPath\n _GetLispFiles\n _SafeLoad\n _LoadFolder\n _LoadFolders\n _Main\n )\n\n ;;=================================================================\n ;;\n ;; (_StripPath filename)\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; strip the path from a filename,\n ;;\n ;; e.g c:\sfolder\sfilename.lsp => filename.lsp\n ;;\n ;;=================================================================\n\n (defun _StripPath ( filename )\n (strcat\n (vl-filename-base filename)\n (vl-filename-extension filename)\n )\n )\n\n ;;=================================================================\n ;;\n ;; (_GetLispFiles path)\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; get all lsp/fas/vlx files for path, return sorted by group\n ;;\n ;;=================================================================\n\n (defun _GetLispFiles ( path / result )\n (apply 'append\n (mapcar\n '(lambda (filter)\n (vl-sort\n (vl-directory-files\n path\n filter\n 1\n )\n '<\n )\n )\n '("*.lsp" "*.fas" "*.vlx")\n )\n )\n )\n\n ;;=================================================================\n ;;\n ;; (_SafeLoad filename)\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; safely load a lsp/fas/vlx etc. Print any error message\n ;; generated if the load is unsuccessful and an associated error\n ;; msg captured\n ;;\n ;;=================================================================\n\n (defun _SafeLoad ( filename / filepath failed loaded error )\n\n (cond\n\n ( (setq filepath (findfile filename))\n\n (princ\n (strcat\n "\st\st"\n (_StripPath filePath)\n " ... "\n )\n )\n\n (setq error\n (vl-catch-all-apply\n '(lambda ( )\n (load filepath)\n (setq loaded\n (null failed)\n )\n )\n )\n )\n\n (princ\n (strcat\n (if loaded\n "loaded"\n (strcat\n "failed"\n (if (vl-catch-all-error-p error)\n (strcat\n " <"\n (vl-catch-all-error-message error)\n ">"\n )\n " <no error description>"\n )\n )\n )\n "\sn"\n )\n )\n\n loaded\n\n )\n\n ( (princ\n (strcat\n "\st\st"\n "File <"\n filename\n "> not found.\sn"\n )\n )\n\n nil\n\n )\n )\n )\n\n ;;=================================================================\n ;;\n ;; (_LoadFolder folder)\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; safely load all lisp / fas / vlx files found in path\n ;;\n ;;=================================================================\n\n (defun _LoadFolder ( folder / lispFiles )\n\n (cond\n\n ( (vl-file-directory-p folder)\n\n (princ\n (strcat\n "\snLoading "\n folder\n " ...\sn\sn"\n )\n )\n\n (foreach lispFile\n (setq lispFiles (_GetLispFiles folder))\n (_SafeLoad (strcat folder "\s\s" lispFile))\n )\n\n (if (null lispFiles)\n (princ "\st\st<none found>\sn")\n )\n )\n\n (\n\n (princ\n (strcat\n "\snInvalid path <"\n folder\n "> ignored ...\sn\sn"\n )\n )\n )\n\n )\n )\n\n ;;=================================================================\n ;;\n ;; (_LoadFolders '("K:\s\sCAD\s\sLISP" "Calgary" "Elec" ... ))\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; Try to load a tree of support files, where each node (folder)\n ;; is a child of the preceeding folder and may or may not have\n ;; lisp files (*.lsp|fas|vlx) and / or child folders.\n ;;\n ;; K:\s\sCAD\s\sLISP\s ;; *.lsp|fas|vlx\n ;; ;;\n ;; K:\s\sCAD\s\sLISP\sCalgary\s ;; *.lsp|fas|vlx\n ;; ;;\n ;; K:\s\sCAD\s\sLISP\sCalgary\sElec ;; *.lsp|fas|vlx\n ;;\n ;; ...\n ;;\n ;;=================================================================\n\n (defun _LoadFolders ( folderList / currentFolder )\n (foreach folder folderList\n (if (eq 'str (type folder))\n (_LoadFolder\n (setq currentFolder\n (if currentFolder\n (strcat currentFolder "\s\s" folder)\n folder\n )\n )\n )\n )\n )\n )\n\n ;;=================================================================\n ;;\n ;; (_Main folderList )\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; wrap all functionality defined herein, ergo: 'the solution'\n ;;\n ;;=================================================================\n\n (defun _Main ( folderList )\n (_LoadFolders folderList)\n (princ)\n )\n\n ;;=================================================================\n ;;\n ;; helper functions defined, party on dude -> invoke _Main\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; (Pre) handle a single string (a folder name) or a list of\n ;; strings (folder names, each successively nested).\n ;;\n ;;=================================================================\n\n (_Main\n (cond\n ( (listp folderList)\n folderList\n ) \n ( (eq 'str (type folderList))\n (list folderList)\n )\n ( (princ\n (strcat\n "Error. Invalid input: (LoadSupport "\n (vl-princ-to-string folderList)\n ").\sn"\n "Syntax: (LoadSupport \s"x:\s\sPath\s") or "\n "(LoadSupport '(\s"x:\s\sPath\s" \s"subfolder\s"))"\n )\n )\n nil\n ) \n )\n )\n \n)\n\n;;=====================================================================\n;;\n;; end LoadSupport.lsp\n;;\n;;=====================================================================\n}}}\n\n
Aka Michael Puckett, site owner owner / operator. \n\n''Questions, Inquiries, Just want to say hi?''\n<<<\n<<tiddler Inquiries>>\n<<<\nThank you,\n\nMichael.
[[Macros]] let you write tiddlers containing more exotic objects than just text. Here are some of the built-in macros (also see the GradientMacro and [[Sparklines]]):\n\nToday's date:\n{{{\n<<today>>\n}}}\nwill result in: <<today>>\n\nTag popup:\n{{{\n<<tag features>>\n}}}\nwill result in <<tag features>>\n\nNew journal entry:\n{{{\n<<newJournal "DD MMM YYYY, hh:mm">>\n}}}\nwill result in the button <<newJournal "DD MMM YYYY, hh:mm">>\nThe first parameter is DateFormatString\n\nTiddler inclusion:\n{{{\n<<tiddler MicroContent>>\n}}}\nwill insert the text of the tiddler MicroContent. //Note that there is no protection at the moment against inadvertantly setting up endless loops//\n<<tiddler MicroContent>>\n\nSlider:\n{{{\n<<slider chkTestSlider OptionsPanel options "Change TiddlyWiki advanced options">>\n}}}\nResults in this button <<slider chkTestSlider OptionsPanel options "Change TiddlyWiki advanced options">>\nThe parameters are:\n* cookie name to be used to save the state of the slider\n* name of the tiddler to include in the slider\n* title text of the slider\n* tooltip text of the slider
~~@@Best viewed from [[FireFox]].@@~~\n<<tabs mainMenu\n"…" "Quote of the day" QuoteOfTheDay\n"Articles" "Articles" CodeMenu\n"Tags" "Tags" CodeIndex\n"Other" "etc." OtherMenu\n>>\n^^Built with TiddlyWiki <<version>>^^
@@bgcolor(#88ccff):color(#ffffff):[[About]]@@\n----\n@@bgcolor(#88ccff):color(#ffffff):<<tag VisualLISP>>\n<<tag VisualBASIC>>\n<<tag Python>>@@\n@@bgcolor(#88ccff):color(#ffffff):<<tag Blogs>>\n<<tag Links>>@@\n@@bgcolor(#88ccff):color(#ffffff):<<tag Other>>@@\n----\n^^~TiddlyWiki <<version>>^^
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=2953.0]]\n\nOn another forum (not a CAD forum) I was asked to explain (for the 42nd time) the mapcar lambda thing, and while I feel the topic has been covered adequately by many different authors it seems some folks still find it confusing. \n\nSo ... I took a different approach: Rather than an encyclopedic spray of geek speak I just used tiny examples, and similarly, a simple, casual conversation. It is not exhaustive, it is not thorough, on the other hand its light, easy to digest; no acid reflux ...\n\n----\n\n''MAPCAR''\n\nFirst: When to use mapcar?\n\nGenerally speaking, use mapcar when you have a list of values and you want the result of some modification to that list to be returned as a list.\n\nOk, umm ... let's start with a list of strings:\n\n{{{\n(setq lst\n '( "joshua"\n "mary"\n "jim"\n )\n)\n\n=> ("joshua" "mary" "jim")\n}}}\n\nLet's say we want all these string to be uppercase but we still want all the names in a list. How could we do this without iterating the list (say with foreach) and constructing a new list?\n\nEasy, use mapcar with the strcase function:\n\n{{{\n(mapcar\n 'strcase\n lst\n)\n\n=> ("JOSHUA" "MARY" "JIM")\n}}}\n\nOk ... but let's say we want to change them to proper case (first letter uppercase, balance lowercase). There is no function to do that.\n\nOne way is to write our own function:\n\n{{{\n(defun Proper ( str )\n (strcat\n (strcase (substr str 1 1))\n (strcase (substr str 2) t)\n )\n)\n}}}\n\nThen use it just like we did with the strcase function:\n\n{{{\n(mapcar\n 'Proper\n lst\n)\n\n=> ("Joshua" "Mary" "Jim")\n}}}\n\nBut what if we don't want the overhead of a formal function declaration (that will hang round after we're done with it)?\n\n''LAMBDA''\n\nEasy, use lambda to create an anonymous function on the fly -- right where we need it (which will be discarded immediately after it is used):\n\n{{{\n(mapcar\n '(lambda ( str )\n (strcat\n (strcase (substr str 1 1))\n (strcase (substr str 2) t)\n )\n )\n lst\n)\n\n=> ("Joshua" "Mary" "Jim")\n}}}\n\nDid ya notice the similarity between the defun declaration of Proper and the lambda code that achieves the same?\n\nHope this is illuminating; cheers.\n\n:)\n\n----\n\nFor an abbreviated discussion of the ''apply'' function please see ApplyOhMy.
[[Swamp post.|http://www.theswamp.org/index.php?topic=7152.msg88315#msg88315]]\n\n{{{\n(defun Matrix-O-Matic ( m n / foo )\n\n (defun foo ( x / result )\n ( (lambda (k)\n (repeat x\n (setq result\n (cons\n (setq k (1- k))\n result\n )\n )\n )\n )\n (+ 0.5 (/ x 2.0))\n )\n )\n\n (apply 'append\n (mapcar\n '(lambda (y)\n (mapcar\n '(lambda (x) (list x y))\n (foo m)\n )\n )\n (foo n)\n )\n )\n)\n}}}\n\nExample --\n\n{{{\n(Matrix-O-Matic 2 3) \n}}}\n\nResult --\n\n{{{\n( \n (-0.5 -1.0) (0.5 -1.0) \n (-0.5 0.0) (0.5 0.0) \n (-0.5 1.0) (0.5 1.0)\n)\n}}}
From http://www.tiddlywiki.com/#MicroContent --\n<<<\nMicroContent being a fashionable word for self-contained fragments of content that are typically smaller than entire pages. Often MicroContent is presented via some kind of aggregation that reduces the perceptual shock and resource cost of context switching (eg Blogs aggregating several entries onto a page or Flickr presenting photos in an album). This TiddlyWiki aggregates MicroContent items that I call 'tiddlers' into pages that are loaded in one gulp and progressively displayed as the user clicks hypertext links to read them.
<<tabs txtMainTab \nCode 'Code Snips' TabCode\nLinks Links TabLinks \nBlogs Blogs TabBlogs \nOther Other TabOther\n>>
<<option chkSinglePageMode>> Display one tiddler at a time
''OptionsPanel''\n<<tiddler OptionsPanel>>\n\nAdvancedOptions\n<<tiddler AdvancedOptions>>
Miscellaneous links I want to remember.\n*[[LisaMcMillan|http://www.lisamcmillan.com/journal/best-of-web-apps-edition]] -- Self described web developer, teacher, designer, geek and gadget junkie.
[[About|cadlabs.com]]\n----\n[[Acknowledgements]]\n[[Clients]]\n<<tag Links>>\n<<tag Other>>\n----\n[[Options]]
<div class='header' macro='gradient vert #18f #04b'>\n<div class='headerShadow'>\n<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;\n<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n</div>\n<div class='headerForeground'>\n<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;\n<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>\n</div>\n</div>\n<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>\n<div id='sidebar'>\n<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>\n<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>\n</div>\n<div id='displayArea'>\n<div id='messageArea'></div>\n<div id='tiddlerDisplay'></div>\n</div>
[[Swamp post.|http://www.theswamp.org/index.php?topic=7749.msg98503#msg98503]]\n\n{{{\n(defun PicksetToEnames ( ss / i result )\n (if (eq 'pickset (type ss))\n (repeat (setq i (sslength ss))\n (setq result\n (cons\n (ssname ss (setq i (1- i)))\n result\n )\n )\n )\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7573.msg95871#msg95871]]\n\n{{{\n(defun c:PurgeUnusedGroups ( / dictionary ename group )\n (setq ename\n (cdr\n (assoc -1 \n (setq dictionary\n (dictsearch\n (namedobjdict)\n "acad_group"\n )\n ) \n )\n ) \n )\n (foreach pair dictionary\n (if (eq 3 (car pair))\n (if\n (null\n (assoc 340\n (dictsearch ename\n (setq group (cdr pair))\n )\n )\n )\n (entdel (dictremove ename group))\n )\n )\n )\n (princ)\n)\n}}}
<<QOTD Quotes>>
/***\n''QuoteOfTheDayPlugin for TiddlyWiki version 1.2.x and 2.0''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#QuoteOfTheDayPlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nDisplay a randomly selected "quote of the day"\n\n!!!!!Usage\n<<<\n{{{<<QOTD //tiddlername//>>}}}\nPut your quotations into a tiddler (called //tiddlername//). Separate each quote by a horizontal rule (use "----" on a line by itself). Each time the macro is rendered it will display a different quotation, selected at random from the specified tiddler.\n<<<\n!!!!!Example\n<<<\n{{{<<QOTD Quotations>>}}}\n<<QOTD Quotations>>\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''QuoteOfTheDayPlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for QuoteOfTheDay handling^^\n<<<\n!!!!!Revision History\n<<<\n''2005.10.21 [1.0.0]''\nInitial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].\nBased on a suggestion by M.Russula\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.QOTD = {major: 1, minor: 0, revision: 0, date: new Date(2005,10,21)};\nconfig.macros.QOTD = {};\nconfig.macros.QOTD.handler= function(place,macroName,params) {\n var txt=store.getTiddlerText(params[0]); if (!txt) return;\n var quotes=txt.split("\sn----\sn");\n // then, get a random index number between 0 and N-1 and wikify that text\n wikify(quotes[Math.floor(Math.random()*quotes.length)],place);\n}\n//}}}
Walking on water and developing software from a spec is easy if both are frozen. Edward V. Berard.\n----\nThose who say it cannot be done should refrain from interrupting those who can and are.\n----\nSomewhere, something incredible is waiting to be known. Carl Sagan.\n----\nIn theory there is no difference between theory and practice -- but in practice there is.\n----\nPRINTER - A device consisting of three main parts: the case, the jammed paper tray and the blinking red light.\n----\nAccepting reality is the first step towards insanity.\n----\nAlways listen to experts. They'll tell you what can't be done, and why. Then do it.\n----\nNinth Law of Cartoon Physics: Everything falls faster than an anvil.\n----\nTalent develops in tranquility, character in the full current of human life. Johann Wolfgang von Goethe.\n----\nThe problem with the world is that fools and fanatics are always so certain of themselves and wiser people so full of doubts. Bertrand Russell.\n----\nBe careful what you think; your life is shaped by your thoughts. Biblical proverb.\n----\nI'm not a complete idiot (some parts are missing). Bumper sticker.\n----\nYou miss 100% of the shots you don't take. Wayne Gretzky.\n----\nOf all the things I've lost, I miss my mind the most. Mark Twain.\n----\nTime is what keeps things from happening all at once. John A. Wheeler.\n----\nDon't be so humble - you are not that great. Golda Meir to a visiting diplomat.\n----\nI have not failed. I've just found 10,000 ways that won't work. Thomas Edison.\n----\nSometimes you're the windshield; sometimes you're the bug. Mark Knopfler.\n----\nI tried to think but nothing happened! Curly.\n----\nThe early bird gets the worm, but the second mouse gets the cheese. Jon Hammond.\n----\nIf your parents never had children, chances are -- neither will you. Dick Cavett.\n----\nSmoking is one of the leading causes of statistics. Fletcher Knebel.\n----\nAsk her to wait a moment -- I'm almost done. Carl Friedrich Gauss's response upon hearing that his wife was dying.\n----\nI think there is a world market for maybe five computers. Thomas Watson, Chairman of IBM, 1943.\n----\nThe covers of this book are too far apart. Ambrose Bierce.\n----\nIf I were two-faced, would I be wearing this one? Abraham Lincoln.\n----\nIf we don't succeed, we run the risk of failure. Dan Quayle.\n----\nLast night I dreamed I had insomnia. I woke up exhausted, yet too well rested to go back to sleep. Bob Ingman.\n----\nSleep is when all the unsorted stuff comes flying out as from a dustbin upset in a high wind. William Golding.\n----\nDogs lead a nice life. You never see a dog with a wristwatch. George Carlin.\n----\nSacred cows make the best hamburger. Mark Twain.\n----\nYou're about as useful as a one-legged man at an arse kicking contest. Rowan Atkinson.\n----\nExpecting the world to treat you fairly, because you are a good person, is a little like expecting the bull not to attack you, because you are a vegetarian. Dennis Wholey.\n----\nIf your advance is going well, you are walking into an ambush. Murphy's Law.\n----\nHappiness is having a large, loving, caring, close-knit family -- in another city. George Burns.\n----\nPrediction is very difficult, especially of the future. Niels Bohr.\n----\nWhat happens if a big asteroid hits Earth ? Judging from realistic simulations involving a sledge hammer and a common laboratory frog, we can assume it will be pretty bad. Dave Barry.\n----\nIn the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. Douglas Adams.\n----\nTragedy -- to fall in love with a face, and marry the whole woman. Julian Tuwim.\n----\nIf builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. Murphy's Law.\n----\nAll publicity is good, except an obituary notice. Brendan Behan.\n----\nMy doctor says that I have a malformed public-duty gland and a natural deficiency in moral fiber, and that I am therefore excused from saving Universes. Douglas Adams.\n----\nThose who wait for that must wait until a shrimp learns to whistle. Nikita Khrushchev.\n----\nI'm desperately trying to figure out why kamikaze pilots wore helmets. Dave Edison.\n----\nCommon sense ain't common. Will Rogers.\n----\nSome men are born mediocre, some men achieve mediocrity, and some men have mediocrity thrust upon them. Joseph Heller.\n----\nA word to the wise ain't necessary. It's the stupid ones who need the advice. Bill Cosby.\n----\nSmoking kills. If you're killed, you've lost a very important part of your life. Brooke Shields.\n----\nSex is one of the nine reasons for reincarnation. The other eight are unimportant. Henry Miller.\n----\nI love deadlines. I like the whooshing sound they make as they fly by. Douglas Adams.\n----\nMen occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing had happened. Sir Winston Churchill.\n----\nIt is a mistake to think you can solve any major problems just with potatoes. Douglas Adams.\n----\nIf there's anything more important than my ego around, I want it caught and shot now. Douglas Adams.\n----\nMy mother never saw the irony in calling me a son-of-a-bitch. Jack Nicholson.
[[Swamp post.|http://www.theswamp.org/index.php?topic=7389.msg92169#msg92169]]\n\nKinda mimic Visual BASIC's RSet function. \n\n{{{\n(defun RSet ( text padding maxlen )\n (substr\n ( (lambda ( )\n (while \n (<\n (strlen (setq padding (strcat padding padding)))\n maxlen\n )\n )\n (setq text (strcat padding text)) \n )\n )\n (- (strlen text) (1- maxlen))\n )\n)\n}}}\n\n''Example'' --\n\n{{{\n(RSet "text" " " 10)\n\n==> " text"\n}}}\n\nSee related article [[LSet]].
[[Swamp post.|http://www.theswamp.org/index.php?topic=7229.msg89412#msg89412]]\n\n{{{\n(defun RemoveFromPickSetIf ( ss func )\n ;; The supplied func must take one\n ;; argument, an ename. What it does\n ;; we don't care, but if it returns\n ;; a non nil result remove the entity\n ;; from the pickset\n (if (eq 'pickset (type ss))\n (repeat (setq i (sslength ss))\n (if\n (func\n (setq ename\n (ssname ss\n (setq i (1- i))\n )\n )\n )\n (ssdel ename ss)\n )\n )\n )\n ss\n)\n}}}\n\nContrived example, select all entites except entity with handle "~A1B2C3" --\n\n{{{\n(setq ss\n (RemoveFromPickSetIf\n (ssget "x")\n (lambda (ename)\n (eq "A1B2C3"\n (cdr\n (assoc 5\n (entget ename)\n )\n )\n )\n )\n )\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4903.0]]\n\nMy version of a very commonly requested function. This one performs favorably with a wide variety of data distributions: many items to deeply nested.\n\n{{{\n(defun RemoveNth ( n lst / len foo i )\n\n (defun foo (x)\n (if (eq n (setq i (1+ i)))\n (defun foo (x) nil)\n ) \n )\n\n (cond\n ( (zerop n) (cdr lst))\n ( (eq n (1- (setq len (length lst))))\n (reverse (cdr (reverse lst)))\n )\n ( (< (setq i -1) n len)\n (vl-remove-if 'foo lst)\n ) \n ( lst )\n )\n \n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7594.msg96123#msg96123]]\n\n{{{\n(defun Replace ( oldText newText text / i )\n (if (/= oldText newText)\n (while (setq i (vl-string-search oldText text))\n (setq text\n (vl-string-subst\n newText\n oldText\n text\n i\n )\n )\n )\n )\n text\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=5349.0]]\n\nReturn the coordinates for the smallest rectangle (bounding box) that fully encloses the selection set. Not normalized to the WCS, that's the responsibility of the caller.\n\n{{{\n(defun SSBoundingBox ( ss / _GetBoundingBox _SStoObjects _Main )\n\n (defun _GetBoundingBox ( object / p1 p2 )\n (vl-catch-all-apply\n '(lambda ( )\n (vlax-invoke-method\n object\n 'GetBoundingBox\n 'p1\n 'p2\n )\n )\n )\n (if p1\n ( (lambda (data)\n (mapcar\n '(lambda (funcs)\n (mapcar\n '(lambda (func)\n (apply func data)\n )\n funcs\n )\n ) \n '( (caar cadar)\n (caadr cadar)\n (caadr cadadr)\n (caar cadadr)\n )\n )\n ) \n (list\n (mapcar\n 'vlax-safearray->list\n (list p1 p2)\n )\n )\n )\n ) \n )\n \n (defun _SStoObjects ( ss / i objects )\n (if (eq 'pickset (type ss))\n (repeat (setq i (sslength ss))\n (setq objects\n (cons\n (vlax-ename->vla-object\n (ssname ss\n (setq i (1- i))\n )\n )\n objects\n )\n )\n )\n )\n objects\n )\n \n (defun _Main ( ss / boundingboxes ) \n (cond\n ( (setq boundingboxes\n (vl-remove-if 'null\n (mapcar '_GetBoundingBox\n (_SStoObjects ss)\n )\n )\n ) \n (mapcar\n '(lambda ( func pair / lst )\n (list\n (apply (car pair)\n (mapcar 'car\n (setq lst\n (mapcar\n func\n boundingboxes\n )\n )\n ) \n )\n (apply (cadr pair)\n (mapcar 'cadr lst)\n )\n ) \n )\n '(car cadr caddr cadddr)\n '((min min)(max min)(max max)(min max)) \n ) \n ) \n )\n )\n \n (_Main ss)\n \n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7793.msg99024#msg99024]]\n\n{{{\n(defun SSRedraw ( ss mode / i )\n (if (eq 'pickset (type ss))\n (repeat (setq i (sslength ss))\n (redraw\n (ssname ss (setq i (1- i)))\n mode\n )\n )\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=3984.msg47584;topicseen#msg47584]]\n\n{{{\n(vla-put-saveastype\n (vla-get-opensave\n (vla-get-preferences\n (vlax-get-acad-object)\n )\n ) \n code\n)\n}}}\n{{{\nCodes ...\n\nacR12_DXF AutoCAD Release12/LT2 DXF (*.dxf)\n\nac2000_dwg AutoCAD 2000 DWG (*.dwg)\n\nac2000_dxf AutoCAD 2000 DXF (*.dxf)\n\nac2000_Template AutoCAD 2000 Drawing Template File (*.dwt)\n\nac2004_dwg AutoCAD 2004 DWG (*.dwg)\n\nac2004_dxf AutoCAD 2004 DXF (*.dxf)\n\nac2004_Template AutoCAD 2004 Drawing Template File (*.dwt)\n\nacNative A synonym for the current drawing release\n format. If you want your application to save\n the drawing in the format of whatever version\n of AutoCAD the application is running on,\n then use the acNative format.\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=2723.0]\n\nBased on a conversation in [[this thread|http://theswamp.org/phpBB2/viewtopic.php?t=2688&start=15]] I penned the following function. Perhaps you can use it as it, perhaps if you modify it to suit. It will scroll thru a list of items at the ~AutoCAD command line, cycling forward on the [tab] key, backwards on the [backspace] key and selecting the item on the [enter] key. It's kinda cool (the scrolling thru the items thing is Keith's idea).\n\n{{{\n(defun SelectItem\n\n ;;---------------------------------------------------------\n ;;\n ;; Syntax (SelectItem lst)\n ;;\n ;;---------------------------------------------------------\n ;;\n ;; Credits: Written 2004/10/09 by Michael Puckett based\n ;; on an original concept posted to theswamp.org by Daron\n ;; Rogers and contributing ideas posted by Keith Blackie\n ;; and Charles Alan Butler.\n ;;\n ;;---------------------------------------------------------\n\n ( lst\n /\n _display\n _string\n _labels\n back\n tab\n enter\n boundary\n labels\n whitespace\n index\n input\n )\n\n ;;---------------------------------------------------------\n ;;\n ;; local defun, (_display whitespace labels index)\n ;;\n ;;---------------------------------------------------------\n\n (defun _display ( whitespace labels index )\n (princ\n (strcat\n whitespace\n "Select item <"\n (nth index labels)\n "> [backspace|tab|enter]: "\n )\n )\n )\n\n ;;---------------------------------------------------------\n ;;\n ;; local defun, (_string code len)\n ;;\n ;;---------------------------------------------------------\n\n (defun _string ( code len / s )\n (setq s (list code))\n (while (< (length (setq s (append s s))) len))\n (substr (vl-list->string s) 1 len)\n )\n\n ;;---------------------------------------------------------\n ;;\n ;; local defun, (_labels lst len)\n ;;\n ;;---------------------------------------------------------\n\n (defun _labels ( lst len )\n (mapcar\n '(lambda (x) (substr (vl-princ-to-string x) 1 len))\n lst\n )\n )\n\n ;;---------------------------------------------------------\n ;;\n ;; start 'main', intialize vars\n ;;\n ;;---------------------------------------------------------\n\n (setq\n back '(2 8)\n tab '(2 9)\n enter '(2 13)\n boundary (1- (length lst))\n labels (_labels lst 32)\n whitespace (strcat "\sr" (_string 32 78) "\sr")\n index 0\n )\n\n ;;---------------------------------------------------------\n ;;\n ;; show the initial selection\n ;;\n ;;---------------------------------------------------------\n\n (_display whitespace labels index)\n\n ;;---------------------------------------------------------\n ;;\n ;; loop while the user does not press [enter]\n ;;\n ;;---------------------------------------------------------\n\n (while (not (equal enter (setq input (grread))))\n (_display whitespace labels\n (setq index\n (cond\n ( (equal tab input)\n (if (< index boundary) (1+ index) 0)\n )\n ( (equal back input)\n (if (< 0 index) (1- index) boundary)\n )\n ( index )\n )\n )\n )\n )\n\n ;;---------------------------------------------------------\n ;;\n ;; return the selected item\n ;;\n ;;---------------------------------------------------------\n\n (nth index lst)\n\n)\n}}}\n\nExample use:\n\n{{{(SelectItem '(1 2 3))}}}
/***\n\n''This plugin was previously called StyleChooser.''\n\n|Name|SelectThemePlugin|\n|Created by|SimonBaird and SaqImtiaz|\n|Location|http://lewcid.googlepages.com/lewcid.html#SelectThemePlugin|\n|Version|1.2.3|\n|Requires|~TW2.x|\n!Description\n*An alternative style switcher, can be used to switch just stylesheets and/or pagetemplates, or a combination of both (a theme)\n*you can add your own stylesheets and pagetemplates, or use a ThemePack, like BigThemePack.\n\n!Usage\n* You have to have fetch or create some styleSheets and pageTemplates to use this plugin.\n**You can either get a ThemePack like BigThemePack which automatically adds themes to ThemeSelect.\n**or create tiddlers with styleSheets and pageTemplates and tag them styleSheets and pageTemplates respectively.\n* Put {{{<<themeSelect style 'Select theme'>>}}} in your SideBarOptions.\n\n!Creating Theme Packs\n*You can create your own theme pack if you like. Instructions can be found [[here.|CreateThemePack]]\n\n!History\n* 15-May-06, v1.2.3, added paramifier so you can put theme on url, eg http://www.somewhere.com/twfile.html#theme:Berry2, thanks Clint (Simon).\n* 28-Apr-o6, v1.2.2, fixed bug with opening TW after deleting themepacks. (Saq)\n* 26-Apr-06, v1.2.1, more code optimization, dropdowns now updated on the fly. (Saq)\n* 25-Apr-06, v1.2.0, added 3rd party ThemePack support, and made various other improvements.(Simon & Saq)\n* 24-Apr-06, v1.1.0, added: no styles and default styles options,<<br>>support for ThemePack, support for tag variations(Saq)\n* 21-Apr-06, v1.0.0, Reworked dropdowns to include option for pagetemplates (Saq)\n* 21-Apr-06, v0.9.0, Rewrote and added Saq's lovely dropdown select (Simon)\n* 20-Apr-06, v0.0.1, Basic switcher working (Simon)\n\n!Examples\n|!Source|!Output|h\n|{{{<<themeSelect style>>}}} for a dropdown with StyleSheets|<<themeSelect style>>|\n|{{{<<themeSelect pagetemplate>>}}} for a dropdown with PageTemplates|<<themeSelect pagetemplate>>|\n|{{{<<themeSelect style customlabel>>}}} to use a customlabel|<<themeSelect style customlabel>>|\n* When applying a stylesheet or template, it also looks for a template or stylesheet respectively based on naming convention, eg MyFunkyStyleSheet and MyFunkyPageTemplate.\n\n!Notes\n* See also http://www.tiddlytools.com/#SelectStyleSheetPlugin for a more feature-rich style sheet switcher\n\n! Ideas\n* do ViewTemplate also?\n* Pretty up the [x] bit\n\n!Code\n***/\n//{{{\n// for compatibility with TW <2.0.9\nif (!Array.prototype.contains)\n Array.prototype.contains = function(item)\n {\n return this.find(item) != null;\n };\n\n// for compatibility with TW <2.0.9\nif (!Array.prototype.containsAny)\n Array.prototype.containsAny = function(items)\n {\n for(var i=0; i<items.length; i++)\n if (this.contains(items[i]))\n return true;\n return false;\n };\n//}}}\n\n//{{{\nversion.extensions.SelectTheme = { major: 1, minor: 2, revision: 3, date: new Date(2006,5,15),\n source: "http://lewcid.googlepages.com/lewcid.html#SelectTheme"\n};\n\nconfig.SelectTheme = {\n things: {\n style: {\n tag: ["StyleSheets","StyleSheet","styleSheet","styleSheets","stylesheet","stylesheets"],\n theDefault: "StyleSheet",\n suffix: "StyleSheet",\n notify: refreshStyles,\n cookie: "txtStyleSheet",\n otherThing: "pagetemplate",\n label: "Choose StyleSheet: ",\n tooltip: "Choose a StyleSheet",\n caseNone: { text:"None", title:"NoStyleSheet"},\n caseDefault: { text:"Default", title:"StyleSheet" }\n\n },\n pagetemplate: {\n tag: ["PageTemplates","PageTemplate","pageTemplates","pageTemplate","pagetemplate","pagetemplates"],\n theDefault: "PageTemplate",\n suffix: "PageTemplate",\n notify: refreshPageTemplate,\n cookie: "txtPageTemplate",\n otherThing: "style",\n label: "Choose PageTemplate: ",\n tooltip: "Choose a PageTemplate",\n caseNone: { text:"None", title:"NoPageTemplate"},\n caseDefault: { text:"Default", title:"PageTemplate" }\n }\n\n },\n\n specialCases: ["caseNone","caseDefault"]\n\n};\n\nTiddlyWiki.prototype.removeNotification = function(title,fn) {\n for (var i=0;i<this.namedNotifications.length;i++)\n if((this.namedNotifications[i].name == title) && (this.namedNotifications[i].notify == fn))\n this.namedNotifications.splice(i,1); // counting on it only being there once\n}\n\n\nvar things = config.SelectTheme.things;\nvar specialCases=config.SelectTheme.specialCases;\n\nfor (var t in things) {\n // make sure we have a value\n if (!config.options[things[t].cookie])\n config.options[things[t].cookie] = things[t].theDefault;\n\n // remove core notify\n store.removeNotification(things[t].theDefault,things[t].notify);\n\n // and add our one\n store.addNotification(config.options[things[t].cookie],things[t].notify);\n\n}\n\n//checks to see if a tiddler exists in store or as a shadow.\nTiddlyWiki.prototype.isTiddler= function (title)\n {return store.tiddlerExists(title) || store.isShadowTiddler(title)}\n\n//hijack core function & make sure template exists\nwindow.applyPageTemplate_themeSelect=window.applyPageTemplate;\nwindow.applyPageTemplate=function(title){\n if(!store.isTiddler(title))\n {title = things.pagetemplate.theDefault;}\n applyPageTemplate_themeSelect(title);\n }\n\nTiddlyWiki.prototype.makeActiveTheme = function(what,title,alsoCheckOtherThing) {\n\n var thing = things[what];\n if (!store.isTiddler(title))\n title = thing.theDefault;\n\n var oldTitle = config.options[thing.cookie];\n\n if (what == "style") {\n // remove old style element from DOM\n var oldStyleElement = document.getElementById(oldTitle);\n oldStyleElement.parentNode.removeChild(oldStyleElement);\n }\n\n store.removeNotification(oldTitle,thing.notify);\n store.addNotification(title,thing.notify);\n store.notify(title);\n\n config.options[thing.cookie] = title;\n saveOptionCookie(thing.cookie);\n if (alsoCheckOtherThing)\n this.makeActiveTheme(thing.otherThing,\n title.replace(new RegExp(thing.suffix+"$"),"") + things[thing.otherThing].suffix,\n false);\n};\n\n\nconfig.shadowTiddlers.NoStyleSheet = "";\nconfig.shadowTiddlers.NoPageTemplate = config.shadowTiddlers.PageTemplate;\n\n\nfunction switchTheme(e){\n if (!e) var e = window.event;\n var theTarget = resolveTarget(e);\n var theLink = theTarget;\n var switchTo= theLink.getAttribute("switchTo");\n var mode = theLink.getAttribute("mode");\n if ((config.options[things[mode].cookie])!=switchTo)\n {store.makeActiveTheme(mode,switchTo,true);};\n return(false);\n}\n\n\nconfig.macros.themeSelect={};\nconfig.macros.themeSelect.dropdownchar = (document.all?"▼":"▾");\nconfig.macros.themeSelect.handler = function(place,macroName,params,wikifier,paramString,tiddler){\n var arrow = config.macros.themeSelect.dropdownchar;\n var mode = params[0];\n var label = (params[1]?params[1]:things[mode].label) + arrow;\n var cookie = (config.options[things[mode].cookie]);\n\n var onclick = function(e)\n { if (!e) var e = window.event;\n var popup = Popup.create(this);\n\n var tagged=[];\n\n store.forEachTiddler(function(title,tiddler) {\n if ((tiddler.tags).containsAny(things[mode].tag)){\n tagged.push(tiddler.title);}\n });\n\n //integrate ThemePacks\n if (config.themes) {\n // see what themes have been loaded...\n for (var i=0;i<config.themes.length;i++) {\n // see if there is one\n var lookForThis = config.themes[i] + things[mode].suffix;\n if (store.isShadowTiddler(lookForThis)) {\n tagged.pushUnique(lookForThis);\n }\n }\n tagged = tagged.sort();\n }\n\n //this function used later to create buttons\n var createThemeButton = function(switchTo){\n var theButton = createTiddlyButton(createTiddlyElement(popup,"li"),text,null,switchTheme,useClass);\n theButton.setAttribute("switchTo",switchTo);\n theButton.setAttribute("mode",mode);};\n\n //create Buttons for None(shadow styles) & Default (StyleSheet)\n // Default button is not created if StyleSheet doesnt exist.\n for(var t=0; t<specialCases.length; t++){\n var special = specialCases[t];\n var text = things[mode][special].text;\n var useClass = "tiddlyLinkExisting"; //redundant, optimize!\n if ((things[mode][special].title==cookie)||(special=="caseNone"&&!store.isTiddler(cookie)))\n {text+= " [x]";\n useClass = "currentlySelected";}\n if (!((special=="caseDefault")&&(!store.getTiddler(things[mode][special].title))))\n createThemeButton(things[mode][special].title); }\n\n //insert horizontal rule\n createTiddlyElement(createTiddlyElement(popup,"li"),"hr");\n\n //create buttons for all other stylesheet tiddlers\n for(var t=0; t<tagged.length; t++)\n { var useClass = "tiddlyLinkExisting";\n var text = (tagged[t]).replace((things[mode].suffix),"");\n if (tagged[t]==(cookie) )\n {text+=" [x]"; useClass="currentlySelected";}\n if ((tagged[t]!= (things[mode].theDefault))&&tagged[t]!= (things[mode].none))\n {createThemeButton(tagged[t]);}}\n Popup.show(popup,false);\n e.cancelBubble = true;\n if (e.stopPropagation)\n e.stopPropagation();\n return(false);\n };\n\n var createdropperButton = function(place){\n var sp = createTiddlyElement(place,"span",null,"ThemeChooserButton");\n var theDropDownBtn = createTiddlyButton(sp,label,things[mode].tooltip,onclick);\n };\n\n createdropperButton(place);\n};\n\n\nsetStylesheet(".popup li a.currentlySelected {background:#ccc;color:black;font-weight:bold;}","currentlySelectedStyle"); // could do better probably...\n\nconfig.macros.layoutChooser=config.macros.themeSelect;\n\n//shadow tiddler to hold instructions for creating ThemePacks\nconfig.shadowTiddlers.ThemePack='See http://simonbaird.com/mptw/#CreateThemePack'; \n\nconfig.macros.applyTheme = {handler: function (place,macroName,params,wikifier,paramString,tiddler) {\n var theme = params[0];\n var label = params[1]?params[1]:'Apply theme "' + theme + '"';\n var tooltip = 'Apply the "'+theme+'" theme to this TiddlyWiki';\n createTiddlyButton(place,label,tooltip,function() {\n store.makeActiveTheme("style",theme+things.style.suffix,true);\n });\n}};\n\n\n// this means you can put #theme:ThemeName in url. suggested by Clint\nconfig.paramifiers.theme = {\n onstart: function(themeName) {\n store.makeActiveTheme("style",themeName+config.SelectTheme.things.style.suffix,true);\n }\n};\n\n//}}}\n\n
[[Swamp post.|http://www.theswamp.org/index.php?topic=7400.msg92366#msg92366]]\n\n{{{\n(defun SetProjectPath ( Name Path )\n ;; if it exists it overwrites the path,\n ;; otherwise it creates the entry\n ;; path is a semi colon delimited string\n ;; no hand holding, caller's responsibility\n ;; to use properly \n (vla-setprojectfilepath\n (vla-get-files\n (vla-get-preferences\n (vlax-get-acad-object)\n )\n )\n Name\n Path\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=9239.msg119269#msg119269]]\n\n{{{\n(defun SetSupportPath ( path )\n (vla-put-SupportPath\n (vla-get-Files\n (vla-get-Preferences\n (vlax-get-acad-object)\n )\n )\n path\n )\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7962.msg101294#msg101294]]\n\nI don't use it that often. When I do it's when I pass a parameter quoted and want to mimic pass by reference / pointer (very infrequent) or want to set a series of variables to values in a list, for example coordinates.\n\nSimplified examples ...\n\n{{{\n(defun foo ( QuotedArgument )\n (set QuotedArgument 42)\n)\n\n(setq x 0)\n\n(foo 'x)\n\n!x => 42\n\n(mapcar 'set '(x y z) '(1 2 3))\n\n!x => 1\n!y => 2\n!z => 3\n}}}
<<search>><<closeAll>><<permaview>><<newTiddler>><<newJournal 'DD MMM YYYY'>><<saveChanges>><<upload http://cadlabs.tiddlyspot.com/store.cgi index.html . . cadlabs>><html><a href='http://tiddlyspot.com/download/cadlabs' class='button'>download</a></html><<slider chkSliderOptionsPanel OptionsPanel 'options »' 'Change TiddlyWiki advanced options'>>
/***\n''Single Page Mode Plugin for TiddlyWiki version 2.0 or above''\n^^author: Eric Shulman - ELS Design Studios\nsource: http://www.TiddlyTools.com/#SinglePageModePlugin\nlicense: [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]^^\n\nNormally, as you click on the links in TiddlyWiki, more and more tiddlers are displayed on the page. The order of this tiddler display depends upon when and where you have clicked. Some people like this non-linear method of reading the document, while others have reported that when many tiddlers have been opened, it can get somewhat confusing.\n\n!!!!!Usage\n<<<\nSinglePageMode allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one item displayed at a time. You can select a checkbox in the AdvancedOptions tiddler to enable this behavior or revert to the standard TiddlyWiki multiple tiddler display behavior.\n\nWhen SinglePageMode is enabled, the title of the current tiddler is automatically displayed in the browser window's titlebar and the browser's location URL is updated with a 'permalink' for the current tiddler so that it is easier to create a browser 'bookmark' for the current tiddler.\n\n//Note: This feature currently effects ALL tiddler display behavior, including features that normally result in multiple tiddlers being displayed, such as the results of searches or the initial DefaultTiddlers shown when the document is loaded. //\n<<<\n!!!!!Configuration\n<<<\nWhen installed, this plugin automatically adds a checkbox in the AdvancedOptions tiddler so you can enable/disable the plugin behavior. You can also use the following ''control panel'' checkbox to change the current plugin handling:\n\n<<option chkSinglePageMode>> Display one tiddler at a time\n<<<\n!!!!!Installation\n<<<\nimport (or copy/paste) the following tiddlers into your document:\n''SinglePageModePlugin'' (tagged with <<tag systemConfig>>)\n^^documentation and javascript for SinglePageMode handling^^\n\nWhen installed, this plugin automatically adds a checkbox in the AdvancedOptions tiddler so you can enable/disable this behavior. However, if you have customized your AdvancedOptions, you will need to manually add ''"<< {{{option chkSinglePageMode}}} >> display one tiddler at a time"'' to your customized tiddler.\n<<<\n!!!!!Revision History\n<<<\n''2006.02.04 [2.1.1]''\nmoved global variable declarations to config.* to avoid FireFox 1.5.0.1 crash bug when assigning to globals\n''2005.12.27 [2.1.0]''\nhijack displayTiddlers() so that SPM can be suspended during startup while displaying the DefaultTiddlers (or #hash list) \nalso, corrected initialization for undefined SPM flag to "false", so default behavior is to display multiple tiddlers\n''2005.12.27 [2.0.0]''\nUpdate for TW2.0\n''2005.11.24 [1.1.2]''\nWhen the back and forward buttons are used, the page now changes to match the URL. Based on code added by Clint Checketts\n''2005.10.14 [1.1.1]''\npermalink creation now calls encodeTiddlyLink() to handle tiddler titles with spaces in them\n''2005.10.14 [1.1.0]''\nadded automatic setting of window title and location bar ('auto-permalink').\nfeature suggestion by David Dickens.\n''2005.10.09 [1.0.1]''\ncombined documentation and code in a single tiddler\n''2005.08.15 [1.0.0]''\nInitial Release\n<<<\n!!!!!Credits\n<<<\nThis feature was developed by EricShulman from [[ELS Design Studios|http:/www.elsdesign.com]].\nSupport for BACK/FORWARD buttons adapted from code developed by Clint Checketts\n<<<\n!!!!!Code\n***/\n//{{{\nversion.extensions.SinglePageMode= {major: 2, minor: 1, revision: 1, date: new Date(2006,2,4)};\n\nif (config.options.chkSinglePageMode==undefined)\n config.options.chkSinglePageMode=false;\n\nconfig.shadowTiddlers.AdvancedOptions\n += "\sn<<option chkSinglePageMode>> Display one tiddler at a time";\n\nconfig.SPMTimer = 0;\nconfig.lastURL = window.location.hash;\nfunction checkLastURL()\n{\n if (!config.options.chkSinglePageMode)\n { window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }\n if (config.lastURL == window.location.hash)\n return;\n var tiddlerName = convertUTF8ToUnicode(decodeURI(window.location.hash.substr(1)));\n tiddlerName=tiddlerName.replace(/\s[\s[/,"").replace(/\s]\s]/,""); // strip any [[ ]] bracketing\n if (tiddlerName.length) story.displayTiddler(null,tiddlerName,1,null,null);\n}\n\nStory.prototype.coreDisplayTiddler=Story.prototype.displayTiddler;\nStory.prototype.displayTiddler = function(srcElement,title,template,animate,slowly)\n{\n if (config.options.chkSinglePageMode) {\n window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));\n config.lastURL = window.location.hash;\n document.title = wikifyPlain("SiteTitle") + " - " + title;\n story.closeAllTiddlers();\n if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);\n }\n this.coreDisplayTiddler(srcElement,title,template,animate,slowly)\n}\n\nStory.prototype.coreDisplayTiddlers=Story.prototype.displayTiddlers;\nStory.prototype.displayTiddlers = function(srcElement,titles,template,unused1,unused2,animate,slowly)\n{\n // suspend single-page mode when displaying multiple tiddlers\n var save=config.options.chkSinglePageMode;\n config.options.chkSinglePageMode=false;\n this.coreDisplayTiddlers(srcElement,titles,template,unused1,unused2,animate,slowly);\n config.options.chkSinglePageMode=save;\n}\n//}}}
<<listTagsReversed Blogs>>
A small grab bag of tips, tools and references for ~AutoCAD programmers.
[[cadlabs.com]]
http://www.cadlabs.com
<<slider 101 [[AddXDictToEntity]] "AddXDictToEntity" >>\n<<slider 102 [[ApplyOhMy]] "ApplyOhMy" >>\n<<slider 103 [[AxProps]] "AxProps" >>\n<<slider 104 [[Benchmark]] "Benchmark" >>\n<<slider 105 [[Bicursion]] "Bicursion" >>\n<<slider 106 [[Combinations]] "Combinations" >>\n<<slider 107 [[Counts]] "Counts" >>\n<<slider 108 [[DblClickToggle]] "DblClickToggle" >>\n<<slider 109 [[DistanceOf]] "DistanceOf" >>\n<<slider 110 [[DumpAttribs]] "DumpAttribs" >>\n<<slider 111 [[ForEachObject]] "ForEachObject" >>\n<<slider 112 [[GetLayersFrozenInVP]] "GetLayersFrozenInVP" >>\n<<slider 113 [[GetOrAddDict]] "GetOrAddDict" >>\n<<slider 114 [[GetXclip]] "GetXclip" >>\n<<slider 115 [[GetXrefsAttachState]] "GetXrefsAttachState" >>\n<<slider 116 [[GetXrefsProperties]] "GetXrefsProperties" >>\n<<slider 117 [[GobalsOhMy]] "GobalsOhMy" >>\n<<slider 118 [[GrVectorsGetPoint]] "GrVectorsGetPoint" >>\n<<slider 119 [[GrVectorsGetPointScaled]] "GrVectorsGetPointScaled" >>\n<<slider 120 [[HiRes]] "HiRes" >>\n<<slider 121 [[IsFolderWriteable]] "IsFolderWriteable" >>\n<<slider 122 [[KeepObjects]] "KeepObjects" >>\n<<slider 123 [[LayerMods]] "LayerMods" >>\n<<slider 124 [[LayerProperties]] "LayerProperties" >>\n<<slider 125 [[LoRes]] "LoRes" >>\n<<slider 126 [[LoadSupport]] "LoadSupport" >>\n<<slider 127 [[MapcarLambdaOhMy]] "MapcarLambdaOhMy" >>\n<<slider 128 [[RemoveNth]] "RemoveNth" >>\n<<slider 129 [[SSBoundingBox]] "SSBoundingBox" >>\n<<slider 130 [[SelectItem]] "SelectItem" >>\n<<slider 131 [[SetVersusSetQ]] "SetVersusSetQ" >>\n<<slider 132 [[StringPadding]] "StringPadding" >>\n<<slider 133 [[TileMode]] "TileMode" >>\n<<slider 134 [[ToString]] "ToString" >>\n<<slider 135 [[Typos]] "Typos" >>\n<<slider 136 [[UnHexifyUrl]] "UnHexifyUrl" >>\n<<slider 137 [[ZoomSS]] "ZoomSS" >>
[img[http://cadlabs.com/images/smiley.gif]]
[[Swamp post.|http://www.theswamp.org/index.php?topic=9645.msg123716;topicseen#msg123716]]\n\n{{{\n(defun c:SIP ( )\n ;; cycle snapisopair variable \n ;; to next appropriate value\n ;; in the series \n (setvar "snapisopair"\n (nth\n (getvar "snapisopair") \n '(1 2 0)\n )\n )\n (princ)\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7806.msg99009#msg99009]]\n\nIn the noted swamp post I attempted to illuminate what the vl-some and vl-every functions do. Here's the code --\n\n''Some'' --\n\n{{{\n(defun Some ( foop lst / result )\n (if (listp foop) (setq foop (eval foop)))\n (vl-catch-all-apply\n '(lambda ( )\n (foreach x lst\n (if (foop x)\n (progn\n (setq result t)\n (exit)\n )\n )\n )\n ) \n )\n result\n)\n}}}\n\nExample --\n\n{{{\n(Some\n '(lambda (x) (eq 'str (type x)))\n '("a" "b" 42 "d" "e")\n)\n}}}\n\nSee related article -- [[Every]].
TiddlyWiki now defines a small number of SpecialTags that are used to indicate that tiddlers should be treated differently in some way:\n* ''excludeSearch'': excludes a tiddler from search results\n* ''excludeLists'': excludes a tiddler from the lists in the sidebar tabs\n* ''systemTiddler'': marks tiddlers whose content is used to create paraphernalia like the main menu, title and sidebar. These tiddlers are included if you use the SaveEmptyTemplate option\n* ''systemConfig'': marks tiddlers that contain JavaScript that should be executed once TiddlyWiki has loaded
[[SwampDiscussion|http://www.theswamp.org/index.php?topic=7389.msg92169#msg92169]].\n\nTwo functions to pad a string with leading or trailing characters respectively. Patterned after Visual BASIC's ~LSet and ~RSet functions; a throwback to yesteryear.\n\n{{{\n(defun LSet ( text padchars maxlen )\n (substr\n ( (lambda ( )\n (while \n (<\n (strlen (setq padchars (strcat padchars padchars)))\n maxlen\n )\n )\n (strcat text padchars)\n )\n )\n 1\n maxlen\n )\n)\n}}}\n{{{\n(defun RSet ( text padchars maxlen )\n (substr\n ( (lambda ( )\n (while \n (<\n (strlen (setq padchars (strcat padchars padchars)))\n maxlen\n )\n )\n (setq text (strcat padchars text))\n )\n )\n (- (strlen text) (1- maxlen))\n )\n)\n}}}
/*{{{*/\n\nbody {\n font-size: 0.8em;\n /*font-family: "Sans Serif","Lucida Sans","Lucida Console","courier new",arial,helvetica;*/\n font-family: arial,helvetica;\n/*\n position: relative;\n margin: 0;\n padding: 0;\n*/\n}\n\n#mainMenu {\n/*\n position: absolute;\n left: 0;\n text-align: right;\n line-height: 1.6em;\n*/\n padding: 1.0em 0.5em 0.5em 0.5em;\n width: 12.8em;\n font-size: 0.9em; /*0.75em;*/\n}\n\n.tiddler .button {\n /*padding: 0.2em 0.4em;*/\n}\n\n.viewer {\n background: #f6f6f6; /* #f8f8f8; #f1f6ff; #f8f8f8; #f2f2f2; #8cf; fe8*/\n border: 1px solid #cccccc; /* #b4c5f0; #cccccc; */\n padding-top: 0.25em;\n padding-bottom: 0.25em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n}\n\n.viewer pre {\n border: 1px solid #ffcd91; /*#ffca7c; #ffca7c; #fe8;*/\n background: #fff8e1; /* #fff3c4; #fff3c4; #ffc;*/\n margin-left 0;\n margin-right 0;\n margin-top 0;\n margin-bottom 0;\n padding-left 0;\n padding-right 0;\n padding-top 0;\n padding-bottom 0;\n}\n\n.viewer code {\n color: #703;\n}\n\n.toolbar {\n background: #dddddd; /*#f8f8f8;*/\n}\n\n.viewer .button {\n border: 1px solid #18f; /*db4;*/\n}\n\n.button:hover {\n color: #014;\n background: #8cf; /*fe8*/\n border-color: #18f; /*db4*/\n}\n\n.button:active {\n color: #fff;\n background: #18cf; /*db4*/\n border: 1px solid #18f; /*841*/\n}\n\n/*}}}*/
/***\n!Colors Used\n*@@bgcolor(#8cf): #8cf - Background blue@@\n*@@bgcolor(#18f): #18f - Top blue@@\n*@@bgcolor(#04b): #04b - Mid blue@@\n*@@bgcolor(#014):color(#fff): #014 - Bottom blue@@\n*@@bgcolor(#ffc): #ffc - Bright yellow@@\n*@@bgcolor(#fe8): #fe8 - Highlight yellow@@\n*@@bgcolor(#db4): #db4 - Background yellow@@\n*@@bgcolor(#841): #841 - Border yellow@@\n*@@bgcolor(#703):color(#fff): #703 - Title red@@\n*@@bgcolor(#866): #866 - Subtitle grey@@\n!Generic Rules /%==============================================%/\n***/\n/*{{{*/\nbody {\n background: #fff;\n color: #000;\n}\n\na {\n color: #04b;\n}\n\na:hover {\n background: #04b;\n color: #fff;\n}\n\na img {\n border: 0;\n}\n\nh1,h2,h3,h4,h5 {\n color: #703;\n background: #8cf;\n}\n\n.button {\n color: #014;\n border: 1px solid #fff;\n}\n\n.button:hover {\n color: #014;\n background: #fe8;\n border-color: #db4;\n}\n\n.button:active {\n color: #fff;\n background: #db4;\n border: 1px solid #841;\n}\n\n/*}}}*/\n/***\n!Header /%==================================================%/\n***/\n/*{{{*/\n.header {\n background: #04b;\n}\n\n.headerShadow {\n color: #000;\n}\n\n.headerShadow a {\n font-weight: normal;\n color: #000;\n}\n\n.headerForeground {\n color: #fff;\n}\n\n.headerForeground a {\n font-weight: normal;\n color: #8cf;\n}\n\n/*}}}*/\n/***\n!General tabs /%=================================================%/\n***/\n/*{{{*/\n\n.tabSelected {\n color: #014;\n background: #eee;\n border-left: 1px solid #ccc;\n border-top: 1px solid #ccc;\n border-right: 1px solid #ccc;\n}\n\n.tabUnselected {\n color: #fff;\n background: #999;\n}\n\n.tabContents {\n color: #014;\n background: #eee;\n border: 1px solid #ccc;\n}\n\n.tabContents .button {\n border: 0;\n}\n\n/*}}}*/\n/***\n!Sidebar options /%=================================================%/\n~TiddlyLinks and buttons are treated identically in the sidebar and slider panel\n***/\n/*{{{*/\n#sidebar {\n}\n\n#sidebarOptions input {\n border: 1px solid #04b;\n}\n\n#sidebarOptions .sliderPanel {\n background: #8cf;\n}\n\n#sidebarOptions .sliderPanel a {\n border: none;\n color: #04b;\n}\n\n#sidebarOptions .sliderPanel a:hover {\n color: #fff;\n background: #04b;\n}\n\n#sidebarOptions .sliderPanel a:active {\n color: #04b;\n background: #fff;\n}\n/*}}}*/\n/***\n!Message Area /%=================================================%/\n***/\n/*{{{*/\n#messageArea {\n border: 1px solid #841;\n background: #db4;\n color: #014;\n}\n\n#messageArea .button {\n padding: 0.2em 0.2em 0.2em 0.2em;\n color: #014;\n background: #fff;\n}\n\n/*}}}*/\n/***\n!Popup /%=================================================%/\n***/\n/*{{{*/\n.popup {\n background: #18f;\n border: 1px solid #04b;\n}\n\n.popup hr {\n color: #014;\n background: #014;\n border-bottom: 1px;\n}\n\n.popup li.disabled {\n color: #04b;\n}\n\n.popup li a, .popup li a:visited {\n color: #eee;\n border: none;\n}\n\n.popup li a:hover {\n background: #014;\n color: #fff;\n border: none;\n}\n/*}}}*/\n/***\n!Tiddler Display /%=================================================%/\n***/\n/*{{{*/\n.tiddler .defaultCommand {\n font-weight: bold;\n}\n\n.shadow .title {\n color: #866;\n}\n\n.title {\n color: #703;\n}\n\n.subtitle {\n color: #866;\n}\n\n.toolbar {\n color: #04b;\n}\n\n.tagging, .tagged {\n border: 1px solid #eee;\n background-color: #eee;\n}\n\n.selected .tagging, .selected .tagged {\n background-color: #ddd;\n border: 1px solid #bbb;\n}\n\n.tagging .listTitle, .tagged .listTitle {\n color: #014;\n}\n\n.tagging .button, .tagged .button {\n border: none;\n}\n\n.footer {\n color: #ddd;\n}\n\n.selected .footer {\n color: #888;\n}\n\n.sparkline {\n background: #8cf;\n border: 0;\n}\n\n.sparktick {\n background: #014;\n}\n\n.errorButton {\n color: #ff0;\n background: #f00;\n}\n\n.cascade {\n background: #eef;\n color: #aac;\n border: 1px solid #aac;\n}\n\n.imageLink, #displayArea .imageLink {\n background: transparent;\n}\n\n/*}}}*/\n/***\n''The viewer is where the tiddler content is displayed'' /%------------------------------------------------%/\n***/\n/*{{{*/\n\n.viewer .listTitle {list-style-type: none; margin-left: -2em;}\n\n.viewer .button {\n border: 1px solid #db4;\n}\n\n.viewer blockquote {\n border-left: 3px solid #666;\n}\n\n.viewer table {\n border: 2px solid #333;\n}\n\n.viewer th, thead td {\n background: #db4;\n border: 1px solid #666;\n color: #fff;\n}\n\n.viewer td, .viewer tr {\n border: 1px solid #666;\n}\n\n.viewer pre {\n border: 1px solid #fe8;\n background: #ffc;\n}\n\n.viewer code {\n color: #703;\n}\n\n.viewer hr {\n border: 0;\n border-top: dashed 1px #666;\n color: #666;\n}\n\n.highlight, .marked {\n /*========== edited by MichaelPuckett ==========*/ \n /*background: #fe8;*/\n /*background: #ffff00;*/\n background: #ffff80;\n}\n/*}}}*/\n/***\n''The editor replaces the viewer in the tiddler'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.editor input {\n border: 1px solid #04b;\n}\n\n.editor textarea {\n border: 1px solid #04b;\n width: 100%;\n}\n\n.editorFooter {\n color: #aaa;\n}\n\n/*}}}*/
/***\n!Sections in this Tiddler:\n*Generic rules\n**Links styles\n**Link Exceptions\n*Header\n*Main menu\n*Sidebar\n**Sidebar options\n**Sidebar tabs\n*Message area\n*Popup\n*Tabs\n*Tiddler display\n**Viewer\n**Editor\n*Misc. rules\n!Generic Rules /%==============================================%/\n***/\n/*{{{*/\nbody {\n font-size: .75em;\n font-family: arial,helvetica;\n position: relative;\n margin: 0;\n padding: 0;\n}\n\nh1,h2,h3,h4,h5 {\n font-weight: bold;\n text-decoration: none;\n padding-left: 0.4em;\n}\n\nh1 { font-size: 1.35em; }\nh2 { font-size: 1.25em; }\nh3 { font-size: 1.1em; }\nh4 { font-size: 1em; }\nh5 { font-size: .9em; }\n\nhr {\n height: 1px;\n}\n\na {\n text-decoration: none;\n}\n\nol { list-style-type: decimal }\nol ol { list-style-type: lower-alpha }\nol ol ol { list-style-type: lower-roman }\nol ol ol ol { list-style-type: decimal }\nol ol ol ol ol { list-style-type: lower-alpha }\nol ol ol ol ol ol { list-style-type: lower-roman }\nol ol ol ol ol ol ol { list-style-type: decimal }\n/*}}}*/\n/***\n''General Link Styles'' /%-----------------------------------------------------------------------------%/\n***/\n/*{{{*/\n.externalLink {\n text-decoration: underline;\n}\n\n.tiddlyLinkExisting {\n font-weight: bold;\n}\n\n.tiddlyLinkNonExisting {\n font-style: italic;\n}\n\n/* the 'a' is required for IE, otherwise it renders the whole tiddler a bold */\na.tiddlyLinkNonExisting.shadow {\n font-weight: bold;\n}\n/*}}}*/\n/***\n''Exceptions to common link styles'' /%------------------------------------------------------------------%/\n***/\n/*{{{*/\n\n#mainMenu .tiddlyLinkExisting, \n#mainMenu .tiddlyLinkNonExisting,\n#sidebarTabs .tiddlyLinkExisting,\n#sidebarTabs .tiddlyLinkNonExisting{\n font-weight: normal;\n font-style: normal;\n}\n\n/*}}}*/\n/***\n!Header /%==================================================%/\n***/\n/*{{{*/\n\n.header {\n position: relative;\n}\n\n.header a:hover {\n background: transparent;\n}\n\n.headerShadow {\n position: relative;\n padding: 4.5em 0em 1em 1em;\n left: -1px;\n top: -1px;\n}\n\n.headerForeground {\n position: absolute;\n padding: 4.5em 0em 1em 1em;\n left: 0px;\n top: 0px;\n}\n\n.siteTitle {\n font-size: 3em;\n}\n\n.siteSubtitle {\n font-size: 1.2em;\n}\n\n/*}}}*/\n/***\n!Main menu /%==================================================%/\n***/\n/*{{{*/\n#mainMenu {\n position: absolute;\n left: 0;\n /*========== ALTERED ==========*/\n /*width: 10em;*/\n width: 10em;\n /*text-align: right;*/\n text-align: right;\n line-height: 1.6em;\n padding: 1.5em 0.5em 0.5em 0.5em;\n font-size: 1.1em;\n}\n\n/*}}}*/\n/***\n!Sidebar rules /%==================================================%/\n***/\n/*{{{*/\n#sidebar {\n position: absolute;\n right: 3px;\n width: 16em;\n font-size: .9em;\n}\n/*}}}*/\n/***\n''Sidebar options'' /%----------------------------------------------------------------------------------%/\n***/\n/*{{{*/\n#sidebarOptions {\n padding-top: 0.3em;\n}\n\n#sidebarOptions a {\n margin: 0em 0.2em;\n padding: 0.2em 0.3em;\n display: block;\n}\n\n#sidebarOptions input {\n margin: 0.4em 0.5em;\n}\n\n#sidebarOptions .sliderPanel {\n margin-left: 1em;\n padding: 0.5em;\n font-size: .85em;\n}\n\n#sidebarOptions .sliderPanel a {\n font-weight: bold;\n display: inline;\n padding: 0;\n}\n\n#sidebarOptions .sliderPanel input {\n margin: 0 0 .3em 0;\n}\n/*}}}*/\n/***\n''Sidebar tabs'' /%-------------------------------------------------------------------------------------%/\n***/\n/*{{{*/\n\n#sidebarTabs .tabContents {\n width: 15em;\n overflow: hidden;\n}\n\n/*}}}*/\n/***\n!Message area /%==================================================%/\n***/\n/*{{{*/\n#messageArea {\n position:absolute; top:0; right:0; margin: 0.5em; padding: 0.5em;\n}\n\n*[id='messageArea'] {\n position:fixed !important; \n z-index:99;\n}\n\n.messageToolbar {\n display: block;\n text-align: right;\n}\n\n#messageArea a{\n text-decoration: underline;\n}\n/*}}}*/\n/***\n!Popup /%==================================================%/\n***/\n/*{{{*/\n.popup {\n font-size: .9em;\n padding: 0.2em;\n list-style: none;\n margin: 0;\n}\n\n.popup hr {\n display: block;\n height: 1px;\n width: auto;\n padding: 0;\n margin: 0.2em 0em;\n}\n\n.popup li.disabled {\n padding: 0.2em;\n}\n\n.popup li a{\n display: block;\n padding: 0.2em;\n}\n/*}}}*/\n/***\n!Tabs /%==================================================%/\n***/\n/*{{{*/\n.tabset {\n padding: 1em 0em 0em 0.5em;\n}\n\n.tab {\n margin: 0em 0em 0em 0.25em;\n padding: 2px;\n}\n\n.tabContents {\n padding: 0.5em;\n}\n\n.tabContents ul, .tabContents ol {\n margin: 0;\n padding: 0;\n}\n\n.txtMainTab .tabContents li {\n list-style: none;\n}\n\n.tabContents li.listLink {\n margin-left: .75em;\n}\n/*}}}*/\n/***\n!Tiddler display rules /%==================================================%/\n***/\n/*{{{*/\n#displayArea {\n margin: 1em 17em 0em 14em;\n}\n\n\n.toolbar {\n text-align: right;\n font-size: .9em;\n visibility: hidden;\n}\n\n.selected .toolbar {\n visibility: visible;\n}\n\n.tiddler {\n padding: 1em 1em 0em 1em;\n}\n\n.missing .viewer,.missing .title {\n font-style: italic;\n}\n\n.title {\n font-size: 1.6em;\n font-weight: bold;\n}\n\n.missing .subtitle {\n display: none;\n}\n\n.subtitle {\n font-size: 1.1em;\n}\n\n/* I'm not a fan of how button looks in tiddlers... */\n.tiddler .button {\n padding: 0.2em 0.4em;\n}\n\n.tagging {\n margin: 0.5em 0.5em 0.5em 0;\n float: left;\n display: none;\n}\n\n.isTag .tagging {\n display: block;\n}\n\n.tagged {\n margin: 0.5em;\n float: right;\n}\n\n.tagging, .tagged {\n font-size: 0.9em;\n padding: 0.25em;\n}\n\n.tagging ul, .tagged ul {\n list-style: none;margin: 0.25em;\n padding: 0;\n}\n\n.tagClear {\n clear: both;\n}\n\n.footer {\n font-size: .9em;\n}\n\n.footer li {\n display: inline;\n}\n/***\n''The viewer is where the tiddler content is displayed'' /%------------------------------------------------%/\n***/\n/*{{{*/\n* html .viewer pre {\n width: 99%;\n padding: 0 0 1em 0;\n}\n\n.viewer {\n line-height: 1.4em;\n padding-top: 0.5em;\n}\n\n.viewer .button {\n margin: 0em 0.25em;\n padding: 0em 0.25em;\n}\n\n.viewer blockquote {\n line-height: 1.5em;\n padding-left: 0.8em;\n margin-left: 2.5em;\n}\n\n.viewer ul, .viewer ol{\n margin-left: 0.5em;\n padding-left: 1.5em;\n}\n\n.viewer table {\n border-collapse: collapse;\n margin: 0.8em 1.0em;\n}\n\n.viewer th, .viewer td, .viewer tr,.viewer caption{\n padding: 3px;\n}\n\n.viewer pre {\n padding: 0.5em;\n margin-left: 0.5em;\n /*========== ALTERED ==========*/\n /*font-size: 1.2em;*/\n font-size: 1.0em;\n /*========== ALTERED ==========*/\n /*line-height: 1.4em;*/\n line-height: 1.2em;\n overflow: auto;\n}\n\n.viewer code {\n /*========== ALTERED ==========*/\n /*font-size: 1.2em;*/\n font-size: 1.0em;\n /*========== ALTERED ==========*/\n /*line-height: 1.4em;*/\n line-height: 1.2em;\n}\n/*}}}*/\n/***\n''The editor replaces the viewer in the tiddler'' /%------------------------------------------------%/\n***/\n/*{{{*/\n.editor {\n font-size: 1.1em;\n}\n\n.editor input, .editor textarea {\n display: block;\n width: 100%;\n font: inherit;\n}\n\n.editorFooter {\n padding: 0.25em 0em;\n font-size: .9em;\n}\n\n.editorFooter .button {\n padding-top: 0px; \n padding-bottom: 0px;\n}\n\n.fieldsetFix {border: 0;\n padding: 0;\n margin: 1px 0px 1px 0px;\n}\n/*}}}*/\n/***\n!Misc rules /%==================================================%/\n***/\n/*{{{*/\n.sparkline {\n line-height: 1em;\n}\n\n.sparktick {\n outline: 0;\n}\n\n.zoomer {\n font-size: 1.1em;\n position: absolute;\n padding: 1em;\n}\n\n.cascade {\n font-size: 1.1em;\n position: absolute;\n overflow: hidden;\n}\n/*}}}*/
Threads I want to read/respond to when I've the time.\n*[[Posting Coprighted Code.|http://www.theswamp.org/index.php?topic=9746.0]]\n*[[Database Design.|http://www.theswamp.org/index.php?topic=9774.0]]
''Swanson's Unwritten Rules''\n<<<\n#Learn to say, "I don't know." If used when appropriate, it will be used often.\n#It is easier to get into something than to get out of it.\n#If you are not criticized, you may not be doing much\n#Look for what is missing. Many know how to improve what's there; few can see what isn't there.\n#Presentation rule: When something appears on a slide presentation, assume the world knows about it and deal with it accordingly.\n#Work for a boss to whom you can tell it like it is. Remember, you can't pick your family, but you can pick your boss.\n#Constantly review developments to make sure that the actual benefits are what they were supposed to be. Avoid Newton's Law.\n#However menial and trivial your early assignments may appear, give them your best effort.\n#Persistence or tenacity is the disposition to persevere in spite of difficulties, discouragement or indifference. Don't be known as a good starter but a poor finisher!\n#In doing your project, don't wait for others; go after them and make sure it gets done.\n#Confirm the instructions you give others, and their commitments, in writing. Don't assume it will get done.\n#Don't be timid: Speak up, express yourself and promote your ideas.\n#Practice shows that those who speak the most knowingly and confidently often end up with the assignment to get the job done.\n#Strive for brevity and clarity in oral and written reports.\n#Be extremely careful in the accuracy of your statements.\n#Don't overlook the fact that you are working for a boss. Keep him or her informed. Whatever the boss wants, within the bounds of integrity, takes top priority.\n#Promises, schedules and estimates are important instruments in a well-run business. You must make promises — don't lean on the often-used phrase: "I can't estimate it because it depends on many uncertain factors."\n#Never direct a complaint to the top; a serious offense is to "cc" a person's boss on a copy of a complaint before the person has a chance to respond to the complaint.\n#When interacting with people outside the company, remember that you are always representing the company. Be especially careful of your commitments.\n#Cultivate the habit of boiling matters down to the simplest terms: the proverbial "elevator speech" is the best way.\n#Don't get excited in engineering emergencies: Keep your feet on the ground.\n#Cultivate the habit of making quick, clean-cut decisions.\n#When making decisions, the "pros" are much easier to deal with than the "cons." Your boss wants to see both.\n#Don't ever lose your sense of humor.\n#Have fun at what you do. It will be reflected in you work. No one likes a grump except another grump!\n#Treat the name of you company as if it were your own.\n#Beg for the bad news.\n#You remember 1/3 of what you read, 1/2 of what people tell you, but 100% of what you feel.\n#You can't polish a sneaker.\n#When facing issues or problems that are becoming drawn-out, "short them to the ground."\n#When faced with decisions, try to look at them as if you were one level up in the organization. Your perspective will change quickly.\n#A person who is nice to you but rude to the waiter, or to others, is not a nice person. (This rule never fails).\n#Never be afraid to try something new. Remember, an amateur built an ark that survived a flood while a large group of professionals built the Titanic!\nPostscript: The qualities of leadership boil down to confidence, dedication, integrity and love.\n\n[[Source.|http://www.usatoday.com/money/companies/management/2006-04-14-ceos-waiter-rule_x.htm]]
<<tabs tabCode\nVLISP "Visual LISP" ListVisualLISP\nVBASIC "Visual BASIC" ListVisualBASIC\nPython "Python" ListPython\n>>
<<tabs tabLinks\nAutoCAD AutoCAD ListAutoCADLinks\nPython Python ListPythonLinks\nVBASIC 'Visual BASIC' ListVisualBASICLinks\nVLISP 'Visual LISP' ListVisualLISPLinks\nWebDev 'Web Development' ListWebDevLinks\nGeneral General ListGeneralLinks\n>>
From http://www.tiddlywiki.com/#TaggingMacro --\n<<<\nThe TaggingMacro produces a list of links to tiddlers that carry the specified tag. If no tag is specified, it looks for tiddlers tagged with the name of the current tiddler. It looks like this:\n{{{\n<<tagging>>\n<<tagging TiddlerTitle>>\n}}}\nIn HTML, the list is formatted like so:\n{{{\n<ul>\n<li class="listTitle">List title label</li>\n<li><a class="tiddlyLink ..." href="javascript:;" onclick="..."\n refresh="link" tiddlyLink="ExampleOne">ExampleOne</a></li>\n</ul>\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7542.msg95132#msg95132]]\n\nI wanted a way to highlight defun lines so I came up with this simple strategy.\n\nIn your ''LISP.syn'' file change the ''~SingleCommentAlt'' line as shown --\n\n{{{\n[Syntax]\nNamespace1 = 6\nIgnoreCase = Yes\nInitKeyWordChars = A-Za-z0-9*$&:_'-\nKeyWordChars = A-Za-z0-9*$&:_<>'-\nBracketChars = ()\nOperatorChars = \n;; OperatorChars = -+/^=<>\nPreprocStart =\nSyntaxStart =\nSyntaxEnd =\nCommentStart = ;|\nCommentEnd = |;\nCommentStartAlt =\nCommentEndAlt = \nSingleComment = ;\nSingleCommentCol =\nSingleCommentAlt = (defun \nSingleCommentColAlt =\nStringStart = "\nStringEnd = "\nStringAlt =\nStringEsc = \s\nCharStart =\nCharEnd =\nCharEsc = \s\n}}}\n\nIn the ''Colors'' section of the ''LISP Document class'' (under Preferences) set the color as you see fit, for example --\n\n[img[http://cadlabs.com/images/textpadtip2.png]]\n\nResult --\n\n[img[http://cadlabs.com/images/textpadtip.png]]\n\nI like, thought you might too.\n\n:)
Excerpt from http://www.tiddlywiki.com/#Tiddler --\n<<<\nA 'Tiddler' is the name given to a unit of MicroContent in TiddlyWiki.
From http://www.tiddlywiki.com/#TiddlerComments --\n<<<\nTo hide text within a tiddler so that it is not displayed you can wrap it in {{{/%}}} and {{{%/}}}. It can be a useful trick for hiding drafts or annotating complex markup. Edit this tiddler to see an example.\n/%This text is not displayed\nuntil you try to edit %/
From http://www.tiddlytools.com --\n<<<\nTiddlyTools offers accessories, links and tutorials for readers, authors and developers of TiddlyWiki documents.
''From the developer's page --''\n<<<\nWelcome to [[TiddlyWiki|http://www.tiddlywiki.com]], a free micro content ~WikiWikiWeb created by ''Jeremy Ruston'' and a busy community of independent developers. It's written in HTML, CSS and ~JavaScript to run on any modern browser without needing any server side logic. It allows anyone to create personal self contained hypertext documents that can be posted to a web server, sent by email or kept on a USB thumb drive to make a wiki on a stick. It also makes a great guerilla wiki. This is revision <<version>> of [[TiddlyWiki|http://www.tiddlywiki.com]], and is published under an Open Source License.\n<<<\n''TiddlyWiki Discussion groups (on google) --''\n<<<\n[[General/User's discussions.|http://groups.google.com/group/TiddlyWiki]]\n[[Developer's discussions.|http://groups.google.com/group/TiddlyWikiDev]]\n[[Wish list discussions.|http://groups.google.com/group/TiddlyWikiRequests]]
http://www.tiddlywiki.com/dev -- the hacker's guide to TiddlyWiki.
Simple example of system variable toggling for variables that have only 2 possible values, 0 and 1 (typically off and on).\n\n{{{\n(defun c:TM ( )\n ;; toggle tilemode system variable\n (setvar "tilemode"\n (abs\n (1-\n (getvar "tilemode")\n )\n )\n )\n (princ)\n)\n}}}
[[Swamp post.|http://www.theswamp.org/index.php?topic=7201.msg90431#msg90431]]\n\n{{{\n(defun ToBinary ( integer / bit result )\n\n (setq bit -1)\n \n (repeat 8\n (setq result\n (cons\n (if\n (zerop \n (logand integer \n (expt 2 \n (setq bit \n (1+ bit)\n )\n )\n )\n )\n 0\n 1\n )\n result\n )\n )\n )\n\n result\n \n)\n}}}\n\nTest drive --\n\n{{{\n(ToBinary 42)\n}}}\n\nResult --\n\n{{{\n(0 0 1 0 1 0 1 0)\n}}}\n\nIf you wanted a string result --\n\n{{{\n(vl-list->string \n (mapcar\n '(lambda (digit) (+ 48 digit))\n (ToBinary 42)\n )\n)\n}}}\n\nOr, a different way to skin the cat --\n\n{{{\n(apply 'strcat \n (mapcar \n 'vl-prin1-to-string\n (ToBinary 42)\n )\n)\n}}}\n\nResult --\n\n{{{\n"00101010"\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4971.msg60001#msg60001]]\n\nA quick and dirty, general, all purpose function to force an item to a string.\n\n{{{\n(defun ToString ( x / typex )\n\n ;; convert item to a string, if x is a real use\n ;; the highest possible precision, if x is a\n ;; string double quote it, if x is a list process\n ;; each item in the list appropriatel, otherwise\n ;; just hammer item with vl-princ-to-string\n\n (cond\n\n ;; it's a string, return it double quoted\n\n ( (eq 'str (setq typex (type x)))\n\n (strcat "\s"" x "\s"")\n\n )\n\n ;; it's a real, covert to the highest possible\n ;; resolution string equivalent\n\n ( (eq 'real typex)\n \n (rtos x 2 (if (zerop (- x (fix x))) 1 15))\n\n )\n\n ;; it's a list\n\n ( (eq 'list typex)\n\n (if (vl-list-length x)\n\n ;; it's a normal list\n\n (strcat\n (chr 40)\n (ToString (car x))\n (apply 'strcat\n (mapcar\n '(lambda (x)\n (strcat " " (ToString x))\n )\n (cdr x)\n )\n )\n (chr 41)\n )\n\n ;; it's a dotted pair\n\n (strcat\n (chr 40)\n (ToString (car x))\n " . "\n (ToString (cdr x))\n (chr 41)\n )\n\n )\n\n )\n\n ;; hammer down on everything else\n\n ((vl-princ-to-string x))\n )\n)\n}}}\n/%(defun ToString ( x / typex )\n (cond\n ( (eq 'str (setq typex (type x)))\n (strcat "\s"" x "\s"")\n )\n ( (eq 'real typex)\n (rtos x 2 (if (zerop (- x (fix x))) 1 15))\n )\n ( (eq 'list typex)\n (strcat\n (chr 40)\n (if (vl-list-length x)\n (apply 'strcat\n (plaque " "\n (mapcar 'ToString x)\n )\n )\n (strcat\n (ToString (car x))\n " . "\n (ToString (cdr x))\n )\n )\n (chr 41)\n )\n )\n ((vl-princ-to-string x))\n )\n)%/
[[Swamp post.|http://www.theswamp.org/index.php?topic=6816.msg83896#msg83896]]\n\n{{{\n(defun c:ToggleTabs ( )\n ;; toggle model / layout tabs visiblity\n (vlax-put-property\n (vlax-get-property\n (vlax-get-property\n (vlax-get-acad-object)\n 'Preferences\n ) \n 'Display\n )\n 'DisplayLayoutTabs\n ( (lambda ( displayLayoutTabs )\n (if (eq :vlax-true displayLayoutTabs)\n :vlax-false\n :vlax-true\n )\n )\n (vlax-get-property\n (vlax-get-property\n (vlax-get-property\n (vlax-get-acad-object)\n 'Preferences\n ) \n 'Display\n )\n 'DisplayLayoutTabs\n )\n )\n )\n (princ)\n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=4974.0]]\n\n//Eh?//\n\nRemember this nonesence, typoglycemia?\n<<<\nI cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg The phaonmneal pweor of the hmuan mnid Aoccdrnig to rscheearch taem at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Such a cdonition is arppoiately cllaed Typoglycemia :)- Amzanig huh? Yaeh and yuo awlyas thought slpeling was ipmorantt!\n<<<\nWell, when you have insomnia and need something mindless and mildy interesting to keep from going mad you write crud like this --\n\n{{{\n(defun Typos ( text / scramble middle rotate main )\n\n (defun scramble ( codes )\n (if (< (length codes) 4)\n codes\n (append\n (list (car codes))\n (rotate (middle codes))\n (list (last codes))\n )\n )\n )\n \n (defun middle ( lst )\n (cdr\n (reverse\n (cdr\n (reverse lst)\n )\n )\n )\n )\n\n (defun rotate ( lst )\n (cons\n (last lst)\n (reverse \n (cdr \n (reverse lst)\n )\n )\n )\n )\n\n (defun main ( text / punc codes result )\n\n (setq punc\n (vl-string->list\n "\s".?!:-,;/()[]{}\sn\sr\st "\n )\n )\n\n (foreach code\n\n (reverse\n (vl-string->list\n (vl-string-trim\n " \st\sn"\n text\n )\n )\n )\n\n (cond\n ( (member code punc)\n (if codes\n (setq result\n (cons\n (scramble codes)\n result\n )\n codes nil\n )\n )\n (setq result\n (cons\n (list code)\n result\n )\n )\n )\n ( (setq codes\n (cons\n code\n codes\n )\n )\n )\n )\n )\n\n (vl-list->string\n (apply 'append\n (if codes\n (cons \n (scramble codes) \n result\n )\n result\n )\n )\n )\n )\n\n (main text)\n\n)\n}}}\n\n{{{\n(Typos "Now, whenever you feel the need to ...")\n}}}\n\nNow, wehenevr you feel the need to aonny yuor fdriens, or jsut slpel lkie Jhon, jsut psas yuor txet tghrouh tihs slimpe rnoutie!
[[Swamp post.|http://www.theswamp.org/index.php?topic=9114.msg117342#msg117342]]\n\n{{{\n(defun c:UCSClassic ( / _ForEachVP _DoIt _Main )\n\n (defun _ForEachVP (quoted_task / vps)\n \n (setq vps\n (apply 'append\n (mapcar\n '(lambda (x / v) (if (/= 1 (setq v (car x))) (list v)))\n (reverse (vports))\n )\n )\n )\n\n (if (eq 0 (getvar "tilemode"))\n (cond\n ( (eq 1 (getvar "cvport"))\n (cond\n ( vps\n (command ".mspace")\n (_ForEachVp quoted_task)\n (command ".pspace")\n )\n )\n )\n (\n (foreach x vps\n (setvar "cvport" x)\n (eval quoted_task)\n )\n )\n )\n (foreach x vps\n (setvar "cvport" x)\n (eval quoted_task)\n )\n )\n )\n\n (defun _DoIt ( / tilemode )\n \n (foreach x\n '("ucsortho" "ucsview" "ucsfollow" "ucsvp")\n (setvar x 0)\n )\n \n (_ForEachVP '(setvar "ucsvp" 0))\n \n (princ "\snUCSORTHO has been set to 0.")\n (princ "\snUCSVIEW has been set to 0.")\n (princ "\snUCSFOLLOW has been set to 0.")\n \n (princ\n (strcat\n "\snFor TILEMODE = "\n (itoa (setq tilemode (getvar "tilemode")))\n " UCSVP set to 0 (off) for each active viewport."\n )\n )\n \n (princ\n (strcat\n "\snFor TILEMODE = "\n (itoa (abs (1- tilemode)))\n " UCSVP remains unaltered for each viewport."\n )\n )\n )\n \n (defun _Main ( / cmdecho )\n \n (setq cmdecho (getvar "cmdecho"))\n\n (setvar "cmdecho" 0)\n\n (if (zerop (getvar "tilemode"))\n (cond\n ( (eq 1 (getvar "cvport"))\n (command ".zoom" "_extents")\n (command ".mspace")\n (_DoIt)\n (command ".pspace")\n (command ".zoom" "_previous")\n )\n ( t\n (command ".pspace")\n (command ".zoom" "_extents")\n (_DoIt)\n (command ".zoom" "_previous")\n (command ".mspace")\n )\n )\n (_DoIt)\n )\n\n (setvar "cmdecho" cmdecho)\n\n (princ)\n \n )\n \n (_Main)\n \n)\n}}}
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=2724.0]]\n\nA frequent ploy of spammers and their lot is to convert a url to the hexified version of a url which hides the name (or ip address) of a url.\n\nFor example,\n\nhttp://theswamp.org\n\ncan be represented by:\n\nhttp://%74%68%65%73%77%61%6D%70%2E%6F%72%67\n\nThe following code will accept a hexified url and return it unhexified:\n\n{{{\n(defun UnHexifyUrl ( HexUrl / lst x )\n ;; Written quick and dirty, but still:\n ;; Copyright © 2004 Michael Puckett\n (apply 'strcat\n (mapcar\n '(lambda (x)\n (if (eq 2 (strlen (setq x (vl-list->string x))))\n (chr\n (apply\n '(lambda (x/r) (setq r 0)\n (foreach n (vl-string->list (strcase x))\n (setq r\n (+ (- n (if (< n 65) 48 55))\n (* 16 r)\n )\n )\n )\n )\n (list x)\n )\n )\n x\n )\n )\n (progn\n (foreach n (reverse (vl-string->list HexUrl))\n (if (member n '(37 58))\n (setq\n lst (cons (if (eq n 58) (cons n x) x) lst)\n x nil\n )\n (setq x (cons n x))\n )\n )\n (cons x lst)\n )\n )\n )\n)\n}}}\n\nExample:\n\n{{{\n(UnHexifyUrl\n "http://%74%68%65%73%77%61%6D%70%2E%6F%72%67"\n)\n}}}\n\nReturns:\n\n"http://theswamp.org"\n\nCheers.\n\n:)
| !date | !user | !location | !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |\n| 20/8/2006 10:53:50 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 20/8/2006 10:57:53 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 20/8/2006 10:59:54 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 20/8/2006 11:11:13 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 20/8/2006 11:15:18 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 20/8/2006 11:16:54 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 20/8/2006 11:18:16 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 20/8/2006 11:19:34 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 20/8/2006 11:21:22 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 20/8/2006 11:26:21 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . |\n| 20/8/2006 11:26:57 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . | Ok |\n| 20/8/2006 11:33:54 | MP | [[cadlabs.html|file:///K:/tiddlyspot/cadlabs.html]] | [[store.cgi|http://cadlabs.tiddlyspot.com/store.cgi]] | . | index.html | . |
/***\n<<tiddler UploadPluginDoc>>\n!Code\n***/\n//{{{\nversion.extensions.UploadPlugin = {\n major: 3, minor: 3, revision: 3, \n date: new Date(2006,6,30),\n type: 'macro',\n source: 'http://tiddlywiki.bidix.info/#UploadPlugin',\n docs: 'http://tiddlywiki.bidix.info/#UploadPluginDoc'\n};\n//}}}\n\n////+++!![config.lib.file]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.file) config.lib.file= {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\nconfig.lib.file.dirname = function (filePath) {\n var lastpos;\n if ((lastpos = filePath.lastIndexOf("/")) != -1) {\n return filePath.substring(0, lastpos);\n } else {\n return filePath.substring(0, filePath.lastIndexOf("\s\s"));\n }\n};\nconfig.lib.file.basename = function (filePath) {\n var lastpos;\n if ((lastpos = filePath.lastIndexOf("#")) != -1) \n filePath = filePath.substring(0, lastpos);\n if ((lastpos = filePath.lastIndexOf("/")) != -1) {\n return filePath.substring(lastpos + 1);\n } else\n return filePath.substring(filePath.lastIndexOf("\s\s")+1);\n};\nwindow.basename = function() {return "@@deprecated@@";};\n//}}}\n////===\n\n////+++!![config.lib.log]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.log) config.lib.log= {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\nconfig.lib.Log = function(tiddlerTitle, logHeader) {\n if (version.major < 2)\n this.tiddler = store.tiddlers[tiddlerTitle];\n else\n this.tiddler = store.getTiddler(tiddlerTitle);\n if (!this.tiddler) {\n this.tiddler = new Tiddler();\n this.tiddler.title = tiddlerTitle;\n this.tiddler.text = "| !date | !user | !location |" + logHeader;\n this.tiddler.created = new Date();\n this.tiddler.modifier = config.options.txtUserName;\n this.tiddler.modified = new Date();\n if (version.major < 2)\n store.tiddlers[tiddlerTitle] = this.tiddler;\n else\n store.addTiddler(this.tiddler);\n }\n return this;\n};\n\nconfig.lib.Log.prototype.newLine = function (line) {\n var now = new Date();\n var newText = "| ";\n newText += now.getDate()+"/"+(now.getMonth()+1)+"/"+now.getFullYear() + " ";\n newText += now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+" | ";\n newText += config.options.txtUserName + " | ";\n var location = document.location.toString();\n var filename = config.lib.file.basename(location);\n if (!filename) filename = '/';\n newText += "[["+filename+"|"+location + "]] |";\n this.tiddler.text = this.tiddler.text + "\sn" + newText;\n this.addToLine(line);\n};\n\nconfig.lib.Log.prototype.addToLine = function (text) {\n this.tiddler.text = this.tiddler.text + text;\n this.tiddler.modifier = config.options.txtUserName;\n this.tiddler.modified = new Date();\n if (version.major < 2)\n store.tiddlers[this.tiddler.tittle] = this.tiddler;\n else {\n store.addTiddler(this.tiddler);\n story.refreshTiddler(this.tiddler.title);\n store.notify(this.tiddler.title, true);\n }\n if (version.major < 2)\n store.notifyAll(); \n};\n//}}}\n////===\n\n////+++!![config.lib.options]\n\n//{{{\nif (!config.lib) config.lib = {};\nif (!config.lib.options) config.lib.options = {\n author: 'BidiX',\n version: {major: 0, minor: 1, revision: 0}, \n date: new Date(2006,3,9)\n};\n\nconfig.lib.options.init = function (name, defaultValue) {\n if (!config.options[name]) {\n config.options[name] = defaultValue;\n saveOptionCookie(name);\n }\n};\n//}}}\n////===\n\n////+++!![PasswordTweak]\n\n//{{{\nversion.extensions.PasswordTweak = {\n major: 1, minor: 0, revision: 2, date: new Date(2006,3,11),\n type: 'tweak',\n source: 'http://tiddlywiki.bidix.info/#PasswordTweak'\n};\n//}}}\n/***\n!!config.macros.option\n***/\n//{{{\nconfig.macros.option.passwordCheckboxLabel = "Save this password on this computer";\nconfig.macros.option.passwordType = "password"; // password | text\n\nconfig.macros.option.onChangeOption = function(e)\n{\n var opt = this.getAttribute("option");\n var elementType,valueField;\n if(opt) {\n switch(opt.substr(0,3)) {\n case "txt":\n elementType = "input";\n valueField = "value";\n break;\n case "pas":\n elementType = "input";\n valueField = "value";\n break;\n case "chk":\n elementType = "input";\n valueField = "checked";\n break;\n }\n config.options[opt] = this[valueField];\n saveOptionCookie(opt);\n var nodes = document.getElementsByTagName(elementType);\n for(var t=0; t<nodes.length; t++) {\n var optNode = nodes[t].getAttribute("option");\n if (opt == optNode) \n nodes[t][valueField] = this[valueField];\n }\n }\n return(true);\n};\n\nconfig.macros.option.handler = function(place,macroName,params)\n{\n var opt = params[0];\n var size = 15;\n if (params[1])\n size = params[1];\n if(config.options[opt] === undefined) {\n return;}\n var c;\n switch(opt.substr(0,3)) {\n case "txt":\n c = document.createElement("input");\n c.onkeyup = this.onChangeOption;\n c.setAttribute ("option",opt);\n c.size = size;\n c.value = config.options[opt];\n place.appendChild(c);\n break;\n case "pas":\n // input password\n c = document.createElement ("input");\n c.setAttribute("type",config.macros.option.passwordType);\n c.onkeyup = this.onChangeOption;\n c.setAttribute("option",opt);\n c.size = size;\n c.value = config.options[opt];\n place.appendChild(c);\n // checkbox link with this password "save this password on this computer"\n c = document.createElement("input");\n c.setAttribute("type","checkbox");\n c.onclick = this.onChangeOption;\n c.setAttribute("option","chk"+opt);\n place.appendChild(c);\n c.checked = config.options["chk"+opt];\n // text savePasswordCheckboxLabel\n place.appendChild(document.createTextNode(config.macros.option.passwordCheckboxLabel));\n break;\n case "chk":\n c = document.createElement("input");\n c.setAttribute("type","checkbox");\n c.onclick = this.onChangeOption;\n c.setAttribute("option",opt);\n place.appendChild(c);\n c.checked = config.options[opt];\n break;\n }\n};\n//}}}\n/***\n!! Option cookie stuff\n***/\n//{{{\nwindow.loadOptionsCookie_orig_PasswordTweak = window.loadOptionsCookie;\nwindow.loadOptionsCookie = function()\n{\n var cookies = document.cookie.split(";");\n for(var c=0; c<cookies.length; c++) {\n var p = cookies[c].indexOf("=");\n if(p != -1) {\n var name = cookies[c].substr(0,p).trim();\n var value = cookies[c].substr(p+1).trim();\n switch(name.substr(0,3)) {\n case "txt":\n config.options[name] = unescape(value);\n break;\n case "pas":\n config.options[name] = unescape(value);\n break;\n case "chk":\n config.options[name] = value == "true";\n break;\n }\n }\n }\n};\n\nwindow.saveOptionCookie_orig_PasswordTweak = window.saveOptionCookie;\nwindow.saveOptionCookie = function(name)\n{\n var c = name + "=";\n switch(name.substr(0,3)) {\n case "txt":\n c += escape(config.options[name].toString());\n break;\n case "chk":\n c += config.options[name] ? "true" : "false";\n // is there an option link with this chk ?\n if (config.options[name.substr(3)]) {\n saveOptionCookie(name.substr(3));\n }\n break;\n case "pas":\n if (config.options["chk"+name]) {\n c += escape(config.options[name].toString());\n } else {\n c += "";\n }\n break;\n }\n c += "; expires=Fri, 1 Jan 2038 12:00:00 UTC; path=/";\n document.cookie = c;\n};\n//}}}\n/***\n!! Initializations\n***/\n//{{{\n// define config.options.pasPassword\nif (!config.options.pasPassword) {\n config.options.pasPassword = 'defaultPassword';\n window.saveOptionCookie('pasPassword');\n}\n// since loadCookies is first called befor password definition\n// we need to reload cookies\nwindow.loadOptionsCookie();\n//}}}\n////===\n\n////+++!![config.macros.upload]\n\n//{{{\nconfig.macros.upload = {\n accessKey: "U",\n formName: "UploadPlugin",\n contentType: "text/html;charset=UTF-8",\n defaultStoreScript: "store.php"\n};\n\n// only this two configs need to be translated\nconfig.macros.upload.messages = {\n aboutToUpload: "About to upload TiddlyWiki to %0",\n errorDownloading: "Error downloading",\n errorUploadingContent: "Error uploading content",\n fileNotFound: "file to upload not found",\n fileNotUploaded: "File %0 NOT uploaded",\n mainFileUploaded: "Main TiddlyWiki file uploaded to %0",\n urlParamMissing: "url param missing",\n rssFileNotUploaded: "RssFile %0 NOT uploaded",\n rssFileUploaded: "Rss File uploaded to %0"\n};\n\nconfig.macros.upload.label = {\n promptOption: "Save and Upload this TiddlyWiki with UploadOptions",\n promptParamMacro: "Save and Upload this TiddlyWiki in %0",\n saveLabel: "save to web", \n saveToDisk: "save to disk",\n uploadLabel: "upload" \n};\n\nconfig.macros.upload.handler = function(place,macroName,params){\n // parameters initialization\n var storeUrl = params[0];\n var toFilename = params[1];\n var backupDir = params[2];\n var uploadDir = params[3];\n var username = params[4];\n var password; // for security reason no password as macro parameter\n var label;\n if (document.location.toString().substr(0,4) == "http")\n label = this.label.saveLabel;\n else\n label = this.label.uploadLabel;\n var prompt;\n if (storeUrl) {\n prompt = this.label.promptParamMacro.toString().format([this.dirname(storeUrl)]);\n }\n else {\n prompt = this.label.promptOption;\n }\n createTiddlyButton(place, label, prompt, \n function () {\n config.macros.upload.upload(storeUrl, toFilename, uploadDir, backupDir, username, password); \n return false;}, \n null, null, this.accessKey);\n};\nconfig.macros.upload.UploadLog = function() {\n return new config.lib.Log('UploadLog', " !storeUrl | !uploadDir | !toFilename | !backupdir | !origin |" );\n};\nconfig.macros.upload.UploadLog.prototype = config.lib.Log.prototype;\nconfig.macros.upload.UploadLog.prototype.startUpload = function(storeUrl, toFilename, uploadDir, backupDir) {\n var line = " [[" + config.lib.file.basename(storeUrl) + "|" + storeUrl + "]] | ";\n line += uploadDir + " | " + toFilename + " | " + backupDir + " |";\n this.newLine(line);\n};\nconfig.macros.upload.UploadLog.prototype.endUpload = function() {\n this.addToLine(" Ok |");\n};\nconfig.macros.upload.basename = config.lib.file.basename;\nconfig.macros.upload.dirname = config.lib.file.dirname;\nconfig.macros.upload.upload = function(storeUrl, toFilename, uploadDir, backupDir, username, password)\n{\n // parameters initialization\n storeUrl = (storeUrl ? storeUrl : config.options.txtUploadStoreUrl);\n toFilename = (toFilename ? toFilename : config.options.txtUploadFilename);\n backupDir = (backupDir ? backupDir : config.options.txtUploadBackupDir);\n uploadDir = (uploadDir ? uploadDir : config.options.txtUploadDir);\n username = (username ? username : config.options.txtUploadUserName);\n password = config.options.pasUploadPassword; // for security reason no password as macro parameter\n if (storeUrl === '') {\n config.macros.upload.defaultStoreScript;\n }\n if (config.lib.file.dirname(storeUrl) === '') {\n storeUrl = config.lib.file.dirname(document.location.toString())+'/'+storeUrl;\n }\n if (toFilename === '') {\n toFilename = config.lib.file.basename(document.location.toString());\n }\n\n clearMessage();\n // only for forcing the message to display\n if (version.major < 2)\n store.notifyAll();\n if (!storeUrl) {\n alert(config.macros.upload.messages.urlParamMissing);\n return;\n }\n \n var log = new this.UploadLog();\n log.startUpload(storeUrl, toFilename, uploadDir, backupDir);\n if (document.location.toString().substr(0,5) == "file:") {\n saveChanges();\n }\n displayMessage(config.macros.upload.messages.aboutToUpload.format([this.dirname(storeUrl)]), this.dirname(storeUrl));\n this.uploadChanges(storeUrl, toFilename, uploadDir, backupDir, username, password);\n if(config.options.chkGenerateAnRssFeed) {\n //var rssContent = convertUnicodeToUTF8(generateRss());\n var rssContent = generateRss();\n var rssPath = toFilename.substr(0,toFilename.lastIndexOf(".")) + ".xml";\n this.uploadContent(rssContent, storeUrl, rssPath, uploadDir, '', username, password, \n function (responseText) {\n if (responseText.substring(0,1) != '0') {\n displayMessage(config.macros.upload.messages.rssFileNotUploaded.format([rssPath]));\n }\n else {\n if (uploadDir) {\n rssPath = uploadDir + "/" + config.macros.upload.basename(rssPath);\n } else {\n rssPath = config.macros.upload.basename(rssPath);\n }\n displayMessage(config.macros.upload.messages.rssFileUploaded.format(\n [config.macros.upload.dirname(storeUrl)+"/"+rssPath]), config.macros.upload.dirname(storeUrl)+"/"+rssPath);\n }\n // for debugging store.php uncomment last line\n //DEBUG alert(responseText);\n });\n }\n return;\n};\n\nconfig.macros.upload.uploadChanges = function(storeUrl, toFilename, uploadDir, backupDir, \n username, password) {\n var original;\n if (document.location.toString().substr(0,4) == "http") {\n original = this.download(storeUrl, toFilename, uploadDir, backupDir, username, password);\n return;\n }\n else {\n // standard way : Local file\n \n original = loadFile(getLocalPath(document.location.toString()));\n if(window.Components) {\n // it's a mozilla browser\n try {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]\n .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);\n converter.charset = "UTF-8";\n original = converter.ConvertToUnicode(original);\n }\n catch(e) {\n }\n }\n }\n //DEBUG alert(original);\n this.uploadChangesFrom(original, storeUrl, toFilename, uploadDir, backupDir, \n username, password);\n};\n\nconfig.macros.upload.uploadChangesFrom = function(original, storeUrl, toFilename, uploadDir, backupDir, \n username, password) {\n var startSaveArea = '<div id="' + 'storeArea">'; // Split up into two so that indexOf() of this source doesn't find it\n var endSaveArea = '</d' + 'iv>';\n // Locate the storeArea div's\n var posOpeningDiv = original.indexOf(startSaveArea);\n var posClosingDiv = original.lastIndexOf(endSaveArea);\n if((posOpeningDiv == -1) || (posClosingDiv == -1))\n {\n alert(config.messages.invalidFileError.format([document.location.toString()]));\n return;\n }\n var revised = original.substr(0,posOpeningDiv + startSaveArea.length) + \n allTiddlersAsHtml() + "\sn\st\st" +\n original.substr(posClosingDiv);\n var newSiteTitle;\n if(version.major < 2){\n newSiteTitle = (getElementText("siteTitle") + " - " + getElementText("siteSubtitle")).htmlEncode();\n } else {\n newSiteTitle = (wikifyPlain ("SiteTitle") + " - " + wikifyPlain ("SiteSubtitle")).htmlEncode();\n }\n revised = revised.replace(new RegExp("<title>[^<]*</title>", "im"),"<title>"+ newSiteTitle +"</title>");\n var response = this.uploadContent(revised, storeUrl, toFilename, uploadDir, backupDir, \n username, password, function (responseText) {\n if (responseText.substring(0,1) != '0') {\n alert(responseText);\n displayMessage(config.macros.upload.messages.fileNotUploaded.format([getLocalPath(document.location.toString())]));\n }\n else {\n if (uploadDir !== '') {\n toFilename = uploadDir + "/" + config.macros.upload.basename(toFilename);\n } else {\n toFilename = config.macros.upload.basename(toFilename);\n }\n displayMessage(config.macros.upload.messages.mainFileUploaded.format(\n [config.macros.upload.dirname(storeUrl)+"/"+toFilename]), config.macros.upload.dirname(storeUrl)+"/"+toFilename);\n var log = new config.macros.upload.UploadLog();\n log.endUpload();\n store.setDirty(false);\n }\n // for debugging store.php uncomment last line\n //DEBUG alert(responseText);\n }\n );\n};\n\nconfig.macros.upload.uploadContent = function(content, storeUrl, toFilename, uploadDir, backupDir, \n username, password, callbackFn) {\n var boundary = "---------------------------"+"AaB03x"; \n var request;\n try {\n request = new XMLHttpRequest();\n } \n catch (e) { \n request = new ActiveXObject("Msxml2.XMLHTTP"); \n }\n if (window.netscape){\n try {\n if (document.location.toString().substr(0,4) != "http") {\n netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');}\n }\n catch (e) { }\n } \n //DEBUG alert("user["+config.options.txtUploadUserName+"] password[" + config.options.pasUploadPassword + "]");\n // compose headers data\n var sheader = "";\n sheader += "--" + boundary + "\sr\snContent-disposition: form-data; name=\s"";\n sheader += config.macros.upload.formName +"\s"\sr\sn\sr\sn";\n sheader += "backupDir="+backupDir\n +";user=" + username \n +";password=" + password\n +";uploaddir=" + uploadDir\n + ";;\sr\sn"; \n sheader += "\sr\sn" + "--" + boundary + "\sr\sn";\n sheader += "Content-disposition: form-data; name=\s"userfile\s"; filename=\s""+toFilename+"\s"\sr\sn";\n sheader += "Content-Type: " + config.macros.upload.contentType + "\sr\sn";\n sheader += "Content-Length: " + content.length + "\sr\sn\sr\sn";\n // compose trailer data\n var strailer = new String();\n strailer = "\sr\sn--" + boundary + "--\sr\sn";\n var data;\n data = sheader + content + strailer;\n //request.open("POST", storeUrl, true, username, password);\n request.open("POST", storeUrl, true);\n request.onreadystatechange = function () {\n if (request.readyState == 4) {\n if (request.status == 200)\n callbackFn(request.responseText);\n else\n alert(config.macros.upload.messages.errorUploadingContent);\n }\n };\n request.setRequestHeader("Content-Length",data.length);\n request.setRequestHeader("Content-Type","multipart/form-data; boundary="+boundary);\n request.send(data); \n};\n\n\nconfig.macros.upload.download = function(uploadUrl, uploadToFilename, uploadDir, uploadBackupDir, \n username, password) {\n var request;\n try {\n request = new XMLHttpRequest();\n } \n catch (e) { \n request = new ActiveXObject("Msxml2.XMLHTTP"); \n }\n try {\n if (uploadUrl.substr(0,4) == "http") {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");\n }\n else {\n netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");\n }\n } catch (e) { }\n //request.open("GET", document.location.toString(), true, username, password);\n request.open("GET", document.location.toString(), true);\n request.onreadystatechange = function () {\n if (request.readyState == 4) {\n if(request.status == 200) {\n config.macros.upload.uploadChangesFrom(request.responseText, uploadUrl, \n uploadToFilename, uploadDir, uploadBackupDir, username, password);\n }\n else\n alert(config.macros.upload.messages.errorDownloading.format(\n [document.location.toString()]));\n }\n };\n request.send(null);\n};\n\n//}}}\n////===\n\n////+++!![Initializations]\n\n//{{{\nconfig.lib.options.init('txtUploadStoreUrl','store.php');\nconfig.lib.options.init('txtUploadFilename','');\nconfig.lib.options.init('txtUploadDir','');\nconfig.lib.options.init('txtUploadBackupDir','');\nconfig.lib.options.init('txtUploadUserName',config.options.txtUserName);\nconfig.lib.options.init('pasUploadPassword','');\nconfig.shadowTiddlers.UploadPluginDoc = "[[Full Documentation|http://tiddlywiki.bidix.info/l#UploadPluginDoc ]]\sn"; \n\n\n//}}}\n////===\n\n////+++!![Core Hijacking]\n\n//{{{\nconfig.macros.saveChanges.label_orig_UploadPlugin = config.macros.saveChanges.label;\nconfig.macros.saveChanges.label = config.macros.upload.label.saveToDisk;\n\nconfig.macros.saveChanges.handler_orig_UploadPlugin = config.macros.saveChanges.handler;\n\nconfig.macros.saveChanges.handler = function(place)\n{\n if ((!readOnly) && (document.location.toString().substr(0,4) != "http"))\n createTiddlyButton(place,this.label,this.prompt,this.onClick,null,null,this.accessKey);\n}\n\n//}}}\n////===
AddXDictToEntity\nApplyOhMy\nAxProps\n[[Benchmark]]\n[[Bicursion]]\n[[Children]]\n[[Combinations]]\n[[Counts]]\nDblClickToggle\nDCLProgramming\nDistanceOf\nDrawingToByLayer\nDumpAttribs\nEditAttrib\n[[Evaluate]]\n[[Every]]\nFindFilesInTree\nForEachObject\nGetAttributesDXF\nGetAttributesActiveX\nGetDimAssocFlag\nGetDwgVersion\nGetFolders\nGetGroupNames\nGetIPAddress\nGetLayersFrozenInVP\nGetOrAddDict\nGetPoints\nGetVlaAtoms\nGetVlaMethods\nGetVlaProperties\nGetXclip\nGetXrefsAttachState\nGetXrefsProperties\nGobalsOhMy\nGrVectorsGetPoint\n[[GrVectorsGetPointSc|GrVectorsGetPointScaled]]\nHiRes\nIs3DPoint\nIsDigit\nIsFolderWriteable\nIsPoint\nIsZero\nLayerMods\nLayerProperties\nLoRes\nLoadSupport\nLSet\nMapcarLambdaOhMy\nMatrix-O-Matic\nPicksetToEnames\nPurgeUnusedGroups\nRemoveFromPickSetIf\nRemoveNth\n[[Replace]]\nRSet\nSaveAsType\nSnapIsoPair\nSSBoundingBox\nSelectItem\nSetProjectPath\nSetSupportPath\nSetVersusSetQ\n[[Some]]\nSSRedraw\nStringPadding\nTileMode\nToBinary\nToggleTabs\nToString\n[[Typos]]\nUCSClassic\nUnHexifyUrl\nZoomSS
Excerpt from http://wiki.org/wiki.cgi?WhatIsWiki --\n<<<\n[[Wiki]] is in Ward's original description:\n\nThe simplest online database that could possibly work.\n\n[[Wiki]] is a piece of server software that allows users to freely create and edit Web page content using any Web browser. [[Wiki]] supports hyperlinks and has a simple text syntax for creating new pages and crosslinks between internal pages on the fly.\n\n[[Wiki]] is unusual among group communication mechanisms in that it allows the organization of contributions to be edited in addition to the content itself.\n\nLike many simple concepts, "open editing" has some profound and subtle effects on [[Wiki]] usage. Allowing everyday users to create and edit any page in a Web site is exciting in that it encourages democratic use of the Web and promotes content composition by nontechnical users.
Excerpt from http://www.tiddlywiki.com/#WikiWikiWeb --\n<<<\nA [[Wiki]] is a popular way of building collaborative websites. It's based on the two ideas of allowing users to easily edit any page and the use of special WikiWord notation to automagically create links between pages. See Wikipedia for [[more details|http://en.wikipedia.org/wiki/Wiki]].\n\nTiddlyWiki is fundamentally different from a conventional [[Wiki]] because it is not based on separate, entire pages of content, but rather items of MicroContent referred to as [[Tiddlers|Tiddler]] that live together on the same page.\n\nOut of the box, TiddlyWiki is also different because it doesn't support public editing - or indeed any persistent editing when viewed over the web.
From http://www.tiddlywiki.com/#WikiWord --\n<<<\nType the text for 'New Tiddler'A WikiWord is a word composed of a bunch of other words slammed together with each of their first letters capitalised. WikiWord notation in a conventional WikiWikiWeb is used to name individual pages while TiddlyWiki uses WikiWord titles for smaller chunks of MicroContent. Referring to a page with a WikiWord automatically creates a link to it. Clicking on a link jumps to that page or, if it doesn't exist, to an editor to create it. It's also easy to have ~NonWikiWordLinks, and there's a ~WikiWordEscape for situations where you don't want a WikiWord to be interpreted as a link.
[[Swamp discussion.|http://www.theswamp.org/index.php?topic=2734.0]]\n\nQuick and dirty utility to zoom to the limits (bounding box) of a selection set.\n\n{{{\n(defun c:ZoomSS ( / _foo1 _foo2 _foo3 ss )\n\n ;;-----------------------------------------------------------------\n ;;\n ;; c:ZoomSS 1.0\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; Zoom to the limits of a selection set.\n ;;\n ;; Nominally tested. Has errors for sure. Find 'em.\n ;;\n ;;-----------------------------------------------------------------\n ;;\n ;; Even though all code written quick and dirty ...\n ;;\n ;; Copyright © 2004 Michael Puckett. All Rights Reserved.\n ;;\n ;;-----------------------------------------------------------------\n\n (defun _foo1 ( object / data pt1 pt2 )\n (cond\n ( (progn\n (vl-catch-all-apply\n 'vlax-invoke-method\n (list\n object\n 'GetBoundingBox\n 'pt1\n 'pt2\n )\n )\n pt1\n )\n (setq data\n (list\n (mapcar\n 'vlax-safearray->list\n (list pt1 pt2)\n )\n )\n )\n (mapcar\n '(lambda (funcs)\n (mapcar\n '(lambda (func) (apply func data))\n funcs\n )\n )\n '( (caar cadar)\n (caadr cadar)\n (caadr cadadr)\n (caar cadadr)\n )\n )\n )\n )\n\n )\n\n (defun _foo2 ( lst )\n (list\n (mapcar\n '(lambda (lst) (apply 'min lst))\n (setq lst\n (list\n (mapcar 'car (setq lst (apply 'append lst)))\n (mapcar 'cadr lst)\n )\n )\n )\n (mapcar\n '(lambda (lst) (apply 'max lst))\n lst\n )\n )\n )\n\n (defun _foo3 ( ss / i objects boundingBox )\n (repeat (setq i (sslength ss))\n (setq objects\n (cons\n (vlax-ename->vla-object\n (ssname ss\n (setq i (1- i))\n )\n )\n objects\n )\n )\n )\n (setq boundingBox\n (mapcar 'vlax-3D-point\n (_foo2\n (mapcar\n '_foo1\n objects\n )\n )\n )\n )\n (vlax-invoke-method\n (vlax-get-acad-object)\n 'zoomwindow\n (car boundingBox)\n (cadr boundingBox)\n )\n )\n\n (if (setq ss (ssget))\n (_foo3 ss)\n )\n\n (princ)\n\n)\n}}}
Welcome to [[cadlabs.com]], a small grab bag of tips, tools and references for ~AutoCAD (primarilly LISP) programmers.\n\n''Notes --''\n*[[cadlabs.com]] was created using FireFox and [[TiddlyWiki]] (a clever personal WikiWikiWeb engine written in HTML, CSS and ~JavaScript).\n*You must have a membership at [[theswamp.org]] and be logged in to follow many of the [[theswamp.org]] links herein.\n*This site appears best when viewed from FireFox.\n**Code snippettes (mono space text) are currently not rendered correctly under Internet Explorer (surprise). It strips out extra spaces typically used to indent and format code. See [[link|http://www.tiddlywiki.com/#InternetExplorer]]. \n**Some menus and popups look kinda goofy under Internet Explorer. \n**Shouldn't I try to ensure this site renders well in any browser? Probably, but I'm not concentrating on that right now -- I'm loathe to accomodate Internet Explorer quite frankly.\n**FireFox renders mono spaced text and menus just fine. //Surprised?//\n*Unless noted otherwise all content © 2006 Michael Puckett. All Rights Reserved.
config.macros.listTags = { text: "Hello" };\nconfig.macros.listTags.handler = function(place,macroName,params)\n{\n var tagged = store.getTaggedTiddlers(params[0],params[1]); \n//<< Second parameter is field to sort by (eg, title, modified, modifier or text)\n var ul = createTiddlyElement(place,"ul",null,null,"");\n for(var r=0;r<tagged.length;r++)\n {\n var li = createTiddlyElement(ul,"li",null,null,"");\n createTiddlyLink(li,tagged[r].title,true);\n }\n}\n
//<< name tiddler listAllReversed,\n//<< function name = listTagsReversed\n//<< base on original 'listAll' macro by Joseph Reisinger\n\nconfig.macros.listTagsReversed = { text: "Hello" };\nconfig.macros.listTagsReversed.handler = function(place,macroName,params)\n{\n var tagged = store.getTaggedTiddlers(params[0],params[1]);\n //<< Second parameter is field to sort by \n //<< (eg, title, modified, modifier or text)\n var ul = createTiddlyElement(place,"ul",null,null,"");\n for ( var r = tagged.length -1; -1<r; r-- )\n {\n var li = createTiddlyElement(ul,"li",null,null,"");\n createTiddlyLink(li,tagged[r].title,true);\n }\n}
/***\n|''Name:''|Plugin setDefaults|\n|''Version:''|1.0.1 (2006-03-16)|\n|''Source:''|http://tiddlywikitips.com/#%5B%5BPlugin%20setDefaults%5D%5D|\n|''Author:''|Jim Barr (jim [at] barr [dot] net)|\n|''Licence:''|[[BSD open source license]]|\n|''TiddlyWiki:''|2.0|\n|''Browser:''|Firefox 1.0.4+; Firefox 1.5; InternetExplorer 6.0|\n!Description\n\nThese settings simply set "default" values for several system features and Plugins.\n***/\n\n/***\nStandard settings:\n***/\n//{{{\nconfig.options.chkRegExpSearch = false; // default false\nconfig.options.chkCaseSensitiveSearch = false; // default false\nconfig.options.chkAnimate = false; // default false\nconfig.options.txtUserName = "MP"; // default "YourName"\nconfig.options.chkSaveBackups = true; // default true\nconfig.options.chkAutoSave = true; // default false\nconfig.options.chkGenerateAnRssFeed = false; // default false\nconfig.options.chkSaveEmptyTemplate = true; // default false\nconfig.options.chkOpenInNewWindow = true; // default true\nconfig.options.chkToggleLinks = false; // default false\nconfig.options.chkHttpReadOnly = true; // default true\nconfig.options.chkForceMinorUpdate = false; // default false\nconfig.options.chkConfirmDelete = true; // default true\nconfig.options.txtBackupFolder = ""; // default ""\n//config.options.txtMainTab = "tabTimeline"; // default "tabTimeline"\n//config.options.txtMoreTab = "moreTabAll"; // default "moreTabAll"\nconfig.options.txtMaxEditRows = "20"; // default "30"\n//}}}\n\n/***\nCustom Plugin settings:\n***/\n//{{{\nconfig.options.chkSinglePageMode = false; // default "true"\nconfig.options.chkSearchList = true; // default "false"\nconfig.messages.messageClose.text = "X"; // default "close"\nconfig.views.wikified.defaultText = ""; // default "The tiddler '%0' doesn't yet exist. Double-click to create it"\nconfig.options.chkStepWiseNavigationOn = true; // default "false"\n//}}}
@@In my opinion the best ~AutoCAD discussion forum on the net@@. \n\n[img[http://cadlabs.com/images/theswampscreen.png]]\n\nIt's free, clean (no advertisements) and some of the world's best programmers hang their hats there. It is a friendly and cordial forum frequented by a spectrum of talented and nice folks. Even if you tend to be a forum lurker there is a wealth of ~AutoCAD (and verticals) and programming (~VisualLISP, ~VisualBASIC, Python, C# etc) information therein. \n\nWhat are you waiting for -- go get yourself a free account!\n\n[[http://www.theswamp.org|http://www.theswamp.org]]
| tiddlyspot password:|<<option pasUploadPassword>>|\n| site management:|<<upload http://cadlabs.tiddlyspot.com/store.cgi index.html . . cadlabs>>//(requires tiddlyspot password)//<<br>>[[control panel|http://cadlabs.tiddlyspot.com/controlpanel.cgi]], [[download (go offline)|http://tiddlyspot.com/download/cadlabs]]|\n| links:|[[tiddlyspot.com|http://tiddlyspot.com/]], [[FAQs|http://tiddlyspot.com/faq/]], [[announcements|http://tiddlyspot.com/announce/]], [[blog|http://tiddlyspot.com/blog/]], [[email feedback|mailto:feedback@tiddlyspot.com]], [[donate|http://tiddlyspot.com/?page=donate]]|