Friends: Leaflet Printing , Property in Dubai , Talia Cad Software

Sign In

Subscribe

Subscribe to Daily Autocad.


Nov 14
Friday
AutoLISP, Download
AutoLISP Application for Changing Polyline Width.

Hello friends,

Today I will give an example of a LISP application that you can use to change POLYLINE width. I suggest you check the codes even if the specific example doesn’t fit your needs.

Command: KM_PWIDTH
Select objects:

(Select the POLYLINE objects that you want to edit)

Specify new width for POLYLINE <0>:

(Specify the POLYLINE width or hit ENTER to accept the default value)

The C:KM_PWIDTH function makes up the main part of the program. The (ssget) function here is used to make up the selection set. (PWidth-Get-Value)is used to prompt for the desired value and then the (PWidth-Modify) function is activated.


Code.1 - The main function: “C:KM_PWIDTH”

PWidth-Set-Value function acts on two kinds of POLYLINE objects. One of them is the old (AcDbPolyline) objects, which is no longer used, while the other is the optimized polyline (LightWeight Polyline / AcDb2dPolyline).

NOTE: Some programs may require the old kind of POLYLINE objects made with AutoCAD R14 versions. You can convert back using the _CONVERTPOLY command.

PLINETYPE system variable is set to two (2) as default. I suggest you don’t change this value as it enables you to create optimized polyline objects. It also helps reduce the filesize of your drawing.


Code.2 - Sub- function “PWidth-Set-Value”

PWidth-Modify processes the selection set we just made. It browses through the whole selection set and forwards the objects onto the PWidth-Set-Value function.


Code.3 - Sub- function “PWidth-Modify”

The  PWidth-Get-Value function is used to ask for a real number from the user. The last used number is also shown to help the user in repetitive works. It converts numbers that are less than zero (0). You can make this process mandatory using the (initget)function. The return value of the function is a real number.

onksiyonun görevi kullanıcıdan herhangi bir reel sayının girmesini sağlamaktır. Bir önce girilen değer kullanacıya tekrar sunulur ve böylelikle kolaylık sağlar. Sıfırdan küçük olan verileri geri çevirir. Bu tür işlemi AutoLisp fonksiyonu (initget) ile zorunlu kılabilirsiniz. Fonksiyonumuzun geri dönüş değeri (return value) reel sayıdır.

Note: the real number that specifies the width of the polyline ojects is stored in a variable in the global medium. (glv:polyline:width).


Code.4 - Sub- function “PWidth-Get-Value”

Visual-Lisp commands used in this program::

(vla-get-ObjectName)
(vlax-variant-value)
(vlax-safearray-get-l-bound)
(vlax-safearray-get-U-bound)
(vlax-method-applicable-p)
(vlax-write-enabled-p)
(vl-catch-all-error-p)
(vl-catch-all-apply)

Have a nice day..

  Poly-Width.lsp (4.6 KiB, 117 hits)
You need to be a registered user to download this file.

Viewed 800 times so far... This week: 29 Today: 6 Latest: 7 January 2009, 12:48

Post Tags: , ,

Post a Comment



All content and source © 2008 Daily Autocad | News Plus wordpress theme brought to you by Zidalgo.