OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: honkinberry on June 23, 2010, 05:09:18 PM

Title: problem with slideimage
Post by: honkinberry on June 23, 2010, 05:09:18 PM
I'm having problems with getting the SlideView_SlideImage to work.

I'm currently calling it from the form's OnInitialize event, passing a slide from a slide library to it.
What am I doing wrong?

Code (autolisp) Select

(setq imgwidth (dcl_Control_GetWidth proj_form_slidex)
imgheight (dcl_Control_GetHeight proj_form_slidex)
symx "DIM"
) ; setq
(dcl_SlideView_SlideImage proj_form_slidex
(list (list 0 0 imgwidth imgheight "myslib.slb" symx))
) ; slideimage
) ; foreach

Title: Re: problem with slideimage
Post by: owenwengerd on June 23, 2010, 05:21:42 PM
Your syntax looks correct. If you can upload a simple sample project that demonstrates the problem, I'll have a look under the debugger. Make sure you describe the steps and any error messages and/or what the problem is.
Title: Re: problem with slideimage
Post by: honkinberry on June 24, 2010, 09:06:48 AM
Here you go.
Symptoms pretty obvious, slide not displaying.
Thanks for looking at this!

--J
Title: Re: problem with slideimage
Post by: honkinberry on June 24, 2010, 12:53:24 PM
The problem seems to be from calling it from the OnInitialize.
When I later swap out the slide to a different one when the user clicks a button, that works fine.

--J
Title: Re: problem with slideimage
Post by: owenwengerd on June 24, 2010, 01:19:51 PM
Which version of the runtime are you using?
Title: Re: problem with slideimage
Post by: owenwengerd on June 24, 2010, 01:27:30 PM
I think I see the problem. SlideView_SlideImage paints a slide, which is only possible when the control is visible and there's something to paint on. The control is not yet visible during OnInitialize, so the call fails. See if SlideView_Load works better.
Title: Re: problem with slideimage
Post by: honkinberry on June 24, 2010, 02:00:10 PM
That did it!  Thank you!

--J
Title: Re: problem with slideimage
Post by: DW on July 01, 2010, 09:59:19 PM
Hi,
I'm having problems with dcl_SlideView_Load in 6.0.0.28.  It doesn't work as it did in 5.1.2.3 with slide library files but works fine when you load an individual slide.  It doesn't make a difference whether called from within the OnInitialize function or not.

Here is my slide loading function...

Code (autolisp) Select
(defun update_block-slides (start highlight / ct)
   (setq ct 0)
   ;;add slides to slide views
   (repeat 12
     (if (nth start blklist) ;if not at the end of the list
(if (not (dcl_SlideView_Load
  (vl-doc-ref (read (strcat "pm_blkins_s" (itoa ct))))
  (strcat p_path "\\plants\\" (vl-filename-base library) ".slb")
  (nth start blklist)
)
   )
 (dcl_SlideView_Load
   (vl-doc-ref (read (strcat "pm_blkins_s" (itoa ct))))
   (strcat p_path "\\plants\\" (nth start blklist) ".sld")
 );;try to load single slide if found
)
(dcl_SlideView_Clear ;else clear everything painted before
 (vl-doc-ref (read (strcat "pm_blkins_s" (itoa ct))))
)
     )
     ;;remove highlight from every slide
     (dcl_SlideView_SetHighLight
(vl-doc-ref (read (strcat "pm_blkins_s" (itoa ct))))
7
     )
     (setq ct  (1+ ct)
   start (1+ start)
     )
   )
   ;;highlight selected slide in red
   (dcl_SlideView_SetHighLight
     (vl-doc-ref
(setq lastclicked (read (strcat "pm_blkins_s" (itoa highlight))))
     )
     1
   )
 )


Thanks,
David
Title: Re: problem with slideimage
Post by: owenwengerd on July 02, 2010, 09:28:53 AM
What exactly is not working? Any error messages?
Title: Re: problem with slideimage
Post by: DW on July 03, 2010, 02:57:02 AM
No error messages at all - just a blank control when the dialog is loaded in 6.0.0.28. 

I've attached a cut down version of the code and dialog together with a slidelibrary demonstrating the problem.
Title: Re: problem with slideimage
Post by: owenwengerd on July 03, 2010, 08:07:42 AM
The problem is that the .slb file header does not exactly match the specification. How did you create the .slb file? I see that AutoCAD seems to ignore the incorrect file header and display the slides anyway, so I'm inclined to change the OpenDCL code to do the same. On the other hand, it's risky to blithely ignore errors and barge ahead anyway. It would be useful to know how prevalent the problem is.
Title: Re: problem with slideimage
Post by: DW on July 03, 2010, 09:43:02 PM
Thanks for identifying the problem, I've rebuilt the slide library using Slidelib.exe and it now displays in the 6.0.0.28 dialog correctly.  I had earlier used a program called Etecad Slide Manager and also tried a command line app. called Makeslb.exe - which also creates libraries which don't display.  So will stick to the AutoCAD utility in the future.   
Title: Re: problem with slideimage
Post by: jmaeding on July 07, 2010, 09:04:58 AM
wow, good catch on that Owen.  Slides are nice in that they are vector, so can be zoomed.
I did a block manager app that makes a slide for every dwg in a folder, much better than thumbnails so thanks for supporting them.
Title: Re: problem with slideimage
Post by: Oak3s on July 14, 2010, 04:07:16 PM
I am having a similar problem. I get a blank control.

Code (autolisp) Select
(dcl_SlideView_Load SA-Block-Insertion_Form1_SlideView1 "P:/SA-Drafting/Blocks/Slide_images/SA-Anchorbolt.sld")

AutoCAD2011
OpenDCL Runtime [6.0.0.28]


Title: Re: problem with slideimage
Post by: owenwengerd on July 15, 2010, 07:28:24 AM
Can you send me files to reproduce the problem?
Title: Re: problem with slideimage
Post by: owenwengerd on July 15, 2010, 10:44:47 AM
Your OnInitialize event handler function names do not match. Reset the event handler function name in OpenDCL Studio so that it matches your lisp code, then I think your slides will display correctly.
Title: Re: problem with slideimage
Post by: Oak3s on July 15, 2010, 10:47:37 AM
 ::) Oh my goodness, wow...thanks Owen.
Title: Re: problem with slideimage
Post by: honkinberry on July 21, 2010, 05:09:43 PM
Here's an odd one.
I can display some of the slides in this library, but not all of them.
No problem with: Bar-Filled, Dash-Filled, DashDot-Filled, Viewpoint

But can't display: Node-01-Filled, Node-10-Filled, Arrow-01-Filled, Arrow-50-Filled

SLB created using slidelib.exe.

Thanks for any thoughts!

--J
Title: Re: problem with slideimage
Post by: owenwengerd on July 21, 2010, 05:45:11 PM
This is now fixed for the next build. The problem slides contain zero-length vectors that should have been rendered as points.
Title: Re: problem with slideimage
Post by: honkinberry on July 21, 2010, 05:47:43 PM
You are incredible!

Out of honestly no more than curiosity, when might this next build ship?
It's my first time waiting for a build, and I feel like a kid on Christmas Eve.

--J
Title: Re: problem with slideimage
Post by: owenwengerd on July 22, 2010, 08:39:00 AM
Look for a new OpenDCL alpha release this weekend while we wait for the next Bricscad build.