Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/10/2025 in all areas

  1. @andyb57J Here's another way to do it using entmakex. I hardcoded the 'STAGE' prefix: (defun c:cnl (/ cnt el i la llst ss) (if (and (setq ss (ssget)) (> (setq i (getint "\nEnter number of stages: ")) 0)) (progn (repeat (setq cnt (sslength ss)) (setq el (entget (ssname ss (setq cnt (1- cnt)))) la (cdr (assoc 8 el)) ) (or (member la llst) (setq llst (cons la llst))) ) (foreach n llst (setq cnt 0) (repeat i (setq el (entget (tblobjname "LAYER" n) '("*"))) (entmakex (subst (cons 2 (strcat "STAGE " (itoa (setq cnt (1+ cnt))) "_" n)) (assoc 2 el) el) ) ) ) ) ) (princ) )
    2 points
  2. If you also want to change the lines, add (vla-put-ExtensionLineColor obj 1) (vla-put-DimensionLineColor obj 1)
    2 points
  3. @Steven P ok . Upload 2D layout drawing with about 40 blocks
    1 point
  4. Thankyou. This is perfect. Only thing I would add is an underscore after the Stage no. I have addressed your other queries to provide the results but can't wok out where to put the underscore so it appears after the stage no. This lisp will most likely only be used to create the stage no layers so the prefix and suffix part will not be required. If I need those, I still have the original lisp.
    1 point
  5. Try changing vla-put-color to vla-put-textColor
    1 point
  6. You might need to post a sample drawing, perhaps a before and after too This is what I got with a quick check:
    1 point
  7. Hi Nikon It's probably because the text color in the dimension style is set to "bylayer."
    1 point
  8. PS: The option to measure the offset distance with the cursor will always be calculated orthogonally with respect to the vector defined by the selected segment It is also possible that I have forgotten to include some of the variables in the list of local variables: this is a small job that I leave for whoever wants to use this code.
    1 point
  9. I think it turned out nicely. And I hope it's what you need, too ;******************* p o r d e s í a r g o ******************** ;************************ G L A V C V S ************************* ;************************** F E C I T *************************** (defun c:mueveSegmto (/ lstSg dist i se lado op pr pr1 pa pb p1 p2 p3 p4 sgC r dameSgmtos) (defun dameSgmtos (x pk / f d p s a tam a1 a2 b1 b2 c1 c2 sa sp) (setq tam (* (* (getvar "PICKBOX") (/ (getvar "VIEWSIZE") (cadr (setq ss (getvar "SCREENSIZE"))) ) ) 2 ) b2 (cdr (assoc 10 (cdr (member (cons 10 (setq b1 (cdr (assoc 10 x)))) x)))) c1 (cdr (assoc 10 (cdr (member (cons 10 (setq c2 (cdr (assoc 10 (reverse x))))) (reverse x))))) ) (while (and (setq a1 (cdr p) a2 f f (cdr (assoc (if pk 10 11) (setq x (cdr (member (setq p (assoc 10 x)) x)))))) (not (setq i (inters f (cdr p) (polar pk (+ (setq a (angle f (cdr p))) 1.5708) tam) (polar pk (- a 1.5708) tam)))) ) ) (setq sc (list (cdr p) f) f (cdr (assoc (if pk 10 11) (cdr (member (setq p (assoc 10 x)) x)))) sp (if f (list (cdr p) f) (list b1 b2)) sa (if a1 (list a1 a2) (list c1 c2)) ) (list sa sc sp) ) (setq dist (getreal "\nDistance of traslation (ENTER to get the distance on screen): ")) (if (setq lstSg (dameSgmtos (entget (car (setq se (entsel "\nSelect any segment in LWPOLYLINE...")))) (setq pr (cadr se)))) (if (setq pr1 (getpoint (setq pr i) "\nSide to act...")) (if (setq op (if (and (> (setq aC (angle (setq p2 (car (setq sgC (cadr lstSg)))) (cadr sgC))) (setq aR (angle pr pr1))) (< (abs (- aC aR)) PI) ) - + ) ) (setq dist (if dist dist (distance pr1 (inters p2 (setq p3 (cadr sgC)) (polar pr1 (- (setq ar (angle p2 p3)) (/ pi 2)) 9999) (polar pr1 (+ aR (/ pi 2)) 9999) nil)) ) pa (polar p2 (setq a (op (angle p2 (setq p3 (cadr sgC))) (/ pi 2.0))) dist) pb (polar p3 a dist) px1 (inters pa pb (car (car lstSg)) p2 nil) px2 (inters pa pb p3 (cadr (last lstSg)) nil) r (entmod (subst (cons 10 px1) (cons 10 p2) (entget (car se)))) r (entmod (subst (cons 10 px2) (cons 10 p3) (entget (car se)))) ) ) ) ) (princ) )
    1 point
  10. @GLAVCVS agree need the 3 sides, then can work out the internal angle which results in working out the new length of the side lines and a new point, then update the points. This is get segment of pline. (defun getplineseg ( / elst ename pt param preparam postparam) (setq elst (entsel "\nSelect pline segment: ")) (setq ename (car elst)) (setq pt (cadr elst)) (setq pt (vlax-curve-getClosestPointTo ename pt)) (print (setq param (vlax-curve-getParamAtPoint ename pt)) ) (print (setq preparam (fix param)) ) (print (setq postparam (1+ preparam)) ) (setq pt1 (vlax-curve-getPointAtParam ename preparam) pt2 (vlax-curve-getPointAtParam ename postparam)) ) I would have a go but very busy at moment. maybe later on have a couple of outstanding tasks. Some one welcome to use the code provided as a start point, get internal angle is out there also.
    1 point
  11. I think the most important thing is to have something that returns a list of the three segments involved in the modification: - the segment to the left of the selected one - the selected segment - the segment to the right of the selected one. Once this is done, it's a matter of moving the selected segment and calculating the new vertices with the other two segments by calculating intersections. I've attached some code for this. Note that: x = list of an lwpolyline returned by entget pk = point returned by entsel when selecting the segment on the screen (defun dameSgmtos (x pk / f d p i s a tam a1 a2 b1 b2 c1 c2 sa sp) (setq tam (* (* (getvar "PICKBOX") (/ (getvar "VIEWSIZE") (cadr (getvar "SCREENSIZE")) ) ) 2 ) b1 (cdr (assoc 10 x)) b2 (cdr (assoc 10 (cdr (member (cons 10 b1) x)))) c2 (cdr (assoc 10 (reverse x))) c1 (cdr (assoc 10 (cdr (member (cons 10 c2) (reverse x))))) ) (while (and (setq a1 (cdr p) a2 f f (cdr (assoc (if pk 10 11) (setq x (cdr (member (setq p (assoc 10 x)) x)))))) (if pk (not (inters f (cdr p) (polar pk (+ (setq a (angle f (cdr p))) 1.5708) tam) (polar pk (- a 1.5708) tam)))) ) ) (setq sc (list (cdr p) f) f (cdr (assoc (if pk 10 11) (cdr (member (setq p (assoc 10 x)) x)))) sp (if f (list (cdr p) f) (list b1 b2)) sa (if a1 (list a1 a2) (list c1 c2)) ) (list sa sc sp) ) If you do not find a way to use it, I'll try to do it this afternoon or tomorrow. But this is not certain because I have been quite busy for a few days.
    1 point
  12. My idea is must be a pline else pick the 3 lines, when you select a pline segment can get angle of segment so the offset is a sin cos tan answer using polar with corrected distance, then just redo the vertice X&Y value. I think its cos ang * offset. ang is 90 to offest line. maybe later today
    1 point
×
×
  • Create New...