Author Topic: Dcl / popup_list freezes Autocad  (Read 5226 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Dcl / popup_list freezes Autocad
« on: March 27, 2006, 06:05:42 PM »
I have this new plotting program I'm working on.  It has been going pretty good, but when I update the paper types per the plotter that is pick, it will up date the popup_list per the new paper types, but it will freeze Autocad also.  I have narrowed it down to this.

Has anyone else ever seen this happen?  If needs be, I can post the routine.

Thanks in advance.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Re: Dcl / popup_list freezes Autocad
« Reply #1 on: March 27, 2006, 06:12:22 PM »
I had a similar problem not long ago..

I finally narrowed it down to the passing of variables back and forth from the LISP to the DCL. I was either giving conflicting data or incompatible data for the functions I was using.

I would check those first.
I drink beer and I know things....

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dcl / popup_list freezes Autocad
« Reply #2 on: March 27, 2006, 06:28:35 PM »
The only thing I'm doing at the point where it is freezing Acad is:
Get the new list for paper sizes (which works fine)
Then it is erasing the old list (start_list "key" 3)
Adding the new list (mapcar 'add_list mylist)
And then ending the list (end_list)

At that is freezing Acad.  I just made sure that the list variable has items in it, and it still froze.  I'm so lost as to what is going on.

Thanks for the idea, but that doesn't seem to be it.

ps.  If I take out the part of making the new list, adding stuff, and closing it, then it will not crash, but it can't work like that.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Re: Dcl / popup_list freezes Autocad
« Reply #3 on: March 27, 2006, 06:35:47 PM »
Could you post the code or is it proprietary?

If you can maybe I can help....
I drink beer and I know things....

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dcl / popup_list freezes Autocad
« Reply #4 on: March 27, 2006, 06:42:23 PM »
Attached is the whole code (I think), and the dcl file.  Below is the portion that is causing the problem.


Warning:  If you run the attached routine, and change the printer, it will freeze Acad...

Code: [Select]
(defun UpdatePaperList (StrNum)

(if (setq PaperList (GetPaperNames ActLo (nth (atoi StrNum) PlotterList)))
 (progn
  (start_list "PaperType" 3)
  (mapcar 'add_list PaperList)
  (end_list)
  (set_tile "PaperType" (car PaperList))
  (mode_tile "PaperType" 2)
 )
)
)

Thanks.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Re: Dcl / popup_list freezes Autocad
« Reply #5 on: March 27, 2006, 06:47:36 PM »
Understood, I'll be heading home in about 15min. I'll work on it there where I won't mess anything up here.
I drink beer and I know things....

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Dcl / popup_list freezes Autocad
« Reply #6 on: March 27, 2006, 06:48:46 PM »
I haven't run the code but ...

Do you have an error function defined before the dcl code in question executes Tim?

Perhaps (defun *error* (x) (vl-bt)) will spew details of the the error before you get locked out.

Do you validate the contents of mylist before trying to repopulate the listbox? Nevermind, looks like you do.

Perhaps disable the listbox before trying to repopulate it (mode_tile key 1), then enable it afterwards (mode_tile key 0), but before giving it the focus.

Sorry, been awhile since I bashed dcl.

/guesses
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dcl / popup_list freezes Autocad
« Reply #7 on: March 27, 2006, 07:08:38 PM »
I haven't run the code but ...

Do you have an error function defined before the dcl code in question executes Tim?

Perhaps (defun *error* (x) (vl-bt)) will spew details of the the error before you get locked out.

I added the (vl-bt), but since it doesn't error to the command line it didn't do anything I could see.

Perhaps disable the listbox before trying to repopulate it (mode_tile key 1), then enable it afterwards (mode_tile key 0), but before giving it the focus.
By doing this, it leaves the paper list greyed out.  Here is the code I used.
Code: [Select]
(defun UpdatePaperList (StrNum)

(if (setq PaperList (GetPaperNames ActLo (nth (atoi StrNum) PlotterList)))
 (progn
  (mode_tile "PaperType" 1)
  (start_list "PaperType" 3)
  (mapcar 'add_list PaperList)
  (end_list)
  (set_tile "PaperType" (car PaperList))
  (mode_tile "PaperType" 0)
  (mode_tile "PaperType" 2)
 )
)
)

So my guess is it isn't ending the list, or it's getting caught up somewhere in the list.  Can't think why this would happen.

Sorry, been awhile since I bashed dcl.

/guesses

No problem, I appreciatet all the help I can get.  I have been trying this for almost two days, off and on, and can't get it to work.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Dcl / popup_list freezes Autocad
« Reply #8 on: March 27, 2006, 07:45:06 PM »
FWIW, stepping thru the code in the VLIDE it stops as soon as the (end_list) is executed....no error, just an hourglass icon after about 20 seconds and there it waits until selecting the big red X to close the VLIDE (which is not respeonding so it takes ACAD with it).....

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Dcl / popup_list freezes Autocad
« Reply #9 on: March 27, 2006, 07:47:29 PM »
Try this.
See comment lines  ; CAB

This is most of the problem, looks like the first time through it doesn't dye, but the second one does kill it.

Code: [Select]
 ;|(set_tile "Plotter" (car PlotterList)) ; CAB
  (set_tile "ctbFile" (car ctbList))
  (set_tile "PaperType" (car PaperList))|;
  (set_tile "Plotter" "0") ; CAB
  (set_tile "ctbFile" "0") ; CAB
  (set_tile "PaperType" "0") ; CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Dcl / popup_list freezes Autocad
« Reply #10 on: March 28, 2006, 07:55:53 AM »
Tim

I will play with yours tonight...got a deadline now.
Here is what I use, mine is pretty simple...and I'm still working on it.
Yours is way over my head. Hopefully Allen got yours fixed.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

SMadsen

  • Guest
Re: Dcl / popup_list freezes Autocad
« Reply #11 on: March 28, 2006, 09:09:44 AM »
T.Willey, CAB is on the right track. Start by removing any call to SET_TILE adjacent to an END_LIST. If you need to display the list in a certain order then rearrange it before passing it to a set of START_LIST and END_LIST.

For example:
Code: [Select]
  (defun UpdatePaperList (StrNum)

    (cond ((setq PaperList
                  (GetPaperNames ActLo (nth (atoi StrNum) PlotterList))
           )
           (start_list "PaperType" 3)
           (mapcar 'add_list PaperList)
           (end_list)
           ;; (set_tile "PaperType" (car PaperList))  <- no!
           (mode_tile "PaperType" 2)
          )
    )
  )

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Dcl / popup_list freezes Autocad
« Reply #12 on: March 28, 2006, 09:25:44 AM »
Stig, good to see ya.
I changed his set_tile statement to "0" but as you eluded the default would be "0" and the statement is redundant.
I left it there so Tim would see what was needed is he wanted to set it.
Code: [Select]
(defun UpdatePaperList (StrNum)

  (if (setq PaperList (GetPaperNames ActLo (nth (atoi StrNum) PlotterList)))
   (progn
    (start_list "PaperType")
    (mapcar 'add_list PaperList)
    (end_list)
    (set_tile "PaperType" "0") ; CAB
    (mode_tile "PaperType" 2)
   )
  )
)

I have used this in the past to set / reset the tile in a position based on a variable holding the text within the list fn_list.
Code: [Select]
    (if (setq n (vl-position tid_filename fn_list))
      (set_tile "filelist" (itoa n))
      (set_tile "filelist" "0")
    )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dcl / popup_list freezes Autocad
« Reply #13 on: March 28, 2006, 11:04:07 AM »
Thanks everyone for the help.  It looks like the one Alan posted is working.  I will go study it now to see what has changed, and why it works.

Thanks again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.