Efeezy Posted April 9, 2010 Posted April 9, 2010 Hey Guys: I am looking a tip trick or lisp to make all my polylines the same width. I have the plines on multiple layers. Is there a fast way to do this? I am just pissed and not thinking straight. I was thinking layiso Quote
Lee Mac Posted April 9, 2010 Posted April 9, 2010 Very quick one: (defun c:PWid (/ w doc ss) (vl-load-com) (if (and (ssget "_:L" '((0 . "*POLYLINE"))) (setq w (getdist "\nNew Width? : "))) (progn (vla-StartUndoMark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))) (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc)) (vla-put-ConstantWidth obj w)) (vla-delete ss) (vla-EndUndoMark doc))) (princ)) Quote
lpseifert Posted April 9, 2010 Posted April 9, 2010 Lee gave a Lisp, here's a tip trick... From Properties click on the Select Objects icon > All > Enter From the dropdown > Polyline Geometry > Global width If you need polylines on a certain layer only, use the Quick Select icon, or Express Tools' Getsel command. Quote
Efeezy Posted April 9, 2010 Author Posted April 9, 2010 WOW NICE THANK YOU IT WORKS SMOOTH. Lee Mac IS THE S#IT !!!! Quote
alanjt Posted April 9, 2010 Posted April 9, 2010 FYI... Command: pe PEDIT Select polyline or [Multiple]: m Select objects: Specify opposite corner: 4 found Select objects: Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Undo]: w Specify new width for all segments: 0 Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Undo]: Also, 3DPolylines can't carry a width. If one is selected by your routine Lee, it will fail. Quote
Lee Mac Posted April 9, 2010 Posted April 9, 2010 Also, 3DPolylines can't carry a width. If one is selected by your routine Lee, it will fail. OK, it was only a quick one Quote
alanjt Posted April 10, 2010 Posted April 10, 2010 OK, it was only a quick one Just wanted to make sure you knew. Quote
Lee Mac Posted April 10, 2010 Posted April 10, 2010 Just wanted to make sure you knew. I didn't, thanks Quote
Yoland Posted August 19, 2010 Posted August 19, 2010 Hi. Sorry for my english, and sorry if the post is answered, but is there a routine that change only the width of a segment of polyline?? Thanks a lot. Bye Yolanda Quote
lpseifert Posted August 19, 2010 Posted August 19, 2010 is there a routine that change only the width of a segment of polyline?? Here's a start... will change the starting width to 3 and the ending width to 5 at the curve's (polyline's) 2nd segment (parameter 1) (vl-load-com) (setq obj (vlax-ename->vla-object (car (entsel)))) (vla-setwidth obj 1 3.0 5.0) Quote
Lee Mac Posted August 19, 2010 Posted August 19, 2010 Twas bored... [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:SegWid [b][color=RED]([/color][/b] [b][color=BLUE]/[/color][/b] s o e sw ew p [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; © Lee Mac 2010[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] s [b][color=RED]([/color][/b][b][color=BLUE]entsel[/color][/b] [b][color=#a52a2a]"\nSelect Polyline Segment: "[/color][/b][b][color=RED]))[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-method-applicable-p[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] o [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] s[b][color=RED]))))[/color][/b] [b][color=DARKRED]'[/color][/b]SetWidth [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] sw [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getdist[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#a52a2a]"\nSpecify Segment Start Width <"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]rtos[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=DARKRED]'[/color][/b]PLINEWID[b][color=RED]))[/color][/b] [b][color=#a52a2a]"> : "[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getPointatParam[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] p [b][color=RED]([/color][/b][b][color=BLUE]fix[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getParamatPoint[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getClosestPointto[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]cadr[/color][/b] s[b][color=RED]))[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=DARKRED]'[/color][/b]PLINEWID[b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ew [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getdist[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#a52a2a]"\nSpecify Segment End Width <"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]rtos[/color][/b] sw[b][color=RED])[/color][/b] [b][color=#a52a2a]"> : "[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getPointatParam[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]1+[/color][/b] p[b][color=RED]))[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b] sw [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-SetWidth[/color][/b] o p sw ew[b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b] [b][color=RED])[/color][/b] Quote
lpseifert Posted August 19, 2010 Posted August 19, 2010 Lee, you'd be a great teacher to have - you supply the answers with the lesson... Quote
alanjt Posted August 19, 2010 Posted August 19, 2010 Lee already posted, but I wanted to play anyway... (defun c:PSW (/ e o bw ew) ;; Change segment width of selected *Polyline ;; Required Subroutine: AT:GetSel ;; Alan J. Thompson, 08.19.10 (if (setq e (AT:GetSel entsel "\nSelect *Polyline segment: " (lambda (x) (vlax-method-applicable-p (setq o (vlax-ename->vla-object (car x))) 'SetWidth ) ) ) ) ((lambda (seg) (vla-GetWidth o seg 'bw 'ew) (while (not (vl-position "Exit" (list bw ew))) (initget 4 "Exit") (if (numberp (setq bw (cond ((getdist (strcat "\nSpecify BEGIN segment width [Exit] <" (rtos bw) ">: " ) ) ) (bw) ) ) ) (progn (initget 4 "Exit") (if (numberp (setq ew (cond ((getdist (strcat "\nSpecity END segment width [Exit] <" (rtos ew) ">: " ) ) ) (ew) ) ) ) (vla-SetWidth o seg bw ew) ) ) ) ) ;;; (while (progn (initget 4) ;;; (setq wd (getdist (strcat "\nSpecify new segment width" ;;; (cond ((numberp wd) (strcat " <" (rtos wd) ">: ")) ;;; (": ") ;;; ) ;;; ) ;;; ) ;;; ) ;;; ) ;;; (vla-SetWidth o seg wd wd) ;;; ) ) (fix (vlax-curve-getParamAtPoint (car e) (vlax-curve-getClosestPointTo (car e) (trans (cadr e) 1 0)) ) ) ) ) (princ) ) (defun AT:GetSel (meth msg fnc / ent good) ;; meth - selection method (entsel, nentsel, nentselp) ;; msg - message to display (nil for default) ;; fnc - optional function to apply to selected object ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC"))) ;; Alan J. Thompson, 05.25.10 (setvar 'errno 0) (while (not good) (setq ent (meth (cond (msg) ("\nSelect object: ") ) ) ) (cond ((vl-consp ent) (setq good (cond ((or (not fnc) (fnc ent)) ent) ((prompt "\nInvalid object!")) ) ) ) ((eq (type ent) 'STR) (setq good ent)) ((setq good (eq 52 (getvar 'errno))) nil) ((eq 7 (getvar 'errno)) (setq good (prompt "\nMissed, try again."))) ) ) ) Quote
Lee Mac Posted August 19, 2010 Posted August 19, 2010 Lee, you'd be a great teacher to have - you supply the answers with the lesson... :) :) Quote
alanjt Posted August 19, 2010 Posted August 19, 2010 One more, for fun. I liked Lee's idea of using GetDist from the segment point (nice work BTW). It's basically the same as Lee's, but I'd already written the first one and this was a minor change. (defun c:PSW (/ e o bw ew) ;; Change segment width of selected *Polyline ;; Required Subroutine: AT:GetSel, AT:DrawX ;; Alan J. Thompson, 08.19.10 (if (setq e (AT:GetSel entsel "\nSelect *Polyline segment: " (lambda (x) (vlax-method-applicable-p (setq o (vlax-ename->vla-object (car x))) 'SetWidth ) ) ) ) ((lambda (p) (vla-GetWidth o p 'bw 'ew) (while (not (vl-position "Exit" (list bw ew))) (redraw) (initget 4 "Exit") (if (numberp (setq bw (cond ((getdist (AT:DrawX (trans (vlax-curve-getPointAtParam (car e) p) 0 1) 1) (strcat "\nSpecify BEGIN segment width [Exit] <" (rtos bw) ">: " ) ) ) (bw) ) ) ) (progn (vla-SetWidth o p bw ew) (redraw) (initget 4 "Exit") (if (numberp (setq ew (cond ((getdist (AT:DrawX (trans (vlax-curve-getPointAtParam (car e) (1+ p)) 0 1) 3) (strcat "\nSpecity END segment width [Exit] <" (rtos ew) ">: " ) ) ) (ew) ) ) ) (vla-SetWidth o p bw ew) ) ) ) ) (redraw) ) (fix (vlax-curve-getParamAtPoint (car e) (vlax-curve-getClosestPointTo (car e) (trans (cadr e) 1 0)) ) ) ) ) (princ) ) (defun AT:GetSel (meth msg fnc / ent good) ;; meth - selection method (entsel, nentsel, nentselp) ;; msg - message to display (nil for default) ;; fnc - optional function to apply to selected object ;; Ex: (AT:GetSel entsel "\nSelect arc: " (lambda (x) (eq (cdr (assoc 0 (entget (car x)))) "ARC"))) ;; Alan J. Thompson, 05.25.10 (setvar 'errno 0) (while (not good) (setq ent (meth (cond (msg) ("\nSelect object: ") ) ) ) (cond ((vl-consp ent) (setq good (cond ((or (not fnc) (fnc ent)) ent) ((prompt "\nInvalid object!")) ) ) ) ((eq (type ent) 'STR) (setq good ent)) ((setq good (eq 52 (getvar 'errno))) nil) ((eq 7 (getvar 'errno)) (setq good (prompt "\nMissed, try again."))) ) ) ) (defun AT:DrawX (P C) ;; Draw and "X" vector at specified point ;; P - Placement point for "X" ;; C - Color of "X" (must be integer b/w 1 & 255) ;; Alan J. Thompson, 10.31.09 (if (vl-consp P) ((lambda (d) (grvecs (cons C (mapcar (function (lambda (n) (polar P (* n pi) d))) '(0.25 1.25 0.75 1.75) ) ) ) P ) (* (getvar 'viewsize) 0.02) ) ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.