Author Topic: Showing a slide file from a dcl button?  (Read 8153 times)

0 Members and 1 Guest are viewing this topic.

Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #15 on: November 13, 2014, 04:45:00 AM »
If you could show me the source for the sliders would be cool

the way you handle the z is much better than mine...

mine just zooms "anchored" from the top left corner :(
« Last Edit: November 13, 2014, 04:50:11 AM by Brick_top »

Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #16 on: November 13, 2014, 05:22:54 AM »
I think I'm almost there.

I'm going to do the zoom part to see if I have any problems

Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #17 on: November 13, 2014, 05:56:29 AM »
hum...

I have the X and Y figured out but can't do the zooming part

does it have to do with changing the width and height of the slide_image function?

how can I make it zoom based on the center of the slide?

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Showing a slide file from a dcl button?
« Reply #18 on: November 13, 2014, 10:08:53 AM »
Maybe this can help you:
Code - Auto/Visual Lisp: [Select]
  1. (defun KGA_Dcl_Image_FillSlide (tile slide scaleFactor lineColor backColor / xSize xSizeScaled ySize ySizeScaled)
  2.   (setq xSize (dimx_tile tile))
  3.   (setq ySize (dimy_tile tile))
  4.   (setq xSizeScaled (fix (* (- xSize 4) scaleFactor)))
  5.   (setq ySizeScaled (fix (* (- ySize 4) scaleFactor)))
  6.   (set_tile tile "") ; Remove text.
  7.   (start_image tile)
  8.   (fill_image 0 0 xSize ySize lineColor)
  9.   (fill_image 1 1 (- xSize 2) (- ySize 2) backColor)
  10.   (if slide
  11.     (slide_image (/ (- xSize xSizeScaled) 2) (/ (- ySize ySizeScaled) 2) xSizeScaled ySizeScaled slide)
  12.   )
  13. )

Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #19 on: November 13, 2014, 11:01:48 AM »
cool thanks! I don't have more time today but I will look into it tomorrow

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Showing a slide file from a dcl button?
« Reply #20 on: November 13, 2014, 12:05:41 PM »
Note: I only use the function with a scale factor set to 1 or smaller.

d2010

  • Bull Frog
  • Posts: 326
Re: Showing a slide file from a dcl button?
« Reply #21 on: November 13, 2014, 12:51:54 PM »
cool thanks! I don't have more time today but I will look into it tomorrow

SldView exists minimum  five ways:
a)you  use the  great opendcl.arx  for blocks
b)you load image sld from external  file on disk
c) you convert  "SLD file" to autolisp-script-source
     The  autolisp-script-source draw SLD-content in DCL-dialog boxes
         www.youtube.com/watch?v=91_DFjN6ucs
d)you convert  "SLD file" to autolisp-source-grdraw
         www.youtube.com/watch?v=91_DFjN6ucs
e) convert SLD to MsWord.Doc. MsWord.exe draw SLD file inside .DOC
    www.youtube.com/watch?v=91_DFjN6ucs
f)you use  the command / classic mode
    (command "_.VSLIDE"  "filename-on-disk.sld")
    (command  "_.REDRAW")   ;; clear the screen
    //    Note the syntax on the VSLIDE command. You specify the library
    //    name, then the slide name in parenthesis.
    //                 example: "ACAD(ANSI31)"
    (command "_.MSLIDE" )  ;; you make the file .SLD from current-screen
thank you.......
   
« Last Edit: November 13, 2014, 01:20:38 PM by d2010 »

Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #22 on: November 14, 2014, 04:27:59 AM »
Note: I only use the function with a scale factor set to 1 or smaller.

thanks a lot I have it working now.

its not possible to reduce the zoom is it? it only accepts integers right?


Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #23 on: November 14, 2014, 04:44:23 AM »
Note: I only use the function with a scale factor set to 1 or smaller.

Hi I have a slider to control the scale factor, but I also have other two sliders to control x and y positions.

for which I use this function

Code: [Select]
(defun upDateImage_sldv (key);direita
  (start_image key) ;iniciar a imagem
  (fill_image 0 0 width height 250) ;width and height already defined
  (slide_image (atoi slideh) (atoi slidev) width height alslide) ;slideh slidev values from sliders, alslide already defined
  (end_image)
  );defun

I also have modified your function

Code: [Select]
  (defun KGA_Dcl_Image_FillSlide (key /  xSizeScaled ySizeScaled)
  (setq xSizeScaled (fix (* (- width 4) (atoi zoomsld)))); zoomsld value from slider
  (setq ySizeScaled (fix (* (- height 4) (atoi zoomsld))))
  (start_image key)
  (fill_image 0 0 width height 250)
  (if alslide ; alslide already defined when dialog starts
    (slide_image (/ (- width xSizeScaled) 2) (/ (- height ySizeScaled) 2) xSizeScaled ySizeScaled alslide)
  )
  (end_image)
  )

the problem I'm having now is that when I use my other function for the x and y the image resets to starting position. I understand I need to incorporate the two functions right? I'm going to try to do it.. if you could give me a hint..
« Last Edit: November 14, 2014, 05:33:09 AM by Brick_top »

Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #24 on: November 14, 2014, 05:15:04 AM »
I think it is working now

I changed my function and yours to this

Code: [Select]
(defun upDateImage (sldName key)
  (setq width (+ (dimx_tile key) (atoi slideh))) ;largura da imagem
  (setq height (+ (dimy_tile key) (atoi slidev))) ;altura da imagem
  (start_image key) ;iniciar a imagem
  (fill_image 0 0 width height 250) ;limpar o fundo
  (slide_image (atoi slideh) (atoi slidev) width height sldName) ;apresentar a imagem
  (end_image)
  );defun

(defun KGA_Dcl_Image_FillSlide (key / xSize xSizeScaled ySize ySizeScaled)
  (setq xSizeScaled (fix (* (- width 4) (atoi zoomsld))))
  (setq ySizeScaled (fix (* (- height 4) (atoi zoomsld)))) 
  (start_image key)
  (fill_image 0 0 width height 250)
  (if alslide
    (slide_image
      (/ (- (+ width (atoi slideh)) xSizeScaled) 2)
      (/ (- (+ height (atoi slidev)) ySizeScaled) 2)
     xSizeScaled ySizeScaled alslide)
  )
  (end_image)
  )

And I just called your function from all the sliders, X, Y, and zoom

Seems to be working as I wanted it to


roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Showing a slide file from a dcl button?
« Reply #25 on: November 16, 2014, 05:10:34 AM »
Your version of KGA_Dcl_Image_FillSlide uses variables (width, height, zoomsld, slideh, slidev and alslide) that are defined in another function. You have turned a library function in to a function that is specific to your application. This is not a problem, just something to bear in mind.

It seems possible create a single function instead of upDateImage and KGA_Dcl_Image_FillSlide.

Brick_top

  • Guest
Re: Showing a slide file from a dcl button?
« Reply #26 on: November 17, 2014, 03:37:52 AM »
Your version of KGA_Dcl_Image_FillSlide uses variables (width, height, zoomsld, slideh, slidev and alslide) that are defined in another function. You have turned a library function in to a function that is specific to your application. This is not a problem, just something to bear in mind.

yes, thank you I understand this.

Quote
It seems possible create a single function instead of upDateImage and KGA_Dcl_Image_FillSlide.

It probably is, but what I have now is working, I'm allways in this place asking questions...

thanks a lot for your help