SurveyLisp - AutoCAD and newLisp example.

Started by Sunburned Surveyor, February 17, 2005, 07:26:42 AM

Previous topic - Next topic

Sunburned Surveyor

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

HPW

#1
>I could also write an executable in newLisp



You mean you use the bind-feature to bind a source to the newLISP interpreter?



I use newLISP in a similar way like in your project. I only do not use GTK-Server, I use neobook for the GUI part. That EXE is launched from an alisp and autocad is called back when the callback-lsp is ready to read.



All other things sounds familar to me, but I am so busy with newLISP and neobook that I can not get into other projects. ;-)
Hans-Peter

Sunburned Surveyor

#2
I was hoping to make an executable for newLisp using a process similar to the one for CLISP as explained in this link:



http://www.turtle.dds.nl/gtk-server/index.html">http://www.turtle.dds.nl/gtk-server/index.html



I haben't tried it yet.



What method our you using?



Where do I learn more about the bind-feature you mentioned? I would like to learn about the method you use. (If your willing to share. :] )



Landon

Lutz

#3
What do you mean?



Either you can look for sample code of newLISP to talk to GTK-server on the GTK-server site or you mean making an newLISP executable with lisp code linked? you can find that in chapter 20 in the manual.



Lutz

Lutz

#4
I had missed your first, longer post. You definitely mean the link feature in newLISP, whch you find explained in the manual in chapter 20.



Lutz



Ps: I am travelling overseas starting tomorrow and may not be always as quick in answering email etc., but think I will be on the internet at least once a day.

Sunburned Surveyor

#5
Thanks Lutz.....I'll check out chapter 20.



The Sunburned Surveyor

HPW

#6
>I would like to learn about the method you use. (If your willing to share. :] )



Nothing special, I use the newLISP.DLL from the neobook app, so I have only one main process. Of course I can mix neobook script functions with newLISP-code. And the neobook plugin architecture allows needed improvements. For example I use one of my plugins to send the callback to the acad command line.
Hans-Peter

Sunburned Surveyor

#7
Thanks HPW....I'll want to talk to you when I start coding. Thanks for your help.



Landon

pjot

#8
Hi Sunburned,



A standalone version of a newLisp executable (chapter 20 newLisp manual) together with the GTKserver+GTK can be found here:



http://www.turtle.dds.nl/gtk-server/UDP-Chat.zip">http://www.turtle.dds.nl/gtk-server/UDP-Chat.zip



In a similar way you can distribute your own application.



Peter