Are there ang good tutorials on using the vlide debugging tools.

Are there ang good tutorials on using the vlide debugging tools.

stanovb
Advocate Advocate
2,966 Views
46 Replies
Message 1 of 47

Are there ang good tutorials on using the vlide debugging tools.

stanovb
Advocate
Advocate

 

I found this on here but are there other good video tutorials on how to use the vlide editor to debug your code?

 

https://www.youtube.com/watch?v=cBTQ0uHaI4Y

 

I have gotten two errors while trying to debug manually, but I could use some extra help.

 

One error was: ; error: bad argument type: streamp nil

bad argument type: streamp <value> A function requiring a file descriptor argument has been passed an argument of incorrect data type with the value noted in the error message. Usually a result of passing the close AutoLISP function a null or invalid argument.

Then while debugging this error i recieved this second error: bad argument type: fixnump: nil

bad argument type: fixnump: <value> A function requiring an integer argument has been passed an argument of incorrect data type with the value noted in the error message.

 

The problem is i dont know where the error is occurring. Is there a good tutorial that shows you how to pinpoint the error such as setting breakpoint on error & how to go about doing this?

 

I have two lisp routines that are working together so I'm not totally sure which file is causing the error. Someone showed me the trick of setting a variable throughout the code & then typing ! & then the variable name to see what it finally gets set 2 & it looks like now it is getting through the first routine & getting hung up on the second routine but I'm not sure why it is expecting an integer argument. I would post the files, but its quite a bit of code.

0 Likes
2,967 Views
46 Replies
Replies (46)
Message 21 of 47

stanovb
Advocate
Advocate

ok thanks

0 Likes
Message 22 of 47

stanovb
Advocate
Advocate

Is the spoiler alert the same as in your other message? I'm not seeing it, its just a blank space. I have been trying to use the add watch but the variables don't seem to be changing. They all seem to be set to nil except for PJT. That is set to "IA" which is surprising. I'm not sure where its getting that from.

stanovb_1-1659533945294.png

 

 

I took that out of the list for the first popup menu. It really should be setting PJWEN=IA instead of PJT. 

 

stanovb_0-1659533884163.png

 

0 Likes
Message 23 of 47

ВeekeeCZ
Consultant
Consultant

@stanovb wrote:

Is the spoiler alert the same as in your other message? NO. It's a solution, possibly a bit advanced. 

I'm not seeing it, its just a blank space. Just a little wit... there is a text inside in white color.

I have been trying to use the add watch but the variables don't seem to be changing. 

 


HERE is a video that illustrates debugging. With some comments... HTH

0 Likes
Message 24 of 47

stanovb
Advocate
Advocate

I've watch your video multiple times, but I still cant figure out how after you set the breakpoint, then load the file into the vlc, then you activate autocad, run stp , it goes back to the editor & the expression after the breakpoint is highlighted. When I try this it doesn't highlight, and the step into, step out, step over, & continue are all grayed out & I can't run them. Am I forgetting to do something? 

0 Likes
Message 25 of 47

ВeekeeCZ
Consultant
Consultant

You need to have this option ticked prior to loading it.

 

BeekeeCZ_0-1659813663273.png

 

0 Likes
Message 26 of 47

stanovb
Advocate
Advocate

yeah that's on. it sure seems like I'm doing the same thing. I'm not sure what I'm doing wrong. when it goes back to the editor in your video the expression gets highlighted and the step commands are available, but when I do it its greyed out.

0 Likes
Message 27 of 47

ВeekeeCZ
Consultant
Consultant

No further suggestion.

You should start with some simple program to learn how debugging works. Then you can move to your complex program.

Also, if you have some issues, make a video to document things. I don't like this blind guessing game and I am about to quit it.

0 Likes
Message 28 of 47

Sea-Haven
Mentor
Mentor

Like BeekeeCZ test your code in smaller bits if possible then can identify better where its failing. You dont have to draw objects to test but rather make sure you have the correct values in particular no NIL.

 

If you really want some answers then you need to post code, for me no code no help.

 

Ps out side of VLIDE I use prompts when debugging (Alert "Got to step1") (alert "Now at2") helps to find a start point of what has worked. Or (princ "\nStep1")

 

 

0 Likes
Message 29 of 47

stanovb
Advocate
Advocate

I'm afraid I've angered everyone who has been trying to help me. I'm sorry for that, I have been asking too many questions without providing the proper info. I don't know how to do a video screencast video so I guess I need to learn how to do that. I have located part of my code which appears to be given me the ; error: bad argument type: streamp nil.

stanovb_0-1659841210052.png

I get the error when I inspect this part of the code. Ive found some other code online that does something similar. I'm not sure if this part of the code is causing the whole program to not work. All of my variables show up in the watch list as expected but the closing of the file that gets written to seems to cause an error.

 

stanovb_1-1659842925003.png

 

When I add close fp to the watch list everything changes to nil.

stanovb_2-1659843019565.png

 

 

 

I have tried the suggestion of a smaller piece of code in a separate file & that seems to work, but i am having trouble with this bigger more complicated code.  The code doesn't highlight for me in my startup routine like in BeeKeeCZ's video for some reason so i cant use the step into tools. I will include an updated version of the file & l will try to learn how to do a video screencast

0 Likes
Message 30 of 47

stanovb
Advocate
Advocate

Sorry, forgot to upload the updated file

0 Likes
Message 31 of 47

stanovb
Advocate
Advocate

My attempt at a screencast Startup 

0 Likes
Message 32 of 47

ВeekeeCZ
Consultant
Consultant

It could be that the evaluation couldn't reach your breakpoint due to an error that happened prior to your breakpoint location. In that case, you use "Last point source" or CRTL+F9 to relocate to the error line.

 

BeekeeCZ_0-1659870312902.png

 

 

Also might happen that you'll get just an error alert and it does not shift you to the error location. That could be if the error line is unavailable - possibly within another function/routine stored in a different file that isn't open at the time in the VLIDE. Or the code is encoded.

 

BeekeeCZ_2-1659870949167.png

 

0 Likes
Message 33 of 47

stanovb
Advocate
Advocate

Partial success! Setting those alerts has allowed to me to determine that the code is getting through the projectstartup routine to where it creates the project folders now. There is a problem differentiating between the two classes in the project directories lisp file. I know this because I set an alert that tells me that even know I have the class square selected its still going to the narrow class  part of projectdirecrories.lsp . its going here:

 

stanovb_0-1659887714807.png

instead of here like i want it to do:

stanovb_1-1659887821107.png

Even  know I select square as the class, the narrow class part of the code is what's running. I still get the alert for the subdirlist narrow. Maybe my if statement is not formatted correctly? There is progress at least. The folders are being created, but its not copying the files from the correct folder based on the Wendy's project type, base, & class that's selected in the startup routine.

 

0 Likes
Message 34 of 47

stanovb
Advocate
Advocate

I forgot to post the updated files. I feel like I'm getting closer so that's progress. Maybe my if statement in projectdirectories is not correct.

0 Likes
Message 35 of 47

stanovb
Advocate
Advocate

OMG! I think I just about got it figured out finally. The only thing now is  other than some tweaking, is to figure out why some of my pull downs have what looks like a preselected item. The 2022 is ok because that will be the default, but I don't want the second pull down to have a preselected item. I am very close though, closer than I've ever been to getting this to be fully functional.

stanovb_0-1659914634137.png

 

0 Likes
Message 36 of 47

Sea-Haven
Mentor
Mentor

In the dcl "Project year" has no "action". Not tested just a look at dcl.

 

 

0 Likes
Message 37 of 47

stanovb
Advocate
Advocate

Actually I'm ok with that one having a default. Most of the time its going to be the current year. I think Project_Year gets set to the 4chyear variable in the cdgProjectstart.lsp file, which would be 2022 by default. I could be wrong about that of course. I fixed the other pulldown. it had the tile being set to the label name instead of the key. The only thing left, other than some tweaking  is getting the first dialog box to come up with no preselection. It works if you select it, but I would like it to come up blank at first so a user don't think its already selected because if you don't make the selection an error occurs.

 

stanovb_0-1659919997873.png

 

0 Likes
Message 38 of 47

Sea-Haven
Mentor
Mentor

Is there a reason why you would not just do this

 

(defun writelist ()
    (Write-line GAREA fp)
    (Write-line SAREA fp)
    (Write-line PNO fp)
    (Write-line AUTH fp)
    
or 
(setq lst (list GAREA SAREA PTNO AUTH.........)
(foreach val lst
(write-line (eval val) fp)
)
(close fp)

 

0 Likes
Message 39 of 47

stanovb
Advocate
Advocate

No reason really, that's just the way it was written. Your way does seem like less code which is what I'm trying to do. How would I call lst in the rest of my code within each project type if i used that second option? Right now i'm calling (writelist) like this. Would i have setq list inside of the writelist function?

0 Likes
Message 40 of 47

stanovb
Advocate
Advocate

One more thing I'm trying to figure out is how the project start dialog box is finding the different client dialog boxes when you click on the specific client.

 

stanovb_0-1660072034947.png

I changed the selection from SC to Supercuts & renamed the dcl file, but AutoCAD cant find the dialog definition. I was looking for somewhere where it said if client = SC load SCclient but I cant see it anywhere. If we add a new client i want to be able to create a new client dialog box & have the project start dialog box open it up.

0 Likes