SurveyLisp - AutoCAD and newLisp example.
Posted: Thu Feb 17, 2005 3:26 pm
I have had some questions from newLisp users about my SurveyLisp project.
More specifically, they were curious how I was using newLisp in AutoCAD.
I wanted to clarify that here. I'm not technically using newLisp inside of AutoCAD, although it may appear that way to the user.
Let me give you an example of what I am doing:
The user has a 3D polyline that represents the centerline of a road. They want to create offsets of this polyline
that represent the road's lip of gutter, flowlone of gutter, top face of curb, and back of sidewalk. I will need four
pieces of information from the user to create the offsets.
(1) The name of each offset type. (For example: Flowline)
(1) Horizontal distance to each offset.
(3) Vertical distance to each offset.
(4) The layer of each offset polyline.
(5) The linetype of each polyline.
(6) The polyline to offset. (The road centerline.)
I create an Autolisp routine called "CreateRoadOffsets.lsp" that prompts the user to select the polyline that
represents the road centerline. The Autolisp routine then writes the X, Y, and Z coordinate of each node of the
polyline to a text file in XML or Lisp list format. It stores this file in a folder called "Communications". It then
fires an executable called "CreateRoadOffsets.exe" that contains my newLisp code. This executable creates a GUI using
newLisp and GTK-Server that allows the user to enter our required information. The executable then stores this
information as newLisp symbols and uses them to write a piece of Autolisp code that creates the desired offset
polylines. It then saves this chunk of code to a text file called "CreateRoadOffsetsALCode.lsp". It saves this text
file in the same "Communications" folder, and deletes the text file created by "CreateRoadOffsets.lsp" in the folder.
My executable then closes, returning control to the original AutoLisp routine. The AutoLisp routine then reads in
CreateRoadOffsetsALCode.lsp and executes it, creating our offsets as desired.
I could also write an executable in newLisp that creates a GUI that allows the user to design "road offset
templates". These templates would store the required information and write them to disk. These templates could then be used in the "CreateRoadOffests.exe" mentioned previously, instead of entering the offset data manually. I would then write Autolisp code to run this executable, and place it in a menu named "Roads", under the command "CreateRoadOffsetsTemplate."
If you have anymore questions, please let me know. I would welcome any Lispers as volunteers to the SurveyLisp project.
The Sunburned Surveyor
More specifically, they were curious how I was using newLisp in AutoCAD.
I wanted to clarify that here. I'm not technically using newLisp inside of AutoCAD, although it may appear that way to the user.
Let me give you an example of what I am doing:
The user has a 3D polyline that represents the centerline of a road. They want to create offsets of this polyline
that represent the road's lip of gutter, flowlone of gutter, top face of curb, and back of sidewalk. I will need four
pieces of information from the user to create the offsets.
(1) The name of each offset type. (For example: Flowline)
(1) Horizontal distance to each offset.
(3) Vertical distance to each offset.
(4) The layer of each offset polyline.
(5) The linetype of each polyline.
(6) The polyline to offset. (The road centerline.)
I create an Autolisp routine called "CreateRoadOffsets.lsp" that prompts the user to select the polyline that
represents the road centerline. The Autolisp routine then writes the X, Y, and Z coordinate of each node of the
polyline to a text file in XML or Lisp list format. It stores this file in a folder called "Communications". It then
fires an executable called "CreateRoadOffsets.exe" that contains my newLisp code. This executable creates a GUI using
newLisp and GTK-Server that allows the user to enter our required information. The executable then stores this
information as newLisp symbols and uses them to write a piece of Autolisp code that creates the desired offset
polylines. It then saves this chunk of code to a text file called "CreateRoadOffsetsALCode.lsp". It saves this text
file in the same "Communications" folder, and deletes the text file created by "CreateRoadOffsets.lsp" in the folder.
My executable then closes, returning control to the original AutoLisp routine. The AutoLisp routine then reads in
CreateRoadOffsetsALCode.lsp and executes it, creating our offsets as desired.
I could also write an executable in newLisp that creates a GUI that allows the user to design "road offset
templates". These templates would store the required information and write them to disk. These templates could then be used in the "CreateRoadOffests.exe" mentioned previously, instead of entering the offset data manually. I would then write Autolisp code to run this executable, and place it in a menu named "Roads", under the command "CreateRoadOffsetsTemplate."
If you have anymore questions, please let me know. I would welcome any Lispers as volunteers to the SurveyLisp project.
The Sunburned Surveyor