Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/08/2022 in all areas

  1. my first thought didn't work with lists that have duplicate values. (setq w (vl-remove (last w) w)) '(15 25 25 25 25 35 35 35 35 50 50 50 50 50 50) to '(15 25 25 25 25 35 35 35 35) then I was like if their was only a way to take away the last item like cdr does with the first.
    2 points
  2. .. I was suitably impressed with reverse-reverse, hadn't thought of that
    2 points
  3. Good thinking. Cant look it up right now but must be a way to trim down a list so lenght is x. -edit vl-remove-if (> vl-postion (vla-get-columns obj)) maybe? (defun c:TW (/ c w ss ent obj row) (vl-load-com) (if (setq ss (ssget '((0 . "ACAD_TABLE")))) ;selects only tables (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq c '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)) (setq w '(15 25 25 25 25 35 35 35 35 50 50 50 50 50 50)) (setq obj (vlax-ename->vla-object ent)) (repeat (- (length w) (vla-get-columns obj)) (setq w (reverse (cdr (reverse w)))) (setq c (reverse (cdr (reverse c)))) ) (mapcar (function (lambda (a b) (vla-setcolumnwidth obj a b))) c w) (vla-setrowheight obj 0 10) (setq TotalRowCount (vla-get-rows obj)) (setq RowNumber 1) (while (< RowNumber TotalRowCount) (vla-setrowheight obj RowNumber 6) (setq RowNumber (+ RowNumber 1)) ) ) (prompt "\nNothing Selected") ) (princ) )
    2 points
  4. If the columns are always the same with for the same column number (eg, column 3 is always 25) then you could make a reference list of all these widths and refer to that, a bit more versatile maybe if that is so. Quickly something like below could work? You'd probably want to tidy it up using repeat, cdr, cadr and things like that to create your lists (defun c:trytthis ( / columns columnwidths usercols allcolumns acount) ;; (setq usercols (getint "Columns?")) (setq allcolumns (list 15 25 25 25 25 35 35 35 35 50 50 50 50 50 50 50 50 50 50)) ;A list of all column widths by column number (setq usercols (vla-get-columns obj) ) (setq acount 0) (while (< acount usercols) (setq columns (append columns (list acount))) (setq columnwidths (append columnwidths (list (nth acount allcolumns)))) (setq acount (+ acount 1)) ) )
    2 points
  5. Set the width first then the height. noticed two different types of tables one with 9 columns others with 6. Update the cond for other tables. (defun c:TW (/ ss ent obj row) (vl-load-com) (if (setq ss (ssget '((0 . "ACAD_TABLE")))) ;selects only tables (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq obj (vlax-ename->vla-object ent)) (cond ((eq (vla-get-columns obj) 6) (mapcar (function (lambda (a b) (vla-setcolumnwidth obj a b))) '(0 1 2 3 4 5) '(15 25 25 25 25 35) ) ) ((eq (vla-get-columns obj) 9) (mapcar (function (lambda (a b) (vla-setcolumnwidth obj a b))) '(0 1 2 3 4 5 6 7 8) '(15 25 25 25 25 35 35 35 35) ) ) ) (vla-setrowheight obj 0 10) (setq TotalRowCount (vla-get-rows obj)) (setq RowNumber 1) (while (< RowNumber TotalRowCount) (vla-setrowheight obj RowNumber 6) (setq RowNumber (+ RowNumber 1)) ) ) (prompt "\nNothing Selected") ) (princ) )
    2 points
  6. This allows you to draw multiple lines before offsetting them. -edit Also shows a preview of the line before its created. ;;----------------------------------------------------------------------;; ;; Offset line(s) by 10 on both sides (defun C:OBLine (/ ss pt1 pt2) (setq SS (ssadd)) (while (and (setq pt1 (getpoint "\nStart point: ")) (setq pt2 (getpoint pt1 "\nEnd point: "))) (entmake (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2))) (ssadd (entlast) ss) ) (if SS (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq ent (vlax-ename->vla-object ent)) (vla-offset ent 10) (vla-offset ent -10) ) ) (princ) )
    1 point
  7. if dwgs are not predetermined, how about to use makeentmake.lsp http://www.theswamp.org/index.php?topic=31145 This automatically creates the selected entity in Lisp code. you can modify this to create a different lsp file for each part, and load the corresponding Lisp from each drawing. It's far from automatic, but if there is a time gap between copybase and pastebase, this might be useful as an alternative to blocking it externally.
    1 point
  8. 1. (cdr (assoc -1 (entget (entlast)))) is same with (entlast) 2. The original code is written to work if the user selects with ssget in the if statement, so instead of putting entlast there You need to change it to object in obj and put it in. (setq ss ~ or (vlax-for obj or simple way add (command "select" (entlast) "") in front of (vlax-for obj (vl-load-com) (defun c:OLine (/ getmyline of undo obj ss ) (command "_line" (getpoint) (getpoint "\nNext point:") ""); User draws a line between two points (setq getmyline (entlast)); save the line just made to variable "getmyline" ; Offset a line - By Lee Mac (dOff.lsp) (defun *error* ( msg ) (and undo (vla-EndUndomark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")) ) (princ) ) (setq of 10);New code - Set offset distance automatically to 10 (setq undo (not (vla-StartUndomark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))))) (command "_.select" getmyline "") (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc)) (mapcar (function (lambda ( o ) (vl-catch-all-apply (function vla-offset) (list obj o) ) ) ) (list of (- of)) ) ) (vla-delete ss) (setq undo (vla-EndUndoMark doc)) (princ) ); End Program 3. If you want to draw multiple lines in a row, the basic command MLINE can be useful. You can create three or more lines by adding styles in the MLSTYLE command, and you can also adjust the offset between the lines by changing the Scale property within the MLINE command. It is also possible to add a finishing line at the end. If you press EXPLODE after drawing a line, it is converted into a line.
    1 point
  9. Yeah the objects are to obscure because they have say different text inside circle, Blockify did not seem to work.
    1 point
  10. Bricscad has a make block where it looks at patterns of objects, Ask company to send un exploded, they just dont want you to use there blocks.
    1 point
  11. Are you sure there's no way to retrieve a copy of the drawing from before it was (exploded) destroyed? Anytime I pass a drawing to someone else I keep a copy for myself just in case they might do something like that.
    1 point
  12. Nothing really you can do maybe use quick select and filter by radius seems that they all have slightly different radius. but then you would have to remove one that have different call outs. also https://www.cadtutor.net/forum/topic/61315-duplicate-polygons-total/#comment-506422
    1 point
  13. updated the lisp with the following - entmake for point and text (faster) - got rid of nth its slower then then car cadr caddr last - updated while to combined lines of code Also I don't think the easting and northing are in the right order but left it like the lisp had it. so if your points are in the wrong spot maybe update to below (setq POINT (list (cadr POINT_LINE) ;Get x (caddr POINT_LINE) ;Get y (last POINT_LINE) ;Get z ) ) ; POINTPLT is a simple AutoLSIP program that will plot a coordinate points file ; in AutoCAD. To run POINTPLT, load POINTPLT.LSP as you would any normal ; AutoLISP file (see AutoCAD Reference Manual), type "POINTPLT" and press ; [Enter]. POINTPLT will first prompt you for an input coordinate filename. ; You must enter a vaild DOS filename at this point. The input coordinate file ; must be in the following format: ; ; POINT NO. NORTHING(y) EASTING(x) ELEVATION(z) ; ; A sample input coordinate file (SAMPLE.DAT) is included with POINTPLT. ; ; POINTPLT uses the default (current) text style and layer. However, the ; current text style must have a defined height (height must not be "0"). ; ; If you have any questions or comments concerning POINTS, I may be reached ; via THE SPECTRUM BBS þ (501) 521-5639 ; ;------------------------------------------------------------------------------- ; * ERROR Trapping * ; (defun *ERROR* () (eop) ) ;------------------------------------------------------------------------------- ; * End of program * ; (defun EOP () (setvar "CMDECHO" POINTSPLT_CE) (princ) ) ;------------------------------------------------------------------------------- ; * Main Program * (defun C:POINTPLT (/ IN_FILE POINT_LINE POINT_NO POINT) (setq POINTSPLT_CE (getvar "CMDECHO")) (setvar "CMDECHO" 0) ;Turn "Command Echo" off (prompt "\n\nP O I N T P L T v1.0 -- Copyright (c) 1992 by Kurtis J. Jones / -Mate Software\n\n") (setq IN_FILE (open (getfiled "\nEnter points filename: " (getvar 'DWGPREFIX) "txt" 16) "r")) (while (setq POINT_LINE (read (strcat "(" (read-line IN_FILE) ")"))) ;Read POINT_LINE from input file (setq POINT_NO (car POINT_LINE)) ;Get the point number (prompt (strcat "\nPlotting point no. " (itoa POINT_NO))) (setq POINT (list (caddr POINT_LINE) ;Get easting (cadr POINT_LINE) ;Get northing (last POINT_LINE) ;Get elevation ) ) (entmake (list '(0 . "POINT") (cons 10 POINT))) (entmake (list '(0 . "TEXT") (cons 10 POINT) '(40 . 1) (cons 1 (itoa POINT_NO)))) ) (close IN_FILE) (prompt "\nPOINTPLT finished") (prompt "\n ") (eop) )
    1 point
  14. (setq IN_FILE (open (getfiled "\nSelect Points File" (getvar 'DWGPREFIX) "txt" 16) "r")) This will start in the same folder as the drawing change "txt" to the file extension your looking for. --edit-- I would also make sure to the file is formatted correctly. when I make a point its asking for x y z cords in that order but the lisp seems to be pulling P# y x z. Also Im on BrisCAD so i had to update the text command to work properly
    1 point
  15. 1 point
  16. Maybe there are space characters in the filename. Getstring stops reading when it encounters a space character. Maybe this helps. The T means that getstring will accept space characters. (getstring "\nEnter points filename: " T)
    1 point
×
×
  • Create New...