plinewidth change

plinewidth change

Anonymous
Not applicable
1,481 Views
13 Replies
Message 1 of 14

plinewidth change

Anonymous
Not applicable

if default command is (plinewidth).but if i try to change that command...P5.8-the plinewidth is change to 5.8 mils.

if i give P7 - the plinewidth is change to 7 mils...

 

Few examples:

PX-the x is a not constant things....

 i give  p5-the width change to 5 mils

           p8-the width change to 8 mils

           p10-the width change to 10 mils

0 Likes
Accepted solutions (1)
1,482 Views
13 Replies
Replies (13)
Message 2 of 14

patrick_35
Collaborator
Collaborator
Accepted solution

Hi

 

For example

(mapcar '(lambda (x) (eval (list 'defun (read (strcat "c:p" (itoa x))) nil (list 'setvar "plinewid" x))))
        '(0 1 2 3 4 5 6 7 8 9 10)
)

@+

0 Likes
Message 3 of 14

Anonymous
Not applicable

thank you sir  ....

0 Likes
Message 4 of 14

Anonymous
Not applicable
(mapcar '(lambda (x) (eval (list 'defun (read (strcat "c:p" (itoa x))) nil (list 'setvar "plinewid" x))))
        '(0 1 2 3 4 5 6 7 8 9 10)
)

this code  is working well ..every integer or real number is inside in code(in this code upto enter 10 integer numbers)it is working well .but i give real numbers.for eg( 10.1,5.2,5.15,etc) it is not working. .....i am  very difficult to  set all  numbers in this coding....if possible change the code to all integer and real numbers .

0 Likes
Message 5 of 14

patrick_35
Collaborator
Collaborator

Hi

 

You can't use a point to defun's function.

An another

(mapcar '(lambda (a b) (eval (list 'defun (read (strcat "c:p" b)) nil (list 'setvar "plinewid" a))))
        '( 0   1   1.5   2   2.5   3   4   5   6   7   8   9   10)
        '("0" "1" "15"  "2" "25"  "3" "4" "5" "6" "7" "8" "9" "10")
)

@+

0 Likes
Message 6 of 14

Kent1Cooper
Consultant
Consultant

@patrick_35 wrote:

....

(mapcar '(lambda (a b) (eval (list 'defun (read (strcat "c:p" b)) nil (list 'setvar "plinewid" a))))
        '( 0   1   1.5   2   2.5   3   4   5   6   7   8   9   10)
        '("0" "1" "15"  "2" "25"  "3" "4" "5" "6" "7" "8" "9" "10")
)

....


That's fine as long as you don't also need one to set it to 15 mils, or 25 mils, or....  Unlike periods, hyphens are allowed in command names -- consider making that lower list this way, instead:

 

'("0" "1" "1-5"  "2" "2-5"  "3" "4" "5" "6" "7" "8" "9" "10")

 

Then you can have both a P1-5 command to set it to 1.5, and a P15 command to set it to 15 mils.

Kent Cooper, AIA
0 Likes
Message 7 of 14

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... i give real numbers.for eg( 10.1,5.2,5.15,etc)....


Another way to go about it:  Define not as a collection of separate command names, but as a single function that takes an argument for the setting:

 

(defun p (mils) (setvar 'plinewid mils))

 

Then you would use it this way:

(p 10.1)

(p 5.2)

(p 5.15)

etc.

 

which is slightly more cumbersome in usage, since it requires the parentheses and the space between the p and the value, but:


A)  you don't have to have separate command definitions for every value you'll ever want to set it to, and

 

B)  you can give it a value that you've never used before and isn't in any such command definition, without re-doing the other routine to add a definition for that value, and

 

C)  you don't have to remember to use a command name with the value in a different format from the "true" value, e.g. P15 or P1-5 for a result of 1.5, but instead you enter it as the actual numerical value, whether integer or decimal.

Kent Cooper, AIA
0 Likes
Message 8 of 14

patrick_35
Collaborator
Collaborator

You are right, it just to economize a character.

I find that it makes of a labyrinth just to redefine a variable.

 

That allowed to make an exercise of style.

 

@+

0 Likes
Message 9 of 14

Kent1Cooper
Consultant
Consultant

 

And, in new-enough versions at least, while PL is the command alias for the PLINE command, without your typing any more than that it also offers the PLINEWID System Variable to pick on, so you don't need to spell it all out.  Type PL, pick that, give it a value -- still slightly more than with those defined commands or function, but no code is required at all.

PL.png

Kent Cooper, AIA
0 Likes
Message 10 of 14

john.uhden
Mentor
Mentor

I think you are all, um, overmentalized.

 

Just create a PW alias for PLINEWID and type in any **** width you want...

 

PW<space>1.75<return>  DONE

 

Plus, you can pick the width on screen.

John F. Uhden

0 Likes
Message 11 of 14

Anonymous
Not applicable

how  to create a PW alias for PLINEWID...explain details..

if you give lisp file .it is better to analysis to me....

0 Likes
Message 12 of 14

Kent1Cooper
Consultant
Consultant

ALIASEDIT COMMAND, Add button in the dialog box.  If it's not obvious enough from there, read about it in Help.

Kent Cooper, AIA
0 Likes
Message 13 of 14

john.uhden
Mentor
Mentor

As Kent indicated, the easiest way is to use the ALIASEDIT command which I think comes only with Express Tools.

But you could also use a text editor to add the alias to your ACAD.PGP file.  To find where it is, use (findfile "acad.pgp") at the AutoCAD command prompt.  Then use the REINIT command to activate your addition during the current AutoCAD session (check the "PGP" toggle).

John F. Uhden

0 Likes
Message 14 of 14

Anonymous
Not applicable

thank you for your support...

0 Likes