TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on February 17, 2013, 12:48:01 AM

Title: Attach image to a DCL
Post by: Coder on February 17, 2013, 12:48:01 AM
Hello everyone .  :-)

Is there any example shows how to attach an image to a DCL file and how to attach them please ?

I saw a few examples but I still confused about how to include the image , size and the image extension .

Thank you all
Title: Re: Attach image to a DCL
Post by: nobody on February 17, 2013, 01:03:52 AM
Maybe this will help:

http://www.afralisp.net/dialog-control-language/tutorials/dialog-boxes-and-autolisp-part-1.php
Title: Re: Attach image to a DCL
Post by: Coder on February 17, 2013, 05:27:49 AM
Thanks for the link , but I need simple example with code  :oops:
Title: Re: Attach image to a DCL
Post by: Coder on February 17, 2013, 05:35:02 AM
The code is on there sir?

You're right , but there are many codes , and the example that was given in that link is too big and complicated for a beginner like me to
understand and get what I need in particular .

Thanks
Title: Re: Attach image to a DCL
Post by: Coder on February 17, 2013, 08:45:10 AM
Is it impossible or it needs lots of work ?   :oops:
Title: Re: Attach image to a DCL
Post by: Lee Mac on February 17, 2013, 08:53:59 AM
http://www.theswamp.org/index.php?topic=41938.0 (http://www.theswamp.org/index.php?topic=41938.0)
Title: Re: Attach image to a DCL
Post by: Coder on February 17, 2013, 01:19:20 PM
Thanks Lee for that hard work .

I am still looking for an example using slide images . can you please show me any code Lisp and DCL using Slide image ?

Thank you . :-)
Title: Re: Attach image to a DCL
Post by: kruuger on February 17, 2013, 03:49:18 PM
Thanks Lee for that hard work .

I am still looking for an example using slide images . can you please show me any code Lisp and DCL using Slide image ?

Thank you . :)
http://www.jefferypsanders.com/autolisp_DCL_Image.html
k.
Title: Re: Attach image to a DCL
Post by: CAB on February 17, 2013, 05:10:14 PM
Check these out
http://www.theswamp.org/index.php?topic=4723.0
http://www.theswamp.org/index.php?topic=3263
Title: Re: Attach image to a DCL
Post by: Coder on February 18, 2013, 03:37:19 AM
Thank you all
Title: Re: Attach image to a DCL
Post by: Didge on February 18, 2013, 08:33:07 AM
http://www.theswamp.org/index.php?topic=20878.msg255063#msg255063 (http://www.theswamp.org/index.php?topic=20878.msg255063#msg255063)

Here's a link to a couple of routines that help attach CAD geometry to dialogues. Saves faffing about with slides etc.
Title: Re: Attach image to a DCL
Post by: andrew_nao on February 18, 2013, 10:03:00 AM
if your just starting to learn it, i would suggest learning opendcl
its much more easier and flexible
Title: Re: Attach image to a DCL
Post by: Coder on February 18, 2013, 10:10:25 AM
http://www.theswamp.org/index.php?topic=20878.msg255063#msg255063 (http://www.theswamp.org/index.php?topic=20878.msg255063#msg255063)

Here's a link to a couple of routines that help attach CAD geometry to dialogues. Saves faffing about with slides etc.
Thank you Didge for that useful link .  :-)
Title: Re: Attach image to a DCL
Post by: Coder on February 18, 2013, 10:13:01 AM
if your just starting to learn it, i would suggest learning opendcl
its much more easier and flexible

I read about opendcl but I feel it is a little hard for a beginner , is this correct ?

Can you please show me the best way to learn opendcl ?  :-)

Thank you so much
Title: Re: Attach image to a DCL
Post by: hmspe on February 18, 2013, 10:54:27 AM
For opendcl I would start with the tutorial at http://opendcl.com/wordpress/?page_id=10   Opendcl also has a forum at http://www.opendcl.com/forum/    The Runtime/Autolisp section is a good place to get help.
Title: Re: Attach image to a DCL
Post by: Coder on February 18, 2013, 01:18:00 PM
For opendcl I would start with the tutorial at http://opendcl.com/wordpress/?page_id=10   Opendcl also has a forum at http://www.opendcl.com/forum/    The Runtime/Autolisp section is a good place to get help.

Thank you for the link .  :-)
Title: Re: Attach image to a DCL
Post by: efernal on February 18, 2013, 03:07:44 PM
Code - Auto/Visual Lisp: [Select]
  1. (DEFUN c:teste (/ dx dy dh w@)
  2.   (IF (> (SETQ dh (LOAD_DIALOG "c:\\teste\\dcl\\teste.dcl")) 0)
  3.     (IF (NEW_DIALOG "teste" dh)
  4.       (PROGN (SETQ dx (DIMX_TILE "i")
  5.                    dy (DIMY_TILE "i")
  6.              )
  7.              (START_IMAGE "i")
  8.              (SLIDE_IMAGE 0 0 dx dy "c:\\teste\\sld\\teste.sld")
  9.              (END_IMAGE)
  10.              (ACTION_TILE "accept" "(DONE_DIALOG 1)")
  11.              (ACTION_TILE "cancel" "(DONE_DIALOG 0)")
  12.              (SETQ w@ (START_DIALOG))
  13.              (UNLOAD_DIALOG dh)
  14.              (COND ((= w@ 0) (PRINC "\n-> You pressed Cancel"))
  15.                    ((= w@ 1) (PRINC "\n-> You pressed OK"))
  16.              )
  17.       )
  18.       nil
  19.     )
  20.     (ALERT "Unable to load dcl file")
  21.   )
  22.   (PRINC)
  23. )
  24.  
  25. ;|
  26. ;; dcl file
  27. teste:dialog{label="show slide";width=50;fixed_width=true;
  28. :spacer{height=1;}
  29. :image{key="i";width=40;aspect_ratio=0.75;color=0;alignment=centered;}
  30. :spacer{height=1;}
  31. ok_cancel;
  32. }
  33. |;
  34.  
  35. How to make the slide:
  36. Go to paper space
  37. Commands PS + MV
  38. Draw an viewport 1000x750
  39. Zoom extents
  40. Command MS + Zoom extents
  41. Command Mslide, name c:\teste\sld\teste.sld
  42.  
  43. be sure to create the folders before...
  44.  
  45. try the routine...
  46.  
Title: Re: Attach image to a DCL
Post by: Coder on February 18, 2013, 11:12:56 PM
Thank you efernal ,

Good example , I like it .  :-)
Title: Re: Attach image to a DCL
Post by: Coder on February 19, 2013, 06:57:28 AM
Check these out
http://www.theswamp.org/index.php?topic=4723.0
http://www.theswamp.org/index.php?topic=3263

CAB , I made a slide of my needed symbol but it does not fit the image , I mean there would be a big black space , sometimes from the top
of the slide and sometimes on other sides .

Can you tell me about the best way of taking a slide to be used in DCL file ?

Attached one slide , if you don't mind to take a look please .

Thank you so much  :-)
Title: Re: Attach image to a DCL
Post by: CAB on February 19, 2013, 09:48:50 AM
Size the ACAD window to fit the object you want to make a slide from.
Then use the Make Slide command.

See the VLIDE Help for slide_image function code needed to display your slide.
Title: Re: Attach image to a DCL
Post by: Lee Mac on February 19, 2013, 09:49:38 AM
Size the ACAD window to fit the object you want to make a slide from. Then use the Make Slide command.

Hint: Use a Viewport  :wink:
Title: Re: Attach image to a DCL
Post by: CAB on February 19, 2013, 09:56:38 AM
Good tip Lee.

See attached revised slide.
Title: Re: Attach image to a DCL
Post by: efernal on February 19, 2013, 10:28:27 AM
you must make your slides at paper space, in a viewport with the same proportions as the image component...
Title: Re: Attach image to a DCL
Post by: CAB on February 19, 2013, 10:38:08 AM
With my ACAD setup a Viewport slide has a white background and a Model Space slide has a black background.
Title: Re: Attach image to a DCL
Post by: Coder on February 20, 2013, 12:19:34 AM
Good tip Lee.

See attached revised slide.


Thank you so much for your hard work , I appreciate that so much .
The result is almost the same , and maybe because the shape of the image is rectangle and not a square shape that makes the image looks
narrow to one side in the image space preview .

Thanks.

Size the ACAD window to fit the object you want to make a slide from. Then use the Make Slide command.

Hint: Use a Viewport  :wink:

Thank you Lee .  :-)

I zoomed to extent in a single viewport and then made the slide image , and the result is better than before . thanks a lot .
Title: Re: Attach image to a DCL
Post by: CAB on February 20, 2013, 08:46:33 AM
If you care to post some test code we could see what the problem is.
If you are trying to force a rectangular peg in a square hole it will never fit correctly.  8-)
Title: Re: Attach image to a DCL
Post by: efernal on February 20, 2013, 11:48:52 AM
make your slides in a viewport with same proportions of dimx_tile and dimy_tile
Title: Re: Attach image to a DCL
Post by: Coder on February 20, 2013, 11:51:45 PM
If you care to post some test code we could see what the problem is.
If you are trying to force a rectangular peg in a square hole it will never fit correctly.  8-)

Thank you CAB , I am using the same code that posted by efernal .

make your slides in a viewport with same proportions of dimx_tile and dimy_tile


Thank you efernal , now I know how to get the slide from viewports . 
It works now as needed , many thanks .  :-D

Title: Re: Attach image to a DCL
Post by: d2010 on February 21, 2013, 09:02:51 PM
Hello everyone .  :-)

Is there any example shows how to attach an image to a DCL file and how to attach them please ?

I saw a few examples but I still confused about how to include the image , size and the image extension .

Thank you all

Step1)You install the kitt  full&free from:
http://lisp2arx.3xforum.ro/ (http://lisp2arx.3xforum.ro/)
Step2)Your Pc must be connected online with your browser
Step3)You run "vlaxcompiler.exe" from "C:\VLAXCOMPIL\BIN\"
Step4)click on the menu(you see the picture clichere.jpg -attached here)
Step5)
        convert SLD to Lisp_Grdraw....
        convert SLD to Lisp_DCL..
        BMP show in DCL image (only for vlisp)
www.youtube.com/watch?v=91_DFjN6ucs (http://www.youtube.com/watch?v=91_DFjN6ucs)
step6)Load the application  pozemari.fas
step7)you enter the command Q2[enter]
step8(Load the application sudokudorin.vlx
step9)You enter the command Q2[enter]
Best Regards..
Title: Re: Attach image to a DCL
Post by: Pepe on February 22, 2013, 04:22:15 PM
Here is an free, self standing, application to transalte Bitmaps into Lisp funtions for using in DCLs. I think it works up to 2010 version, but i'm not quite sure. I'm very sorry, but it is in Spanish. If you need any help, post it and i'll do translations my best.

The app runs Autocad itself, but i think it is better to run it before running the app.

I post an example about its use. One DCL and a function with the function generated by the app and its main. I've translated author quotes into english...(please, mercy...)

Regards.
Title: Re: Attach image to a DCL
Post by: Coder on February 24, 2013, 02:00:47 AM
Thank you d2010 .

Thank you Pepe for the nice routines , that is great .  :-)

But sometimes the image size can not fit to the size of the DCL image which keep some of the image outside the
border of the DCL dialog .

Any idea please ?

Regards .
Title: Re: Attach image to a DCL
Post by: Pepe on February 24, 2013, 07:58:56 AM
Hi Coder,

I'm Glad to be helpful.

If you're writing about the app I posted, the size of the 'image' tile you need in DCL to show the bitmap is written at the top of the function generated. Remember: 'altura' means 'height' and 'ancho' means 'width', and proportions are like this:

WIDTH: ['widthinpíxels'+1] / 6.0
HEIGHT: ['heightinpíxeles'+1] / 13.0

Work with this to fit the bitmap.

Regards