Page 1 of 1

SurveyLisp - AutoCAD and newLisp example.

Posted: Thu Feb 17, 2005 3:26 pm
by 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

Posted: Thu Feb 17, 2005 4:23 pm
by HPW
>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. ;-)

newLisp EXE

Posted: Thu Feb 17, 2005 4:38 pm
by Sunburned Surveyor
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

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

Posted: Thu Feb 17, 2005 6:38 pm
by Lutz
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

Posted: Thu Feb 17, 2005 7:09 pm
by Lutz
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.

Posted: Thu Feb 17, 2005 7:29 pm
by Sunburned Surveyor
Thanks Lutz.....I'll check out chapter 20.

The Sunburned Surveyor

Posted: Thu Feb 17, 2005 7:51 pm
by HPW
>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.

Posted: Thu Feb 17, 2005 7:56 pm
by Sunburned Surveyor
Thanks HPW....I'll want to talk to you when I start coding. Thanks for your help.

Landon

Posted: Wed Feb 23, 2005 11:00 pm
by pjot
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

In a similar way you can distribute your own application.

Peter