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, 117 hits)
You need to be a registered user to download this file.
Post Tags: AutoLISP, Download, POLYLINE
Related Posts
Popular
- Hip tip: Fast coordinate input.
No comments - Arc drawing techniques in AutoCAD
01/07/2009 02:32 am
14 Comments - Hip tip: How to bring back the lost command line?
01/06/2009 03:58 pm
6 Comments - New CAD Blog Alert: CADuzer.com
01/05/2009 07:57 pm
1 Comment - 3D/2D ShareNow supports AutoCAD flavors - both 2008 and 2009
01/05/2009 05:31 pm
4 Comments
Featured Articles
- 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
- Autocad 2009 and Autocad LT 2009 Service Pack 1 Released
- AutoCAD 2009 resources
- Animate your 3D models with AutoCAD 2009’s SHOW MOTION!
