Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating A Pop Up Window

24 REPLIES 24
SOLVED
Reply
Message 1 of 25
Anonymous
3300 Views, 24 Replies

Creating A Pop Up Window

I have two scripts that run a very similar program to make panels. They are called bp47 and bp90. In both programs, I give a start location, width, length and depth and then a drawing is created. Lets just say that bp47 makes a square and bp90 makes a rectangle.

I want to have a script that will use a pop up box that will look similar to the image attached. I made it quickly in paint. I have no idea where to start. Also attached is my code. Two layers must be made before running. 'plate' and x-laser'

Any help is appreciated.

 

-M

24 REPLIES 24
Message 2 of 25
Anonymous
in reply to: Anonymous

I guess what I am actually trying to do is make a DCL that controls the AutoLisp scripts.

Message 3 of 25
Anonymous
in reply to: Anonymous

Hi,

 

This would involve the use of DCL at least, or maybe OpenDCL and in order to build this you should have some more than average LISP knowledge and some experience with DCL and LISP interaction code.

 

The interface is not hard to build, but the connecting code is a little more laborious. So do you think you have the skills to try to build this with someone's help ?

 

And for further reference try to avoid the use of word SCRIPT for LISP code, because script is specifically something else in AutoCAD and can not be combined with any interface nor be based on user input. Using the right name avoids the misleading.

 

 

Message 4 of 25
Anonymous
in reply to: Anonymous

Hello SomeBuddy,

I have a basic knowlege of LISP now and I have no idea how to use DCL. I looked at a tutorial and it wouldn't work for me. I need to get this done for my boss and I have about a week. Look at the tutorial and tell me what I am doing wrong. It is probably small.

 

http://www.afralisp.net/dialog-control-language/tutorials/getting-started-part-1.php

 

Lol, I can't even get the first Dialog Definition to pop up. I made both files, then saved them in a folder on my desktop called DCL. I open autocad and load application of the .lsp file. run the program and I get
;error: quit/ exit abort

What did I do wrong? Is it the "Oh, before I forget, please ensure that you save this file, and it's namesake AutoLisp file, into a directory that is within your AutoCAD search path." Where is that refering to.

 

-M

Message 5 of 25
Anonymous
in reply to: Anonymous

OK,

 

I will try to help you. Basically, what it takes is to create the DCL dialog, then to connect it to the LISP code and then to modify the two functions in order to accept the DCL input values as arguments, instead of asking for user input within the two functions.

 

It would be important if you want to learn this (most probably you know about the saying "Give a man a fish and he will eat for a day. Teach a man to fish and he will eat for the rest of his life."), to try to understand how it works and maybe it's a good idea while I am looking at this, to try to make that tutorial working.

 

It seems that instead of giving two points, you want the user to directly input the width and the height, developping the plate from the Insertion point, isn't it ? But what is the Depth, because the code doesn't seem to build something in 3D!

 

I assume also that instead of using two check boxes we should use two radio buttons, which will impose a single choice, because I don't think that you want to use both routines in the same pass and build two different plates with the same input data. And since we are here, do you want one of the two options to be selected by default ?

 

Can you confirm this and make it a little bit clearer ?

 

Message 6 of 25
Anonymous
in reply to: Anonymous

I am making an elevator panel. The two applications are laser cuttout drawings. It sits up off of the wall by a certian depth. If you look at what is drawn from the application I sent you, you can see there is a main inside rectangle, and 4 outside 'flaps' if you will. These flaps are bent backwards after it has been cut out of steel and allow the panel to sit up off the wall. The depth is the vertical measurment of the top flap. And you are correct that is what I want it to do, and ou are also correct to assume it is not a 3D drawing. Think of making a paper box out of a flat sheet of paper. (see attached picture)  

 

p.s. yes two radio buttons would work better. and it would only need an ok and cancel button. and neither radio needs to be by default. if you have to have one, pick the bp90 and have it on the top. and instead of the select on screen/enter coordinates, a button names pick start point would work fine.

 

-M

Message 7 of 25
Anonymous
in reply to: Anonymous

OK, I see what you  mean.

 

I used to work some sheet metal and assemblies in Mechanical Desktop and I know something about the flat patterns, the laser cutting, the bending, the punching, the PEM's and stuff, although I am a civil engineer 🙂

 

So here is attached the first sketch of this DCL dialog. Take a look and tell me if this works for you.

Message 8 of 25
Anonymous
in reply to: Anonymous

That is absolutly perfect. I know the basics to make something like that now. I went through the tutorials and they halped a lot. And I am mechanical eng but work with the guys on the floor and in office on stuff like this. Project keeps growing and I am trying to juggle a load of tasks. Overwhelming. I appreciate this very much.

Message 9 of 25
Anonymous
in reply to: Anonymous

Ok, there is a small mistake, I forgot to rename the third group of controls and it says Insertion point, but I am going to rename it for 'Dimensions'.

 

So the next step is to connect all this. This is kind of tough to put in words because there is a lot to explain, but I will try to comment the code so that you will have a chance to understand what's going on.

 

Other than connecting the LISP and the DCL (and as you are learning, this is not only about the load_dcl part) there is some input checking to be done, so that the input is always numbers and also to make sure that when OK is pressed all the pertinent information is available. Also, the pick on screen mechanism and hiding the dialog box for a while is also interesting.

 

So keep an eye on this. Maybe I wont be able to finish it for today, but certainly for the next couple of days (I still have my own stuff to do 🙂

 

As a matter of fact I would suggest you that since you have to learn this DCL stuff, it would be a better idea to put the time and energy and learn Object DCL. AutoCAD DCL is a very obsolete, primitive and rigid technology and sooner or later you will be frustrated buy some limitations. ObjectDClL is far more flexible and offers much more options and capabilities and is Quite easy to learn.

Message 10 of 25
Anonymous
in reply to: Anonymous

I completely understand if you cannot finish today. Whenever you can is fine. At least progress is being made. Question: Will this be loaded the same way?? Through Options>Files and add a folder where this program will be?

 

-M

Message 11 of 25
Anonymous
in reply to: Anonymous

I wiil try to finish it before the one week dead line 'suggested' by your boss 🙂

 

You have to place the LSP file and the DCL file in a folder which is declare in your Support Files Search Path (eventually you will create one folder for LISP customization and add that path in your Support Files Search Path. Then you can use the APPLOAD command and then in the Startup Suite, select Contents... -> Add.. and then dig for your LISP file. At the next document opening, the command should be available.

Message 12 of 25
Anonymous
in reply to: Anonymous

Thank you again.

Message 13 of 25
Anonymous
in reply to: Anonymous

So here is a function that should work if you place it in the wright folder and in the end it will pop a message saying which of the two functions should be called and which are the parameters.

 

It's easy to replace the mesassage call with that function call, but first, try to make it work, test it and tomorow I will try to modify the two functions in order to accept these values as arguments, instead of asking for user input.

Message 14 of 25
Anonymous
in reply to: Anonymous

So I saved your .lisp into a folder with my other .lisp programs. Then loaded them all into autocad 'Load Application'. I typed 'makeplate' and the dialog box came up perfect. The interfacing worked well. And when I hit OK it asked to 'Call C:BP90 with the following parameters: (39, 24, 4, 22, 1)' and I hit ok but nothing happens.... Is that suppose to happen?

 

-M

Message 15 of 25
Anonymous
in reply to: Anonymous

As much as I hate to do this, I actually have a third plate. I was looking through your code to see how I could patch the third one in myself and tried adding a radio button right after you set the first two but it did not show up when I ran the application. It is again very similar to the other two, and absolutly identical in the way you input information. I don't know how hard it would be to add this in, bit makes sense to have all three in one application Any help is appreciated as always SomeBuddy.

 

-M

Message 16 of 25
Anonymous
in reply to: Anonymous

OK.

Message 17 of 25
Anonymous
in reply to: Anonymous

Read my yesterday message, it says this is the firs step, the linking routine which controls the DCL and in the end only pops the message. And I was saying that plugging your routines it's a piece of cake, suggesting that maybe you want to try to do it. Afterall I think that it is in your interest to learn more about programming if your bosses have the tendency to simply ask you to program things.

Message 18 of 25
Anonymous
in reply to: Anonymous

Ah, I was only making sure. Are you saying that you are done helping me? How would I go about plugging in my routines?? Also how can I add another radio button. Like I said, I tried adding one and was unsuccessful. Do I need to make the window bigger first. I know the first chunk of code is making the dialog box, but when I edit things like the width to see what happens, nothing changes.

 

p.s. this will be the only thing we need that will use a DCL/Lisp program. We are not that big of a company.

 

-M

Message 19 of 25
Anonymous
in reply to: Anonymous

I have been going through your code a little, and am unsure why you create the temp file, and then later delete it. What is it for?

 

(setq tempfile (vl-filename-mktemp "tempfile.dcl"))
  (setq dclfile (open tempfile "w"))
  (write_dcl_code_to dclfile)
  (close dclfile)

  (setq what_next 2)
  (while (> what_next 1)

    (setq dcl_id (load_dialog tempfile))
    (if (not (new_dialog "makeplate" dcl_id "" *make_plate_dialog_coords*))
      (progn
        (alert "Dialog definition not found.")
        (vl-file-delete tempfile)
        (exit)
      )
    )

 

-M

Message 20 of 25
Anonymous
in reply to: Anonymous

I didn't say it's over helping you. I was just suggesting that maybe it's a good idea to wet your feet a little bit. I've already added a third button as you can see in the attached and I'm trying to plug the routines.

 

The reason why I use a temp file and I delete it, it's because this way of doing it uses a temporary DCL file, so this gives only a LISP file to take care of, instead of two files. This way the dialog is created on the spot and distroyed when the job is done.

 

I'll keep you informed.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report