Fast change line, polyline, arc global width

Fast change line, polyline, arc global width

ancrayzy
Advocate Advocate
3,175 Views
6 Replies
Message 1 of 7

Fast change line, polyline, arc global width

ancrayzy
Advocate
Advocate

1. In the usual way, to change the thickness of a line, polyline, or arc...
I typically use the following method:
Type the command PL -> Start point -> select [Width] -> Specify starting width <xxx> -> Specify ending width <xxx>:
2. Is there any way to quickly and simply change this process, for example, like this:
Type the command ChangeGW -> enter the Global Width parameter of current layer (in mm) -> Enter to end the command

0 Likes
Accepted solutions (1)
3,176 Views
6 Replies
Replies (6)
Message 2 of 7

johnyDFFXO
Advocate
Advocate

PlineWidth is a global property, it has nothing to do with layers. Can't be set (only) for current layer.

PLINEWID system variable is probably what you want. Use PGP alias if you want to have a different name for it.

Message 3 of 7

ancrayzy
Advocate
Advocate

Thank you for you reply @johnyDFFXO 
I mean there is any way to shortened the routines below with autolisp

 

Type the command PL -> Start point -> select [Width] -> Specify starting width <xxx> -> Specify ending width <xxx>:

 

 

0 Likes
Message 4 of 7

ancrayzy
Advocate
Advocate

I have created a lisp as below and it's work good for my request and I want to share with everyone.

If there is any better ideas, please comment to make it better.

 

 

(defun c:ChangeGW (/ width)
  (setq width (getreal "\nEnter the Global Width parameter (in mm): "))
  (if width
    (progn
      (setvar "PLINEWID" width)
      (princ (strcat "\nGlobal width set to " (rtos width 2 2) " mm. Use the PL command to draw polylines with this width."))
    )
    (princ "\nInvalid width.")
  )
  (princ)
)

(defun c:PL ()
  (command "_PLINE")
  (while (setq pt (getpoint "\nSpecify next point or [Arc/Halfwidth/Length/Undo/Width]: "))
    (command pt)
  )
  (command "")
  (princ)
)

 

 

 

0 Likes
Message 5 of 7

Sea-Haven
Mentor
Mentor
Accepted solution

If you have a few like less that 10 widths that you always use then make multiple defuns that just set the Pline width then call the make pline as a seperate function. You used "PL" which is a built in function it is better to not do that.

(defun c:GW1 ( / )
(setvar "PLINEWID" 1)
(c:plx)
)
(defun c:GW2 ( / )
(setvar "PLINEWID" 2)
(c:plx)
)
(defun c:GW3 ( / )
(setvar "PLINEWID" 3)
(c:plx)
)

(defun c:PLx ( / )
(setq pt (getpoint "\nSpecify start point "))
  (command "_PLINE" pt)
  (while (setq pt (getpoint (getvar 'lastpoint)  "\nPick next point Enter to finish "))
    (command pt)
  )
  (command "")
  (princ)
)

A way more advanced way is you can type P3 p23 ie pxx where xx can be any number including say 123.45. It uses a reactor to see what is after the "P" and uses that value. Currently I do C123 O123 F123 for circle, offset and fillet as any value. But maybe try the simple way 1st. In what I am talking about can have 26 commands A-Z. 

Message 6 of 7

Kent1Cooper
Consultant
Consultant

@ancrayzy wrote:

....
I mean there is any way to shortened the routines below with autolisp

Type the command PL -> Start point -> select [Width] -> Specify starting width <xxx> -> Specify ending width <xxx>:

The ending width default offered is always the starting width you just gave it, so you can use Enter to accept that.

 

(defun C:ChangeGW () (command "_.pline" "_width" pause ""))

 

That will leave you in the PLINE command, at the point of choosing your next point or option [such as Arc].

Kent Cooper, AIA
Message 7 of 7

ancrayzy
Advocate
Advocate

Thanks @Kent1Cooper and @Sea-Haven for your valuable help.

Regards !

0 Likes