Leaderboard
Popular Content
Showing content with the highest reputation on 05/21/2025 in all areas
-
This related post may be helpful in this regard.4 points
-
hello i have this lisp but i want change from color 230,230,219 to black and reverse, i don't know the ole code. or there is a quick way? thanks1 point
-
On the curve (everything in the real world is a curve) that represents the advantage/disadvantage between easy and difficult, there's always a tipping point beyond which excessive ease causes more disadvantages than advantages. Creating polylines with 'command' is an example of this.1 point
-
OMG, the object snap stays on when you draw with LISP? Well, that explains a problem I used to have.1 point
-
You could use it as part of an error handler as shown by @Lee Mac HERE Here is getting the value and restoring SysVars Saving and Restoring System Variables | AfraLISP Let the Code do the work.1 point
-
One thing not mentioned is using common sense naming in the code, here when you look at examples the code will have a variable "SS" for "selection set", "ang" for angle, pt1 pt2 and so on for points. Obviously if programming in non English these variable names will suit that language. Using VL commands have a more built in description of what that function is doing, when compared to using DXF codes. One thing to look out for is variable names that are built in so can cause errors if you use that name, one example is MIN where your after the minimum value. @moberdacker it is your turn now to comment.1 point
-
Like others nearly all code I write has a turn off osnaps or set as required within the code . You can see the numbers for osmode by setting your osnaps then just type osmode. I use 47 a lot. (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) ... lots of code at end of code (setvar 'osmode oldsnap) want user in code to pick an end point (setvar 'osmode 1) pick center of circle (setvar 'osmode 4)1 point
-
I looked for a bit yesterday, there were a few reverse-string codes, never saw where they were usable in DCL, maybe. I read one recommending using Unicode to do this. Some other issues is the computer's language and English or Arabic, etc., keyboard. You have to make sure the text style supports Arabic characters, etc. There might be a way with VBA, I don't have any method to test unless I set up my computer for Right-to-Left text. I know we have at least a couple of LISPers that use Right-to-Left languages, maybe they will chime in. I need to make this a separate thread as it's not really in line with the OP. Here is the original thread if anyone needs to reference it.1 point
-
I've done most of my time in civil, so it's infrastructure stuff like manholes, valves, hydrants, water meters, and sewer cleanouts. Hundreds and hundreds of meters and cleanouts.1 point
-
Like others having done drainage design. You can get Closestpointto using VL. But as I said in drainage design a Gully joins to a certain pipe not a random one. So you could pick gullys then pick a pipe. The pipe would need to be drawn in the downhill direction so that solves the joining direction. Need to take into account are pipes lines or plines. I may have a play given time. Have a look at "Civil Site design" it has a drainage module, Get pit areas, interactive design of pipe sizes and grades, multiple pit types plot long sections and so on. For Civ3D and Bricscad. https://www.youtube.com/watch?v=sIMfK63yIEk got to the 40 minute mark to see drainage.1 point
-
Hi The first thing, I suppose, is to select the block to consider and its reference point. Then you should create a set with all the polylines. From there: - Analyze each polyline in the set and obtain each of its segments to check if it is possible, from the block's reference point to any point on the segment, to create a vector that forms a 45° angle with it. - In each case where this occurs, store the vector's point of convergence on the segment + the vector's length in a list. - When the process is complete, sort the resulting list with 'vl-sort' from shortest to longest: the first element of the resulting list will contain the point from which to draw the line between the block and the correct polyline.1 point
-
1 point
-
Select all the blocks, then right mouse click and select properties. This should show how similar all the blocks are, *varies* means that property differs across the blocks. This screen will allow you to set the x , y and z scale factor of all the blocks at the same time, relative to each blocks insertion point.1 point
-
As I expected it is very difficult for me to modify the Lee's code. I followed another road, maybe not perfect but it solves my problem. notes: - Increase the value of step1 for greater certainty of outcome - I think step1 = 60 a good relationship time/accuracy - Function LM:LWPoly->List of lisp MinimumEnclosingCircle (Lee Mac) instead of my Vert_poly also describes the curves of the polylines, if inserted in lisp you can also check with curves polyline. Finally, sorry for my English. (defun C:TEST (/ Dx Dy Lp List_vert_poly list_p_int P_center dist) (prompt "\nSelect Polyline: ") (setq POLY_vl (vlax-ename->vla-object (ssname (ssget ":S" '((0 . "POLYLINE,LWPOLYLINE"))) 0))) (Vert_poly) (grid_1) (Point_int) (Point_center) (repeat 3 (grid_2) (Point_center) ) (entmake (list (cons 0 "CIRCLE") (cons 8 (getvar "clayer")) (cons 10 P_center) (cons 40 dist) ) ) (princ) ) ; Returns a list of polyline vertices (defun Vert_poly (/ n_par pt) (setq list_vert_poly nil) (setq n_par (fix (vlax-curve-getendparam POLY_vl))) (repeat n_par (setq pt (vlax-curve-getpointatparam POLY_vl (setq n_par (1- n_par)))) (setq list_vert_poly (cons pt list_vert_poly)) (if (/= (last pt) 0.0) (progn (alert (strcat "Invalid Object Selected" "\nz-coordinate vertices not = 0.0")) (exit) ) ) ) ) ; Returns a grid of points within the BoundingBox of the selected poly (defun grid_1 (/ P1_ P2_ n P> step1) (setq step1 60) (vla-getboundingbox POLY_vl 'p1 'p2) (setq P1_ (vlax-safearray->list p1)) (setq P2_ (vlax-safearray->list p2)) (setq P1_ (list (car P1_) (cadr P1_))) (setq P2_ (list (car P2_) (cadr P2_))) (setq Dx (/ (- (car P2_) (car P1_)) step1)) (setq Dy (/ (- (cadr P2_) (cadr P1_)) step1)) (setq n 0) (setq P> P1_) (setq Lp (list P1_)) (repeat (* (1+ step1) step1) (setq P> (list (+ (car P>) Dx) (cadr P>))) (setq Lp (cons P> Lp)) (setq n (1+ n)) (if (= n step1) (progn (setq n 0) (setq P1_ (list (car P1_) (+ (cadr P1_) Dy))) (setq P> P1_) (setq Lp (cons P> Lp)) ) ) ) ) ; Returns a grid of dots around the center point (provisional) (defun grid_2 (/ P1_ step2 P> n) (setq step2 30) (setq list_p_int nil) (setq P1_ (list (- (car P_center) Dx) (- (cadr P_center) Dy))) (setq Dx (/ (* 2 Dx) step2)) (setq Dy (/ (* 2 Dy) step2)) (setq n 0) (setq P> P1_) (setq list_p_int (list P1_)) (repeat (* (1+ step2) step2) (setq P> (list (+ (car P>) Dx) (cadr P>))) (setq list_p_int (cons P> list_p_int)) (setq n (1+ n)) (if (= n step2) (progn (setq n 0) (setq P1_ (list (car P1_) (+ (cadr P1_) Dy))) (setq P> P1_) (setq list_p_int (cons P> list_p_int)) ) ) ) ) ; Returns the list of points inside the polyline (defun Point_int (/ P_distant n Pr cont attr p# Pa Pa_ Pb ) (setq P_distant (polar (car Lp) 0 10000000)) (setq list_p_int nil) (repeat (setq n (length Lp)) (setq Pr (nth (setq n (1- n)) Lp)) (setq cont -1) (setq attr 0) (setq p# nil) (setq Pa (nth (setq cont (1+ cont)) list_vert_poly)) (setq Pa_ Pa) (repeat (length list_vert_poly) (setq Pb (nth (setq cont (1+ cont)) list_vert_poly)) (if (= cont (length list_vert_poly)) (setq Pb Pa_)) (setq P# (inters Pa Pb Pr P_distant)) (if (/= P# nil) (setq attr (1+ attr))) (setq Pa Pb) ) (if (> (rem attr 2) 0) (setq list_p_int (cons Pr list_p_int))) ) ) ; Returns the farthest point from the polyline (defun Point_center (/ Pa n Pvic) (setq Dist 0.0000001) (setq P_center nil) (repeat (setq n (length list_p_int)) (setq Pa (nth (setq n (1- n)) list_p_int)) (setq Pvic (vlax-curve-getClosestPointTo POLY_vl Pa)) (if (> (distance Pa Pvic) Dist) (progn (setq P_center Pa) (setq Dist (distance Pa Pvic)) ) ) ) ) (vl-load-com) (princ)1 point