Jump to content

All Activity

This stream auto-updates

  1. Today
  2. Hello Everyone, I need some help; here is my list in csv 1,21.188,19.762,0.000,L1S 2,31.804,7.629,0.000,L2S 3,44.106,18.077,0.000,L2 4,32.984,30.378,0.000,L1 5,45.117,40.995,0.000,L1 6,56.239,26.671,0.000,L2 7,68.878,36.782,0.000,L2E 8,57.587,50.937,0.000,L1E 9,49.168,65.549,0.000,L1S 10,43.612,72.164,0.000,L1 11,50.491,77.059,0.000,L1 12,55.253,70.179,0.000,L1C 13,41.363,59.993,0.000,L2S 14,34.616,68.460,0.000,L2 15,27.472,64.094,0.000,L2 16,33.954,55.495,0.000,L2C And I want to make that list into something like this, (setq pt (list (nth 1 ln) (nth 2 ln) (nth 3 ln))) (setq mylist '( (("L1S" (list pt)) ("L1" (list pt))...("L1E" (list pt))) (("L2S" (list pt)) ("L2" (list pt))...("L2E" (list pt))) (("L1S" (list pt)) ("L1" (list pt))...("L1C" (list pt))) (("L2S" (list pt)) ("L2" (list pt))...("L2C" (list pt))) ) ) In order to plot the lines into groups by creating another set of group of points if the description has "S" or start at the end, say L1S for Line 1 Start. Thank you in advance.Line1 and 2 Group List.csv
  3. The geometric center (a.k.a. centroid) of an open polyline is deteremined by summing the length of each line segment times the coordinates of the midpoint of the respective segment. The result is then divided by the total length of the polyline. It is NOT the average of the point locations. ; Calculates the centroid for an open lwpolyline ; lrm 8/9/2025 (defun c:pl_centroid (/ ss pt_lst sum_x sum_y sum_d n i d mid_pt centroid) (setq ss (entget (car (Entsel "\nSelect Open Polyline"))) pt_lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) ss) ) ) (setq sum_x 0 sum_y 0 sum_d 0.0 n (length pt_lst) i 0 ) (while (<= i (- n 2)) (setq d (distance (nth i pt_lst) (nth (+ i 1) pt_lst))) (setq mid_pt (mapcar '/ (mapcar '+ (nth i pt_lst) (nth (+ i 1) pt_lst)) '(2 2 2) ) ) (setq sum_x (+ sum_x (* (car mid_pt) d)) sum_y (+ sum_y (* (cadr mid_pt) d)) sum_d (+ d sum_d) i (+ i 1) ) ) (setq centroid (list (/ sum_x sum_d) (/ sum_y sum_d) ) ) (princ "\n Centroid at: ") (princ centroid) (command "_point" "_non" centroid) (princ) )
  4. Steven P

    SELECT TEXTS OTHER THAN 3.5..HELP

    To enter the value into your selection set see below. In LISP the '( ... ) lists mean it is a static list, it is read exactly as it is written, (list ... ) means that CAD will create the list if for example variables are a part of the list, and (cons ... ), also used to create a list - in this case relevant to create a dotted pair. (setq MyThing 5) '(1 2 3 4 MyThing) is read as 1 2 3 4 MyThing - and an error since it is looking for MyThing to be a string, "MyThing" (list 1 2 3 4 MyThing) is read as 1 2 3 4 5 - list has been created by the LISP (cons 1 MyThing) is read as (1 . 5) So this might help... As above though you select the text with the selection set ss, but haven't done anything with it - if you are a part way through the LISP that is all good, but just put a report in so you can see it is working as it should as you go along perhaps (sslength SS) maybe. (Oh, just me, I also amended the indents, and added where commands end if over a few lines, I find it easier to read LISPs as below, that's all) (defun c:test (/ old_err EscVP StrScale2 TxtHt StrScale ss) (setq old_err *error*) (defun *error* ( a / ) ;; Add here return cmdecho to as it was, cmdecho 1 (princ "") (setq *error* old_err) (princ) ) ; End Error Defun (setvar "cmdecho" 0) ; perhaps record the state of cmdecho before here, and reset to that value at the end (if (and (setq EntVP (car (entsel "\Seleccione VIEWPORT: "))) (= (cdr (assoc 0 (entget EntVP))) "VIEWPORT") ) ; end and (progn (setq EscVP (vla-get-CustomScale (vlax-ename->vla-object EntVP))) (setq StrScale2 (rtos (* 3.5 (/ 1 EscVP)) 2 1)) (setq TxtHt (* 3.5 (/ 1 EscVP)) ) ; a number not a string ;; added this (setq StrScale (rtos (/ 1 EscVP) 2 2)) (setq vpnum (cdr (assoc 69 (entget EntVP )))) (vl-cmdf "_.mspace") (setvar "CVPORT" vpnum) (setq ss (ssget (list(0 . "TEXT") (-4 . "<>") (cons 40 TxtHt))) ) ;;What are you doing with ss now? (Prompt (strcat "\nLa escala de La Ventana es 1/" StrScale)) (princ "\nLos textos de 3.5 en el interior de la ventana deben ser de: ") (princ StrScale2) ) ; end progn ) ; end if (setvar "cmdecho" 1) (princ) );fin defun
  5. GLAVCVS

    SELECT TEXTS OTHER THAN 3.5..HELP

    Hi I think it would be easier to find the problem if you attached an example drawing.
  6. Yesterday
  7. BIGAL

    Table of contents

    If your making layouts then do that then go into mspace pick the page details than pop back to pspace and fill in your title block not that hard. Yes a lisp. One of the things I have looked at is pick a point on dwg in Model space, select scale, select title block and make the layout. You could add pick the mtext for title block also. It will cost you a cup of coffee as have to hard code the title block details etc.
  8. Not quite the middle of say 2 points. The red is the average answer. The green is gcen. so 4 answers. If the shape is say 4 points then you could force a close get the Gcen then do a undo.
  9. leonucadomi

    SELECT TEXTS OTHER THAN 3.5..HELP

    thanks, now I explain In the modelspace I have texts of different height in paperspace in the paperspace I have viewports of different scales If I use the chspace command and take those texts to paper space they should be 3.5 height I'm looking for a routine that helps me detect which texts do not meet that height in each viewport (defun c:test (/ EscVP StrScale2 StrScale) (setq old_err *error*)(defun *error* ( a / )(princ "") (setq *error* old_err)(princ)) (setvar "cmdecho" 0) (if (and (setq EntVP (car (entsel "\Seleccione VIEWPORT: "))) (= (cdr (assoc 0 (entget EntVP))) "VIEWPORT")) (progn (setq EscVP (vla-get-CustomScale (vlax-ename->vla-object EntVP))) (setq StrScale2 (rtos (* 3.5 (/ 1 EscVP)) 2 1)) (setq StrScale (rtos (/ 1 EscVP) 2 2) ) (setq vpnum (cdr (assoc 69 (entget EntVP ) ) ) ) (vl-cmdf "_.mspace") (setvar "CVPORT" vpnum) (setq ss (ssget '((0 . "TEXT") (-4 . "<>") (40 . 3.5))) ) (Prompt (strcat "\nLa escala de La Ventana es 1/" StrScale)) (princ "\nLos textos de 3.5 en el interior de la ventana deben ser de: ") (princ StrScale2) ) ) (setvar "cmdecho" 1) (princ) );fin defun I am looking to enter this calculated value here but it doesn't work
  10. Steven P

    SELECT TEXTS OTHER THAN 3.5..HELP

    This (ssget '((0 . "TEXT") (-4 . "<>") (40 . 3.5))) should work. You can change "TEXT" to "*TEXT" to also capture MText Though looking at the code you have, I am assuming that is just a snippet of what you want to do. Here are a couple of hints: (defun c:pru ( / ss ) ;;Yup localised variables, C: prompt, all good (setq ss (ssget '((0 . "TEXT") (-4 . "<>") (40 . 3.5))) ) ;; ADDED (SETQ SS ... ) so that you can use the selection set later (princ (sslength ss)) ;; Added this in to show the result of the selection set (princ) ;;Exit quietly )
  11. leonucadomi

    SELECT TEXTS OTHER THAN 3.5..HELP

    (defun c:pru2 ( / ss alturaColor colorNuevo) (setq alturaColor 3.5) ; Define la altura a verificar (setq colorNuevo 1) ; Define el color a aplicar (ej. rojo) (setq ss (ssget "X" '((0 . "TEXT,MTEXT")))) ; Selecciona todos los textos (if ss (progn (setq i 0) (while (setq en (ssname ss i)) (setq obj (vlax-ename->vla-object en)) (if (/= (vla-get-height obj) alturaColor) (vlax-put-property obj 'color colorNuevo) ; Cambia el color ) (setq i (1+ i)) ) ) ) (princ) ) This routine does what I need, but it has a problem that I cannot understand, I have objects in the paperspace that have a height of 3.5 and it recognizes them as if they did not have it and changes them to red. can someone help? thanks
  12. LI & LU Layer isolate and Layer unisolate are extremely helpful, I concur. I also favor "all off" rather than "Fade". I am quite partial to the LAYERS 2 toolbar also.
  13. Strydaris

    Table of contents

    @SLW210 Thanks. I will take a look at that. @BIGAL Thanks for the code. We stopped using sheet titles on our titleblocks. Sometimes we would end up having too many drawings on a single page and there wouldnt be enough room for it all on titleblock. We removed it and opted for a Table of Contents with all the labels. And yes we do primarily work in modelspace but all our current titleblocks are located in Paperspace. The drawing titles are located below the drawings in model space. Our table of contents is in modelspace as well. Our model space typically looks like this. Where as our Titleblock version of that looks like this ( the red blob is our company info blanked out)... The fields in the titleblock are linked to dwgprops for easy updating. Page # on the bottom right is a diesel expression that pulls the layout name. Anyways, the only method I can think about doing this is to select each drawing title in model space and have the lisp auto number the pages and organize in a table or formatted MTEXT.
  14. leonucadomi

    SELECT TEXTS OTHER THAN 3.5..HELP

    I ALREADY TRIED IT AND IT SELECTED THEM ALL FOR ME, I DON'T KNOW WHAT HAPPENS My purpose is to detect all texts that do not have a desired height, in this case 3.5
  15. Hi, I use ZWCAD and the Express is loaded I try what GP_ and enthralled said to solve the problem but get this error Command: CPL Error: ZWCAD setvar reject: LOFTNORMALS 0 Any ideas? Thanks
  16. SLW210

    Need better multiline

    At home I have some file compare programs, Notepad++ with the Compare plug-in as well. IIRC, there are some online as well, WinMerge I think is one of my programs, I use AntiTwin to find duplicate files, it may have a compare function. So while everyone is doing there jobs, if YOU have the time, you might could compare the file and see what all is different. At least that will be a start, maybe I can talk IT into putting one of those programs on my work computer. I used to have a program from CabloFil, not sure if they still have anything for doing cable trays in AutoCAD. Here it is... Cable Management 3D Modeling Tools | Legrand I haven't done a cable tray in ages, so not sure what all it does.
  17. You can actually calculate it, here is the code (you can change it for your purposes): (setq ptlist (mapcar 'cdr (vl-remove-if-not (function (lambda (x) (= (car x) 10))) (setq ent (entget (car (entsel "\nSelect the line:")))))) ;; point list sum_x 0 sum_y 0 vertices (cdr (assoc 90 ent)) ;; number of vertices for LWPOLYLINE ) (foreach pt ptlist (setq sum_x (+ sum_x (car pt))) ;; sum only the X vertices values ) (foreach pt ptlist (setq sum_y (+ sum_y (cadr pt))) ;; sum only the Y vertices values ) (setq sum_x (/ sum_x vertices) ;; dividing the total sum X by the number of vertices sum_y (/ sum_y vertices) ;; dividing the total sum Y by the number of vertices pt (list sum_x sum_y) ;; geometric center ) Below are the pictures with geometric center for open and closed polyline (picture 1 open, picture 2 closed). Picture 1. Picture 2. This is true. Best regards.
  18. Only the geometric center is available for closed areas, since open polylines have no area and therefore no true center. If it’s just a line, the "geometric center” is the midpoint.
  19. Steven P

    Need better multiline

    Generally were busy people this week - if you open the LISP in a text editor, search for the line that asks for the new width - problem will be sometime after that - but will narrow down the issue a bit and give a less daunting task
  20. (setq gct (osnap (vlax-curve-getStartPoint bm) "gcen")) The above code line gives only closed polyline How to find the geometric center of an open polyline and a single line
  21. DATVO

    SELECT TEXTS OTHER THAN 3.5..HELP

    Try this: ;; Modified by DV. Visit my page at: https://lispautocad.gumroad.com/ (defun c:PRU (/ ss) (if (setq ss (ssget '((0 . "TEXT,MTEXT") (-4 . "<>") (40 . 3.5)))) (progn (sssetfirst nil ss) (princ (strcat "\nSelecting: " (itoa (sslength ss)) " objects.")) ) (princ "\nNo Object.") ) (princ) )
  22. BIGAL

    Need better multiline

    Like the others 800 lines of code, I struggle remembering what I wrote around that number of lines from a year or two ago. Having to work out why program not working with some new dwg's 678 lines of code at the moment. I had to write an error trap to just find where it was failing. You have been offered other solutions, the Tharwat solution would be my pick and he is a regular here so you could contact him if you had questions or want more.
  23. BIGAL

    Table of contents

    For me I use layouts and a Title block then can make an index of all layouts. Here is a copy of the code have a look at it. It looks from image that your using model space and not layouts. Dwgindex.lsp
  24. DATVO

    join mtext with leader

    Here’s a tool that might help: https://lispautocad.gumroad.com/l/eezilo
  25. Last week
  26. hello guys: I need a selection filter to select texts and mtext other than 3.5 in size try this code from Master Lee (ssget '((0 . "CIRCLE") (-4 . "<>") (40 . 5.0))) modified (defun c:pru (/ ss ) (ssget '((0 . "TEXT") (-4 . "<>") (40 . 3.5))) (princ) ) I need to identify texts other than 3.5 with some color. help please thanks
  27. SLW210

    Need better multiline

    I doubt if I'll have time this week.
  28. SLW210

    Table of contents

    https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/automated-sheet-index-lisp-assistance/td-p/9057520
  1. Load more activity
×
×
  • Create New...