Handling Multiple Entity Types
 
 
 

The first detail is that your application may draw two kinds of polylines: old-style and lightweight. These different polyline types return their entity data in different formats. The old-style polyline returns a list of twelve reals: four sets of X, Y, and Z points. The lightweight polyline, though, returns a list eight reals: four sets of X and Y points.

You need to do some calculations to determine the revised polyline boundary after a user moves one of the vertices. It will be a lot easier to do the calculations if the polyline data has a consistent format.

The Lesson 7 version of the utils.lsp file contains functions to perform the necessary format conversions: xyzList->ListOfPoints extracts and formats 3D point lists into a list of lists, and xyList->ListOfPoints extracts and formats 2D point lists into a list of lists.

To add the code for converting polyline data into a consistent format

  1. If you have a copy of utils.lsp open in a VLISP text editor window, close it.
  2. Copy the version of utils.lsp from the Tutorial\VisualLISP\Lesson7 directory into your working directory.

    In addition to the two functions that reformat polyline data, utils.lsp contains additional utility functions needed in handling user alterations to the garden path.

  3. Open utils.lsp in a VLISP text editor window and review the new code.