Friday
AutoLISP, DownloadAutoLISP 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, 318 hits)
You need to be a registered user to download this file.
Post Tags: AutoLISP, Download, POLYLINE
Related Posts
Popular
- Hip tip: Increasing view resolution with VIEWRES system variable
07/03/2009 04:39 am
7 Comments - Sirince – IZMIR
07/02/2009 11:02 am
1 Comment - Visual LISP: Programming user interfaces with OpenDCL
07/01/2009 10:15 pm
10 Comments - 3D Modeling 7: EXTRUDE
06/30/2009 02:14 pm
10 Comments - Ask DailyAutoCAD: Which Notebook to Buy?
06/30/2009 12:17 pm
1 Comment
Featured Articles
- AutoCAD 2009 Update 3 Released
- Speed Up As AutoCAD 2009 Ribbon Menu Helps You!
- MEP Analysis Extension for AutoCAD MEP extended to March 31, 2009
- Recap of AutoCAD-related technologies on Autodesk Labs
- Technology Preview of MEP Analysis Extension extended to 12/31/08
- Autodesk Labs: Forward and Backward utility for AutoCAD
|

