Author Topic: A diversion for the recreationally challenged.  (Read 35200 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: A diversion for the recreationally challenged.
« Reply #30 on: November 05, 2010, 08:06:45 PM »
Maybe the library should have a different prefix?  Maybe instead of ' acet ' use ' swamp ', or something.   :-D

True, that would be cool  :-)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: A diversion for the recreationally challenged.
« Reply #31 on: November 05, 2010, 08:24:43 PM »
Maybe the library should have a different prefix?  Maybe instead of ' acet ' use ' swamp ', or something.   :-D
I was thinking the same thing.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

hmspe

  • Bull Frog
  • Posts: 362
Re: A diversion for the recreationally challenged.
« Reply #32 on: November 05, 2010, 08:54:52 PM »
There was a clear text file for a lot of the express tools that was part of LT Extender years ago.  The file is copyrighted so I can't post it.  I'll see if I can pull out the defuns and the descriptions of the functions and post that much.  Headed out of town so it may take a few days.
"Science is the belief in the ignorance of experts." - Richard Feynman

hmspe

  • Bull Frog
  • Posts: 362
Re: A diversion for the recreationally challenged.
« Reply #33 on: November 06, 2010, 12:26:35 AM »
Here's what's in the file i referenced.  I pulled out the defuns with their arguments and put any comments after the defuns.   

Code: [Select]
(defun acet-error-init ( errlist /                    ;;Error Init for ET
(defun acet-error-restore ( /                         ;;Error Restore for ET
(defun acet-sysvar-set ( varlist /                    ;;Save Sysvar List
(defun acet-sysvar-restore ( /                        ;;Restore Sysvar List
(defun acet-spinner ( /                               ;;Show Spinner Sign
(defun acet-table-name-list ( tblORlist /             ;;Get Table Entries
(defun acet-table-purge ( table entry flag /          ;;Purge table entry
(defun acet::store2reg ( varname varval /             ;;Store custom data 2 Registry
(defun acet::loadreg ( varname /                      ;;Load custom from Registry
(defun acet::store2dict ( varname varval /            ;;Store custom data 2 Dict
(defun acet::loaddict ( varname /                     ;;Load custom from Dict
(defun acet-set-CmdEcho ( val                         ;;Setvar CmdEcho
(defun acet-setvar ( varlist /                        ;;Setvar Custom Var
(defun acet-group-make-anon ( enamelist desc /        ;;Create Anonymous Group
(defun acet-ucs-to-object ( ent /                     ;;Setvar UCS to Ent
(defun acet-ucs-set-z ( zvec /                        ;;Setvar UCS to Ent
(defun acet-ucs-get ( from /                          ;;get current/entity ucs
(defun acet-ucs-set ( ucs /
(defun acet-ucs-cmd ( cmdlist /                       ;;execute ucs command
(defun acet-xdata-set ( xkeylist /                    ;;Set XData Values for keys
(defun acet-xdata-get ( xkeylist /                    ;;Get XData Value for key
(defun bns_ss_mod ( ss flag pr /                      ;;Get XData Value for key
(defun acet-layer-locked ( layer /                    ;;Check Layer Locked ?
(defun acet-layer-unlock-all ( /                      ;;Unlock all layers
(defun acet-plines-rebuild ( plist /                  ;;rebuild polylines
(defun acet-pline-segment-list-apply ( na lst /       ;;re-apply pline segment width
(defun acet::apply_width_bulge ( na swlst ewlst blglst /
(defun acet-plines-explode ( ss /                     ;;explode polylines
(defun acet-pline-segment-list ( elist /              ;get pline segment data
(defun acet::plines-get-widthlist ( ename etype elist /
(defun acet::pline-explode ( ename /
(defun acet-ss-ssget-filter ( ss flt /                ;;filter selection set
(defun acet-ss-new ( ename /                          ;;Create new SelectionSet with Ent
(defun acet-ss-clear-prev ( /                         ;;Clear previous SelectionSet
(defun acet-ss-visible ( entset flag /                ;;Make Entities Visible(0)-Invisible(1)
(defun acet-ss-intersection ( ss ssmaster /           ;;SelectionSet Intersection
(defun acet-ss-filter ( filterdata /                  ;;Filter Selection Set
(defun acet-ss-flt-cspace ( /                         ;;Build filter part for current space
(defun acet-ss-remove ( ss ssmaster /                 ;;Remove Ents from SelectionSet
(defun acet-ss-union ( sslist /                       ;;Combine SelectionSets together
(defun acet-ss-redraw ( ss mode /                     ;;Redraw SelectionSet with Mode
(defun acet-list-m-assoc ( key datalist /             ;;Redraw SelectionSet with Mode
(defun acet-ss-entdel ( ss /                          ;;Entdel ss entities
(defun acet-ss-filter-current-ucs ( ss printit /      ;;filter entities on current ucs
(defun acet-ss-annotation-filter ( ss /
(defun bns_annotation_ss ( ss /                       ;;Get Attributes into ss, remove inserts
(defun acet-ss-to-list ( ss /                         ;;Convert selection-set to entities list
(defun acet-list-to-ss ( lst /                        ;;Convert entities list to selection-set
(defun acet-ss-zoom-extents ( ss /                    ;####### Punkte p1/p2 von entry ohne Z-Wert !!!
(defun acet-ss-remove-dups ( ss fuz ignore /          ;;Remove duplicate entities
(defun acet::check-identic-points ( plist1 plist2 fuz /
(defun acet-tjust-keyword ( elist /                   ;;get text justification
(defun acet-tjust ( ss tjust /                        ;;(acet-tjust (ssadd na (ssadd)) "Start") ;; then set it to start
(defun acet-insert-attrib-set ( na attlst flag / 
(defun acet-currentviewport-ename ( /                 ;get current vport entity
(defun acet-viewport-lock-set ( vpename setlocked /   ;set vport locked/unlocked
(defun acet-alert ( msg /
(defun acet-fscreen-toggle ( /
(defun acet-init-fas-lib ( flag1 flag2 /
(defun acet-block-make-anon ( ss blkname /            ;;Create anonymous block from ss
(defun acet-block-purge ( bna /                       ;;Purge Block with given name
(defun getgeomextents ( en /
(defun acet-geom-z-axis ( /
(defun acet-point-flat ( pt from to /                 ;;flat point
(defun acet-geom-midpoint ( p1 p2 /                   ;;Calculate Midpoint for P1,P2
(defun acet-geom-m-trans ( pntlst from to /           ;;Transform Pointlist
(defun acet-geom-list-extents ( pntlst /              ;;Transform Pointlist
(defun acet-geom-zoom-for-select ( pntlist /          ;;Get Zoom Points to Include Points
(defun acet-geom-view-points ( /                      ;;Get Viewport Corner Points
(defun acet-geom-pixel-unit ( /
(defun acet-geom-textbox ( txtdata offset /           ;;Get Textbox for any Text
(defun acet-geom-rect-points ( pa pb /                ;;Get 5 Rectangle Points
(defun acet-geom-self-intersect ( pointlist flag /    ;;Point Check Self-Intersection
(defun acet-geom-object-end-points ( ename /          ;;get object end points
(defun acet-geom-object-point-list ( na alt /         ;;Get Object Points Rasterized    ;; altitude may be NIL !
(defun acet::pl-point-list ( na alt /                 ;;Get Polyline/LwPolyline Points
(defun acet::arc-point-list ( p1 p2 p3 ang alt /      ;;Get Arcus Points
(defun acet::delta-ang ( r a /                        ;;Get Arcus Infos  ;returns the delta angle of an arc with the specified altitude and radius
(defun acet-geom-image-bounds ( na /                  ;;Get Image Bounds
(defun acet-geom-point-rotate ( pnt p1 ang /          ;;Rotate Point ;Rotate 'pnt' from a base point of 'p1' and through an angle of 'ang' (in radians)
(defun acet-geom-vertex-list ( na /                   ;;Get (LW)Polyline Vertexes
(defun acet-geom-delta-vector ( p1 p2 /               ;;Get Difference Vector
(defun acet-geom-vector-scale ( vec scale /           ;;Get Difference Vector
(defun acet-geom-vector-add ( vec add /               ;;Add 2 Vectors
(defun acet-geom-cross-product ( v1 v2 /              ;;Get Vector Cross Product (Normal Vector)
(defun acet-geom-unit-vector ( p1 p2 /                ;;Get Vector Normalized
(defun acet-geom-angle-trans ( ang from to /          ;;Transform Angle between Coordsys
(defun acet-geom-pline-arc-info ( p1 p2 bulge /       ;;Get Arcus Infos
(defun acet-geom-point-inside ( pt ptlist dist /      ;;Check Point inside Band along Ptlist
(defun acet-geom-vector-side ( pt pa pb /             ;;Get Side of Point rel. to Vector
(defun acet-geom-intersectwith ( ent1 ent2 flag /     ;;Get Intersection Points
(defun acet::measure-points ( object dist /           ;;Get Object points by Measure
(defun acet-geom-object-normal-vector ( ename /       ;;Get Entity's Z normal vector
(defun acet-geom-point-scale ( targetpnt frompnt scale /
(defun acet-geom-vector-parallel ( v1 v2 /            ;;Check for parallel vectors
(defun acet-geom-arc-center ( pa pb pc /              ;;Get Arc center from 3 points
(defun acet-geom-object-z-axis ( ename /              ;;Get Entity Z-Axis
(defun acet-geom-vector-d-angle ( v1 v2 /             ;;Get angle between 2 vectors
(defun acet::acos ( inval /
(defun acet-geom-object-fuz ( na /                    ;;Get object fuzz
(defun acet-ui-entsel ( sellst /                      ;;Entity Selection
(defun acet-ui-single-select ( filter flag /          ;;Single Entity Select
(defun acet-ui-fence-select ( /                       ;;Fence Selectino points
(defun acet-ui-polygon-select ( mode /                ;;Window/Crossing Polygon
(defun bns_truncate_2_view ( a b x y x2 y2 /          ;;Truncate point list
(defun bns_groups_unsel ( /                           ;;Set All Groups to Unselect
(defun bns_groups_sel ( grpenames /                   ;;Set Groups back to Select
(defun acet-blink-and-show-object ( lst /             ;;Draw a temporary polyline & let it blink
(defun bns_blink_and_show_object ( na color /         ;;Draw a temporary polyline & let it blink
(defun bns_blktbl_match ( flt /                       ;;Search all entities inside block table
(defun bns_blk_match ( blkname flt lst flag /         ;;Search all entities inside specified blocks
(defun bns_tbl_match ( tblname flt /                  ;;Search all entities inside specified blocks
(defun bns_filter_match ( e1 flt /
(defun bns_-4_match ( a e1 flt /
(defun bns_or_match ( e1 flt /
(defun bns_and_match ( e1 flt /
(defun bns_not_match ( e1 flt / lst a flag )
(defun bns_gc_match ( e1 dp opr / dp2 a b c d flag )
(defun acet-dcl-list-make ( dcltile vallist /         ;;Display List Values
(defun acet-list-put-nth ( newval datalist atidx /
(defun acet-list-remove-nth ( atidx datalist /        ;;Remove Entry at Index
(defun acet-list-assoc-remove ( key datalist /        ;;Remove all Entries by Key
(defun acet-list-remove-adjacent-dups ( datalist /    ;;Remove Duplicates from List
(defun acet-list-remove-duplicate-points ( lst fuz /  ;;Remove duplicate points from List
(defun acet-list-group-by-assoc ( lst /               ;; group data by assoc key
(defun acet-elist-add-defaults ( elist /              ;;add defaults to elist
(defun acet-str-lr-trim ( s str /                     ;;Trim Left / Right Characters
(defun acet-str-space-trim ( str /                    ;;Trim Left / Right Spaces
(defun acet-str-esc-wildcards ( str /                 ;;place escape for wildcard strings
(defun acet-str-to-list ( deli line /                 ;;Split String into List
(defun acet-str-m-find ( find str /                   ;;Find multiple Substrings
(defun acet-str-equal ( str1 str2 /                   ;;Compare Strings Insensitive
(defun acet-bs-strip ( str /                          ;;Remove backslash controls
(defun acet-filename-ext-remove ( file /              ;;Remove Extension from File
(defun acet-filename-path-remove ( file /             ;;Get Filename Without Path
(defun acet-filename-extension ( file /               ;;Get Extension from Filename
(defun acet-filename-directory ( file /               ;;Get Directory from Filename
(defun acet-filename-valid ( file /                   ;;Check for Proper Filename
(defun acet-filename-supportpath-remove ( file /      ;;Remove Path, if file is inside Supportpathes
(defun acet-file-find ( file /                        ;;Extended FindFile
(defun acet-file-find-font ( fontfile /               ;;Extended FindFile (Fonts)
(defun acet-file-find-image ( imgfile /               ;;Extended FindFile (Fonts)
(defun acet-file-backup ( file /                      ;;Create Backup file
(defun acet-file-backup-delete ( /                    ;;Delete All Backup files
(defun acet-filename-associated-app ( filename /      ;;Get Application for file
(defun get-defparts ( cmd / cmdname cmdpar idx slen )
(defun acet-arxload-or-bust ( filename /
(defun acet-autoload ( loadlist /                     ;;Test & Load function & file
(defun acet-autoload2 ( loadlist /
(defun acet-autoloadarx ( loadlist /
(defun acet-viewport-next-pickable ( /                ;;Get Next Pickable VP
(defun acet-viewport-frozen-layer-list ( ename /      ;;Get Next Pickable VP
(defun acet-calc-bitlist ( n /                        ;;Calculate Bit Values
(defun acet-calc-round ( rval rround /                ;;Round Value
(defun acet-calc-tan ( a /                            ;; Calculate Tangens
(defun acet-lwpline-make ( lst /                      ;;Create LW Polyline
(defun acet-temp-segment ( p1 p2 p3 mode /            ;;Draw tempory Segment
(defun acet-wmfin ( wmffile /                         ;;WMF IN
(defun acet-dxf ( key keylist /                       ;;Get dxf value from assoc list
(defun acet-angle-format ( ang /                      ;;format angle 0...2*PI
(defun acet-angle-equal ( a b fuz /                   ;;Compare Angles with Tolerance
(defun acet-dtor ( a /                                ;;Compare Degree <> Radians
(defun acet-rtod ( a /                               
(defun acet-dict-ename ( dictname dictentry /         ;;Get Dictionary entry
(defun acet-dict-name-list ( dictname /               ;;Get Dictionary entries
(defun acet-explode ( na /                            ;;Explode SS and return exploded entities
(defun acet-list-assoc-put ( new lst /                ;;Add / Update entry to list
(defun acet-list-assoc-append ( new lst /             ;;Append entry to list
(defun acet-pline-is-2d ( elist /                     ;;Check (LW)Polyline for 2D
(defun acet-ui-getcorner ( p1 /                       ;;Get other corner with selection rubberband
(defun acet-undo-begin ( /                            ;;undo begin
(defun acet-undo-end ( /                              ;;undo end
(defun acet-cmd-exit ( /                              ;;undo command exit
(defun acet-safe-command ( bStart bAutoEnd cmdList /  ;;execute commands in safe mode
(defun acet-pref-supportpath-list ( /                 ;;Get Support Pathes as list
(defun acet-list-isort ( plst index /                 ;;Indexed Sort
(defun acet-acad-refresh ( /
(defun acet-geom-ss-extents ( ss shrink /             ;;Get extents of selection set
(defun acet-file-find-on-path ( fna path /            ;;Find file on OS env "PATH"
(defun acet-list-is-dotted-pair ( a /                 ;;check for dotted pair
(defun acet-file-open ( fna flag /                    ;;file open
(defun acet-list-remove-duplicates ( lst fuz /        ;;remove duplicates from list
(defun acet-list-split ( lst item /                   ;;Split List at entry
(defun acet-appid-delete ( appid /                    ;;Remove APPID
(defun acet-ui-progress-init ( title maxstep /        ;;init progress bar
(defun acet-ui-progress-safe ( pos /                  ;;set progress pos
(defun acet-ui-progress-done ( /                      ;;done progress
(defun acet-ui-get-long-name ( msg /                  ;;get long keyboard input
(defun acet::getltexmsg ( msgkey defmsg /
(defun acet::expandfn ( fname fcheck /                ;;Expand & Find Filename
(defun acet::filetype ( filename /                    ;;Get File Type Only
(defun acet::pos-filetype ( filename /                ;;Get Position of Extension
(defun acet::nameonly ( filename /                    ;;Get File Without Path
(defun acet::pathonly ( filename /                    ;;Get Directory only[/font]
"Science is the belief in the ignorance of experts." - Richard Feynman

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: A diversion for the recreationally challenged.
« Reply #34 on: November 06, 2010, 12:47:49 AM »
We need to define code standards.

Lee, did you construct those procedures like that for a specific reason(s)?
(defun foo () ( (lambda ( )...
I ask because that is what i do and i have a specific reason for doing that (just checking to see if your reason is the same as mine).

TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: A diversion for the recreationally challenged.
« Reply #35 on: November 06, 2010, 10:35:21 AM »
We need to define code standards.

Lee, did you construct those procedures like that for a specific reason(s)?
(defun foo () ( (lambda ( )...
I ask because that is what i do and i have a specific reason for doing that (just checking to see if your reason is the same as mine).

I feel that it makes the code more compartmentalised - i.e. 'this lambda block does this', 'that does that' etc - I suppose I could just as well have defined the arguments for those lambda expressions as separate variables.

Is that anything like your reason?

Lee

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: A diversion for the recreationally challenged.
« Reply #36 on: November 06, 2010, 11:11:24 AM »
Just noticed 'acet-spinner' :-)

My version:

Code: [Select]
(defun-q swamp-spinner ( / i ) ;; © Lee Mac 2010
  (setq i 0)
  (setq swamp-spinner (cons (car swamp-spinner) (cons (list 'setq 'i (1+ i)) (cddr swamp-spinner))))
  (nth (rem i 4) '("\\" "|" "/" "-"))
)

(Didn't want to use a global..)

ronjonp

  • Needs a day job
  • Posts: 7526
Re: A diversion for the recreationally challenged.
« Reply #37 on: November 06, 2010, 12:47:37 PM »
Is the lambda stuff compatible with other drafting programs such as Bricscad?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: A diversion for the recreationally challenged.
« Reply #38 on: November 06, 2010, 12:49:26 PM »
My first contribution:
Code: [Select]
(defun swamp-ss-union (sslist)
  ;; Combine list of selection sets
  ;; sslist - list of selection sets
  ;; Alan J. Thompson, 11.06.10
  ((lambda (add / i)
     (foreach ss sslist
       (if (eq (type ss) 'PICKSET)
         (repeat (setq i (sslength ss)) (ssadd (ssname ss (setq i (1- i))) add))
       )
     )
     (cond ((> (sslength add) 0) add))
   )
    (ssadd)
  )
)
« Last Edit: November 06, 2010, 02:53:21 PM by alanjt »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: A diversion for the recreationally challenged.
« Reply #39 on: November 06, 2010, 01:14:49 PM »
Nice one Alan :-)

I think you could actually remove the check:

Code: [Select]
(or (ssmemb (setq e (ssname ss (setq i (1- i)))) add)
As, if the ename already exists in the 'add' set, ssadd will not add it, and no error will be thrown  :-)

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: A diversion for the recreationally challenged.
« Reply #40 on: November 06, 2010, 02:00:24 PM »
Is that anything like your reason?

Well that would be a by-product--of course--of my reason(s) but it wasnt my exact reason. ...I'm actually looking for a way to gracefully back out of this question (I was just surprised by your use and extremely tired at the time) because, well, let's just say that my reasons are stupid--I'm stupid-. Now thats not to say that the use of defun-lambda is detrimental, its not really, i just had some effed-up reasons in my head.

I started AutoLisp like everyone else in that i read AfraLisp and tinkered around but i didnt really understand anything (i understood the basics like conditionals, logic, and even basic recursion but...). I scratched and scraped for about 6 months until Randall Rath (Im sure you have heard some of us mention that name) started the SICP class. After that, my AutoLisp programing and my knowledge became more academic (academic programing is different then real world stuff). When i employed the defun-lambda approach i was at the height of my effed-up-ness because it spun from this huge..."misunderstanding" (that's a good enough word but "idea" could work as well).

Now, I am also looking to back out of this task as well because...well, operating on not enough sleep is terrible and it makes the brain mush.

A library is a H U G E undertaking. For example, take a look at Reni Urban's AutoLisp STL. When working on a team, like this, you will need several good tools.

First off, you will have to ditch your current editor and get something like Vim or Emacs; being totaly honest all those other editors are just toys IMO. Vim (or Emacs) can commit and pull from a CVS, employ snip-its or even let you script big changes. With those other editors you would be doing A LOT of hand edititing and that would be just stupid when you can use a powerfull editor/tools that programmers have been using for years instead.  ...and even with a good editor, a CVS, patch files, and maybe even a "make system" of sorts, you would be doing this for years. Hell, just setting up the enviroment would take a long time.

*sigh* way too much for me. Im sorry for brining it up.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: A diversion for the recreationally challenged.
« Reply #41 on: November 06, 2010, 02:08:51 PM »
Nice one Alan :-)

I think you could actually remove the check:

Code: [Select]
(or (ssmemb (setq e (ssname ss (setq i (1- i)))) add)
As, if the ename already exists in the 'add' set, ssadd will not add it, and no error will be thrown  :-)
Hmph, I was under the impression that it would result it strange numbers from sslength. Oh well, I was wrong. Corrected above.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: A diversion for the recreationally challenged.
« Reply #42 on: November 06, 2010, 02:20:12 PM »
Interesting points Se7en, and yes, I agree - an immense undertaking, and, furthermore would need to be organised somewhere properly (somewhat like STL).

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: A diversion for the recreationally challenged.
« Reply #43 on: November 06, 2010, 02:46:14 PM »
ultra edit > vim
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: A diversion for the recreationally challenged.
« Reply #44 on: November 06, 2010, 03:14:39 PM »
ultra edit > vim

Oh yes, sorry. That is what i meant to say.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org