Jump to content

Search the Community

Showing results for tags 'sort'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions


  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

Found 13 results

  1. I would like to make a lisp that orders me the selected objects, in various ways: I'll give an example with numbers, but they could be polylines or any other object. 1 2 3 4 5 6 7 8 9 I would like to be able to select them with "Windows" and give them e.g. the Left-Right and top-down mode (as you read a text): 1 2 3 4 5 6 7 8 9 but also other ways e.g. from bottom to top and from right to left: 9 6 3 8 5 2 7 4 1 or from top to bottom and from left to right: 1 4 7 2 5 8 3 6 9 I Attached the lisp that I did and that runs only from left to right and from top to bottom... but I think you can find solutions faster than mine! My lisp is not complete: LISTA1 output contains the coordinates of the element + the selection set... a I just have to do SSADD to complete the command and create selection set final. SelSort.lsp ORDINE.lsp
  2. Hello, I want to ask for help. If i have list of points (startX1 X2 X3 X4 Xn EndXn StartX X X X X X EndX ....) --> StartX1 X2 X3 .. EndXn "all of the list is string" and i want to divide to different parts ((startX1 X2 X3 X4 Xn EndXn) (StartX X X X X X EndX)) Thank you
  3. I am looking for a routine to sort contour lines. I am using 3d polylines that I import from Global Mapper. My problem is all of the lines are on one layer. Ideally, I would like to pick a starting elevation (polyline) and have the routine select every 5th contour up and down. Once then are all selected, I can move them to a new layer (like TOPO-INDEX). Some of these sites are hundreds of acres and have significant elevation changes. To do this by hand is VERY time-consuming (and easy to miss some contours). I am not a programmer, but this seems like the type of task that is ideal for a lisp routine. Any help is appreciated.
  4. Hi, Is it possible to sort the open drawing tabs in ACAD. Is it accessible by LISP? Note: I'm not referring to layout tabs. Thanks.
  5. Hi people! I'm looking for some help: I need to cut plexiglas with laser. The form, drawed with Autocad, come with many circles and arcs. Know someone a routine or lisp able to click entities to reorder the sortment? And, second, it will be wonderful to add a progressive number to the entities to visually control the sortment of them! (I hope the question I made is clear. My english is very poor). Ciao, Daveacad
  6. Separate/copy layer to other place by user pick point then sorting them horizontal below code not sorting horizontal.how to change the code, become horizontal (see image attached) (defun c:test1 ( / _move d ss l lst ) (vl-load-com) (defun _move ( obj p q dist ) (vla-move (setq obj (vla-copy obj)) (vlax-3D-point p) (vlax-3D-point q)) (vla-move obj (vlax-3D-point '(0. 0. 0.)) (vlax-3D-point (list dist 0. 0.))) ) (if (and (ssget "_:L") (setq p1 (getpoint "\nBase Point: ")) (setq p2 (getpoint "\nDesired Location: " p1)) (setq p1 (trans p1 1 0) p2 (trans p2 1 0)) ) (progn (vlax-for obj (setq d 10. ss (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (_move obj p1 p2 (cond ( (cdr (assoc (setq l (vla-get-layer obj)) lst)) ) ((cdr (assoc (vl-string-right-trim "D" l) lst))) ((cdr (assoc (strcat l "D") lst))) ( (setq lst (cons (cons l (setq d (- d 650.))) lst)) d ) ) ) ) (vla-delete ss) ) ) (princ) )
  7. Does someone have a routine (or know of a way) to reorder a column of text items? ie: Line 1 Line 2 Line 3 Line 4 to Line 4 Line 3 Line 2 Line 1 I have a large table of text that I need to flip the column order. Has someone posted something along these lines? Is there an Autocad command I don't know about? I have had no luck in any of the search terms I have used.. Thanks for all the help you guys provide...
  8. Hello everybody. I need help to sort lists in a code. Use a program created by the great Fixo to create tables containing some attributes. I found that, depending on how the block is built, the end result will be undesired. I took the liberty of attaching the file exemplifying the case. Any help will be appreciated. Luís Augusto. Sort list.dwg ;Oleg Fateev ;16th Jan 2014 06:18 pm (defun C:CLIST (/ acapp acsp adoc atable attdata attitem atts blkname blkobj col en headers pt row sset title ) (txtNotExists) (TablExists) (or adoc (setq adoc (vla-get-activedocument (setq acapp (vlax-get-acad-object))) ) ) (or acsp (setq acsp (vla-get-block (vla-get-activelayout adoc))) ) (if (setq sset (ssget "_:S:E:L" (list (cons 0 "INSERT") (cons 66 1) (cons 410 (getvar "ctab")) ) ) ) (progn (setq en (ssname sset 0)) (setq blkobj (vlax-ename->vla-object en) blkname (vla-get-effectivename blkobj) ) (if (/= blkname "*");any other block different "*" (progn (setq atts (vlax-invoke blkobj 'getattributes)) (foreach attobj atts (if (wcmatch (vla-get-tagstring attobj) "PIN_*");change "PIN_#*" use letters also (progn (setq attitem (cons (vla-get-tagstring attobj) (vla-get-textstring attobj) ) ) (setq attdata (cons attitem attdata)) ) (setq attdata (reverse attdata)) ) ) (setq attdata (mapcar '(lambda (a) (list (vl-string-subst "" "PIN_" (car a)) (cdr a) ) ) attdata ) ) (if (setq pt (getpoint "\nSpecify table location:")) (progn (setvar 'ctablestyle "TB_CONECTORS") (setq atable (vla-addtable acsp (vlax-3d-point pt) (+ 2 (length attdata)) 2 (/ (getvar 'dimtxt) 2) (* (getvar 'dimtxt) 16) ) ) (vla-put-regeneratetablesuppressed atable :vlax-true) (setq col 0) (foreach wid (list 4.5 30.5) (vla-setcolumnwidth atable col wid) (setq col (1+ col)) ) (vla-put-horzcellmargin atable 0.3) (vla-put-vertcellmargin atable 0.3) (vla-setTextheight atable 1 2.0) (vla-setTextheight atable 2 1.4) (vla-setTextheight atable 4 1.4) (setq title blkname) ;(setq title (getstring (strcat "\nTable title: <" blkname ">: "))) (if (eq "" title) (setq title blkname) ) (vla-setText atable 0 0 title) (vla-setcelltextheight atable 0 0 2.0) (vla-SetCellAlignment atable 0 0 acMiddleCenter) (setq headers (list "Pin" "Circuit / Color / Section / Mark") ) (setq row 1 col 0 ) (repeat (length headers) (vla-SetCellAlignment atable row col acMiddleCenter) (vla-setcelltextheight atable row col 1.4) (vla-setText atable row col (car headers)) (setq headers (cdr headers)) (setq col (1+ col)) ) (setq row 2) (foreach record attdata (setq col 0) (foreach item record (vla-setText atable row col item) (if (= 0 col) (vla-SetCellAlignment atable row col acMiddleCenter) (vla-SetCellAlignment atable row col acMiddleLeft) ) (vla-setcelltextheight atable row col 1.4) (setq col (1+ col)) ) (setq row (1+ row)) ) (vla-put-regeneratetablesuppressed atable :vlax-false) (vla-put-height atable (+ (* (vla-get-rows atable) 2.2) 4.1) ) (vla-update atable) ) ) ) ) ) ) (princ) ) (defun txtNotExists () (if (not (tblsearch "style" "ARIAL_2.0")) (progn (entmake (list '(0 . "STYLE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbTextStyleTableRecord") '(2 . "ARIAL_2.0") ;<- Your style name here '(70 . 0) '(40 . 2.0) '(41 . 1.0) '(50 . 0.0) '(71 . 0) '(42 . 0.09375) '(3 . "Arial.ttf") '(4 . "")) ) (princ) ) ) ) (defun TablExists () (vl-load-com) (setq stylename "TB_CONECTORS") (setq actdoc (vla-get-activedocument (vlax-get-acad-object))) (setq dict (vla-get-dictionaries actdoc)) (setq tabcol (vla-item dict "acad_tablestyle")) (if (vl-catch-all-error-p (setq tabsty (vl-catch-all-apply 'vla-item (list tabcol stylename)))) (progn (vl-load-com) (MakeTableStyle) ) ) (princ) ) (vl-load-com) (defun MakeTableStyle() ;;http://hyperpics.blogs.com/beyond_the_ui/2012/07/creating-a-table-style-with-autolisp-and-the-activex-api.html ;;By Lee Ambrosius ;; Get the AutoCAD application and current document (setq acad (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acad)) ;; Get the Dictionaries collection and the TableStyle dictionary (setq dicts (vla-get-Dictionaries doc)) (setq dictObj (vla-Item dicts "acad_tablestyle")) ;; Create a custom table style (setq key "TB_CONECTORS" class "AcDbTableStyle") (setq custObj (vla-AddObject dictObj key class)) ;; Set the name and description for the style (vla-put-Name custObj "TB_CONECTORS") (vla-put-Description custObj "Tabela de conectores") ;; Sets the bit flag value for the style (vla-put-BitFlags custObj 1) ;; Sets the direction of the table, top to bottom or bottom to top (vla-put-FlowDirection custObj acTableTopToBottom) ;; Sets the supression of the table header (vla-put-HeaderSuppressed custObj :vlax-false) ;; Sets the horizontal margin for the table cells (vla-put-HorzCellMargin custObj 0.3) ;; Sets the supression of the table title (vla-put-TitleSuppressed custObj :vlax-false) ;; Sets the vertical margin for the table cells (vla-put-VertCellMargin custObj 0.3) ;; Set the alignment for the Data, Header, and Title rows (vla-SetAlignment custObj (+ acDataRow acTitleRow) acMiddleLeft) (vla-SetAlignment custObj acHeaderRow acMiddleCenter) ;; Set the text height for the Title, Header and Data rows (vla-SetTextHeight custObj acTitleRow 1.5) (vla-SetTextHeight custObj (+ acDataRow acHeaderRow) 1.0) ;; Set the text height and style for the Title row (vla-SetTextStyle custObj (+ acDataRow acHeaderRow acTitleRow) "ARIAL_2.0") (princ) ) (prompt "\n\t---\tStart command with CLIST\t---\n") (prin1) (or (vl-load-com)) (princ)
  9. Hi all, Very new at this forum. I need an AutoLISP that will help me auto numbering blocks or text. I am aware of "TCOUNT which is handy, however the command only gives you 3 choices in regards to how to number, X, Y and Select order. What I need is a program that will sort and number my blocks/text by distance from a point. Thank you so much for your help.
  10. andar424

    sorting the tree

    Hey guys, Kind of a random question, but what are some known issues of why a tree can not be sorted? I'm referring to the "Alpha Sort Component" in the "Productivity" section of the "Assemble" tab. It sucks when I'm forced to work in other people's projects and go to do it and it fails. Do things like component patterns cause it to hang up? I'm kind of picky when it comes to my tree, and I know I can generally right click and "Find in Browser," but I like it to be nice and organized!
  11. hi all, bumped into an issue that i couldn't find a solution to, thought i'd pick some of your brains. I recently reformated my workstation and upgraded to autocad 2013. after such, i have noticed my drawing folders are prioritizing cad files to a not-so-efficient way, unlike before. please help or shed any light on how i could fix this issue. current: .bak .dwg prefered organization: .dwg .bak (both sorted by type:acending) before my dwg files are always above my bak files. it is very tidious and annoying to scroll all the way to the bottom of a folder to select my dwg files when there are multiple versions of bak files in the folder.
  12. wishbonesr


    For public consumption and comment... Below is a MergeSort algorithm implementation in Autolisp based on Ellis Dee's vb6 version here: http://www.vbforums.com/showpost.php?p=2909257&postcount=12 I'm looking to optimize further, but there are only a few places this can occur / after the recursive call in what kinda resembles an insertion sort. Specifically the (repeat (1+ (- mid L)) and (repeat (1+ (-upper R)). Let me know what you think.... Special Considerations: No byref, so currently uses global vars INDEX and SORTCLMN. You can nest this function with defined vars in the holding function, to keep private - so not completely global. Sorting is for nested lists, thus the name MergeSort2. This is for sorting the equivelant of a 2-dimensional array. See the inline example of the list construct. Don't think this will work with dotted pairs in current state. The code below includes everything necessary to build the current environment, and test (defun randnum (/ modulus multiplier increment random) (if (not seed) (setq seed (getvar "DATE")) ) (setq modulus 65536 multiplier 25173 increment 13849 seed (rem (+ (* multiplier seed) increment) modulus) random (/ seed modulus) ) ) (setq index nil) (repeat 1000 (setq index (append index (list (list (randnum))))) ) (setq sortclmn 0) ;use read and eval to make outside var dynamic ;currently locked to index (defun MergeSort2 (lsMirror lower upper ;require global vars: index sortclmn ;index is a two dimension array/list ;Ex. ( ; (1.2 4.1 0 <vla-obj> <ename>) ; (1 1 1 <vla-obj> <ename>) ; ) ;Ex. ( ; (5) ; (2) ; (6) ; ) ;Ex. 3d point list ; ( ; (21145.12 6546.01 0.0) ; (21165.0 6546.01 0.0) ; (20010.0 6500.0 1.0) ; ) / mid L R O Do swap ) ;(vl-load-com) (if (not upper) (setq upper (1- (length index)) ;if first run, get the bounds of the array lower 0 ;build an empty array to match the original lsMirror (repeat (length index) (setq lsmirror (append lsmirror (list 'nil)))))) (setq mid (- upper lower)) (cond ((= mid 0) );do nothing ((= mid 1) ;only one comparison in array (if (> (nth sortclmn (nth lower index)) (nth sortclmn (nth upper index))) (setq swap (nth lower index) index (nth-replace (nth upper index) index lower) index (nth-replace swap index upper)) );if ) ;else we have more than two entries ot work with (t (setq mid (+ lower (/ mid 2))) (MergeSort2 lsmirror lower mid) (MergeSort2 lsmirror (1+ mid) upper) (setq L lower R (1+ mid) O lower Do t) (while Do (if (< (nth sortclmn (nth R index)) (nth sortclmn (nth L index))) (progn (setq lsmirror (nth-replace (nth R index) lsmirror O)) (setq R (1+ R)) (if (> R upper) (progn (repeat (1+ (- mid L)) (setq O (1+ O)) (setq lsmirror (nth-replace (nth L index) lsmirror O)) (setq L (1+ L)) );repeat (setq Do nil) );progn );if );progn (progn ;else (setq lsmirror (nth-replace (nth L index) lsmirror O)) (setq L (1+ L)) (if (> L mid) (progn (repeat (1+ (- upper R)) (setq O (1+ O)) (setq lsmirror (nth-replace (nth R index) lsmirror O)) (setq R (1+ R)) );repeat (setq Do nil) );progn );if );progn );if (if do (setq O (1+ O))) );while (setq O lower) (repeat (1+ (- upper lower)) (setq index (nth-replace (nth O lsmirror) index O)) (setq O (1+ O)) );repeat );cond else );cond (princ) );defun mergeSort2 ;Provided by RenderMan... ;http://www.cadtutor.net/forum/showthread.php?65280-nth-replace-(mergesort-s-achilles-heel)&p=445816#post445816 (defun nth-replace ( newitem alist position / i ) (setq i -1) (mapcar '(lambda ( x ) (if (= position (setq i (1+ i))) newitem x)) alist) ) (defun get-utime () (* 86400 (getvar "tdusrtimer")) ) (setq ctime (get-utime)) (mergesort2 nil nil nil) (princ (strcat "\nTime: \n" (rtos (- (get-utime) ctime) 2 2) " seconds"))
  13. harilalmn

    Sort sheets in SSM

    Is there a way to sort sheets in SSM alphabetically?
  • Create New...