Jump to content

Leaderboard

Popular Content

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

  1. Quite a genius little bit of code. what its doing getting min and max points of selection set. Calculating the length and width then dividing the shortest side by 50 to get the increment starting the boundary command SPAM CLICKING a grid of points using the increment distance if the point is fully enclosed by entities it will create a boundary Stream lined the code to the best of my ability. But where the majority of the slow down is always going to be when the command function is called. So i made the increment offset for x and y independent. Resulting in a max of 2500 points picked vs the old code of 7007 points picked. (could be more depending on size) You could also lower the number of division but then you run the risk missing spaces. uncomment the (vla-addpoint if you want to see the points like above. Mulitiple Boundary Selection.LSP
    2 points
  2. Engineer_Yasser: I am happy to help! As Bigal pointed out, there are some limitations. You know, when I write programs I try something, then I get a better idea and change the program here and there... Reading the program again I would say that a (setq ss nil) is missing at the end of the program, for better memory management . I also wouldn't create vmin, since the value is only used once - I would put the expression (apply 'min txt1) on the next line, where vmin is used. Variables could be localized, the (princ...) line could be deleted - I only used it for debugging. But the most important limitation that comes to my mind is about selection: regardless if the initial polyline contains arcs or only lines, the program searches for texts inside another polyline that passes through the same vertices, but formed only by straight segments. In some cases, it might "forget" to select some texts. To explain better: see the following image. If the initial polyline is the blue one, the search area is the one in yellow. You can see that the text 201.3 is omitted. A quick fix: using CP instead of WP in the ssget line might improve the situation a bit. If all polyline segments are sure to have a matching text, the program could count the selected texts and warn the user if it doesn't match the number of vertices. That would be useful also if there are some stranger texts in the yellow area, outside the blue polyline. So Bigal and others: the program can be improved!
    1 point
  3. if your want to use the point with visual lisp instead of command in Autocad you need to wrap the xyz with vlax-3D-point function. (setq P_fixed (vlax-3D-point (list (car p) (cadr p) EL_mm)))
    1 point
  4. Try this: The values for x, y scales and rotation should be a number, not a string (Number: 1 or string: "1") The point should be a list and not a string. - Replaced your El_mm line to keep it as a number (worth doing a check if this value comes from another LISP that it is a number) - 2 different options to calculate the point, P_fixed, the second half of the mapacar line is a good example how to set elevation to 0 (mapcar '* '(1 1 0) P)) - Insert as described above (defun c:test ( / ) (setq P (getpoint "Pick Point: \n")) ;; pick point (setq El_mm 105100) ;; New Elevation (setq P_fixed (mapcar '+ (list 0 0 El_mm) (mapcar '* '(1 1 0) P))) ;;Point at elevation ;;or (setq P_fixed (list (car p) (cadr pt) EL_mm)) ;;Point at elevation (command "-insert" "C:\\Myblock\\RBlock.dwg" P_fixed 1 1 0) )
    1 point
  5. You need to tell AutoCAD where to "add" the dim. (defun c:test(/ thisdrwing mspace arc acrobj sp ep cpt p3) (vl-load-com) (setq thisdrawing (vla-get-activedocument (vlax-get-acad-object))) (setq mspace (vla-get-modelspace thisdrawing)) ... (vla-adddimarc mspace cpt sp ep p3) https://www.afralisp.net/archive/methods/listb/adddimaligned_method.htm
    1 point
×
×
  • Create New...