Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/02/2023 in all areas

  1. Didn't get time to look at this last night, the method I was using was very quick but is going to give errors if there are similar sized entities on the same layer that are not a part of the block. The next part is to take the entities it counts above and check that they are a part of the blocks... which might take some thinking and testing
    1 point
  2. To edit your thread, select the ellipsis on the upper right of the post and then select edit. I removed the file for you.
    1 point
  3. The plines have to be parallel or else you will have 2 lines with different angles. Like devitg your request is not clear, has contradictions.
    1 point
  4. Another is look at using ssget with a small CP function. that is a little box at each vertice, yes it will get duplicates but make a list of entity names and then remove duplicates so only end up with what you want. Will add to my To do. May be able to use ssget "F".
    1 point
  5. @mik, please clear us. at your after there are a line between the 2 points extended to 2 polys
    1 point
  6. Just updating what I have above to be a bit more specific - not sure if it will be any different just now though - it should do the same as before. Ignore the rectangle part, it does nothing yet, just thinking ahead to the next steps (defun c:selsimilar ( / MyEnt MySSList) (setq MyEntity (car (entsel "\nSelect an entity in the symbol: "))) (setq pt1 (getpoint "Select Symbol Objects")) (command "Rectangle" Pt1 pause) ;;come back to this line when I remember variable for last mouse clicked point (entdel (entlast)) (if (= MyEntity nil) (princ "\nNothing Selected") (progn (setq MyEnt (entget MyEntity)) ;;Get entity definition to identify objects: ;;Basic Entity Definitions - Line + all below (setq MyEnt0 (assoc 0 MyEnt)) (setq MyEnt67 (assoc 67 MyEnt)) (setq MyEnt8 (assoc 8 MyEnt)) (setq MyEnt62 (assoc 62 MyEnt)) ;;Polyline (setq MyEnt90 (assoc 90 MyEnt)) (setq MyEnt70 (assoc 70 MyEnt)) ;;+ hatch + block (setq MyEnt43 (assoc 43 MyEnt)) (setq MyEnt38 (assoc 38 MyEnt)) (setq MyEnt39 (assoc 39 MyEnt)) ;;Circle, ellipse (setq MyEnt40 (assoc 40 MyEnt)) ;;Ellipse, block (setq MyEnt41 (assoc 41 MyEnt)) (setq MyEnt42 (assoc 42 MyEnt)) ;;Arc (setq MyEnt50 (assoc 50 MyEnt)) (setq MyEnt51 (assoc 51 MyEnt)) ;;Hatch, block (setq MyEnt2 (assoc 2 MyEnt)) (setq MyEnt71 (assoc 71 MyEnt)) ;;Hatch only (setq MyEnt91 (assoc 91 MyEnt)) (setq MyEnt92 (assoc 92 MyEnt)) (setq MyEnt93 (assoc 93 MyEnt)) ;;Create a list to select identical entities (setq MySSList (list MyEnt0 MyEnt67 MyEnt8)) (if (= MyEnt2 nil)()(setq MySSList (cons MyEnt2 MySSList )) ) (if (= MyEnt38 nil)()(setq MySSList (cons MyEnt38 MySSList )) ) (if (= MyEnt39 nil)()(setq MySSList (cons MyEnt39 MySSList )) ) (if (= MyEnt40 nil)()(setq MySSList (cons MyEnt40 MySSList )) ) (if (= MyEnt41 nil)()(setq MySSList (cons MyEnt41 MySSList )) ) (if (= MyEnt42 nil)()(setq MySSList (cons MyEnt42 MySSList )) ) (if (= MyEnt43 nil)()(setq MySSList (cons MyEnt43 MySSList )) ) (if (= MyEnt50 nil)()(setq MySSList (cons MyEnt50 MySSList )) ) (if (= MyEnt51 nil)()(setq MySSList (cons MyEnt51 MySSList )) ) (if (= MyEnt62 nil) (setq MySSList (cons (cons 62 256) MySSList )) (setq MySSList (cons MyEnt62 MySSList )) ) (if (= MyEnt70 nil)()(setq MySSList (cons MyEnt70 MySSList )) ) (if (= MyEnt71 nil)()(setq MySSList (cons MyEnt71 MySSList )) ) (if (= MyEnt90 nil)()(setq MySSList (cons MyEnt90 MySSList )) ) (if (= MyEnt91 nil)()(setq MySSList (cons MyEnt91 MySSList )) ) (if (= MyEnt92 nil)()(setq MySSList (cons MyEnt92 MySSList )) ) (if (= MyEnt93 nil)()(setq MySSList (cons MyEnt93 MySSList )) ) (princ "\Thanks. Analysed sample entity. Now to select the rest. ") (setq MySS (ssget MySSList)) ) ; end prgn ) ; end if (princ "\n")(princ (sslength MySS))(princ " similar entities") (princ) )
    1 point
  7. From what I made up above that will be a bit tricky though possible. I wonder, how much separation is there between the blocks in the drawing? Mostly, do any of them overlap? Like I mentioned above the selection works on a 'Selection set' which for a line is limited to quite a basic filter, start and end coordinates, layer, colour, line type. Other things such as line length can be inferred from the coordinates but you can't filter that. I've been to sleep since last week... and can't quite remember your sample drawing exactly. I am thinking that perhaps the selection set could be done in 2 parts. Something like this: Select an object in one of your legend blocks. This will let the LISP work out the entity type (circle etc), layer, colour for all the other similar symbols The user then selects a 'bounding box' enclosing all the symbols entities and the LISP can work out coordinates of that. Next stage is to select all the entities in that area (based on the criteria recorded from the first entity selected - layers etc), do a count of them Then... going back to what I did above, find all the similar entities in the drawing to the selection. These might be for example the 2 or 3 switch types also.... Now loop through this selection and apply the bounding box coordinates, modified to account for rotation and scaling to select all the object in an area around that entity (ssget with 'crossing polygon' filter) Finally with this selection you might be able to count all the entities in there, their type, calculate the lengths of lines and confirm that this is indeed a symbol that you want to count. There count, 1. And repeat.... The would rely however that the layer with the symbol on is reasonably uncluttered (if it was cluttered this might take a long time) So it is possible but does need a fair bit of fiddling about to make it work ! Could be a dead useful LISP to have, perhaps taking it further to replace the individual symbol lines with a block. Sadly not something I'll have time for this week, but with luck someone else might be able to help out and do something too
    1 point
  8. Can you post a before and after in .dwg and the original PDF?
    1 point
  9. Hi lee ; that's right PBE Examples are very good and i didt have face to take more time of him ; but your code is exact and thanks you
    1 point
×
×
  • Create New...