Jump to content

Recommended Posts

Posted (edited)

I can't figure out how to get an image to show up in a dialog box... I've studied this code from a tutorial, but I can't figure out where are the parts I'm supposed to substitute... Wondering if someone can give me the same code back with the slide name "bolt43.sld" inserted where it needs to be? Also can you make the inserted name a different color? Thank you in advance.

DCL:

 : image { 
 key = "sld"; 
 height = 30; 
 width = 30;  
    color = 0;
 is_enabled = false; 
 is_tab_stop = false;
}

LSP:

(setq mySlideName "c:/acad/myslide.sld")
(setq myKey "sld")
(upDateImage mySlideName myKey)
(defun upDateImage(sldName key)          
 (setq width (dimx_tile key))
 (setq height (dimy_tile key))
 (start_image key)
 (fill_image 0 0 width height 0)
 (slide_image 0 0 width height sldName)
 (end_image)
)

Edited by SLW210
Added Code Tags
Posted

Just modify the part in magenta with your actual path:

(setq mySlideName [color=magenta]"c:/acad/myslide.sld"[/color])

 

Please edit your post and add code tags.

Posted
Just modify the part in magenta with your actual path:

(setq mySlideName [color=magenta]"c:/acad/myslide.sld"[/color])

 

I wonder about the changes you made on the OP 's Image path !

 

This must solve the issue if the Image placed in the correct path as shown in you lisp file .

 

DCL :

DCL: dialog {
   : image { key = "sld"; height = 30; width = 30; color = 0; is_enabled = false; is_tab_stop = false; }
   ok_only;
   }

  • 2 weeks later...
Posted (edited)

Thanks for your replies guys, Sorry, but I'm still having trubs,:glare: I'm getting the error: No function definition: UPDATEIMAGE. Let me show you what I'm really trying to achieve- I'm trying to create a "detail builder" that will complete a detail drawing based on user picks. I'm trying to get it so that the slide matching whatever vang the user selects from the first drop down list shows up in the image area. Here's the code I have so far...

 

// DCL CODE STARTS HERE

LAD : dialog {
aspect_ratio = 0;
label = "VANG DETAIL CREATOR©";
fixed_height = true;
fixed_width = true;
 : boxed_column {

: text_part {
label = "--- SELECT DETAILS FOR VANG ---";
alignment = centered;
}

: popup_list {
key = "mylist1";
label = "Type of Vang:";
alignment = right;
//fixed_width_font = true;
width = 13;
value = 0;
}
fixed_width = true;
fixed_height = true;
: image_button {
alignment = top;
fixed_width = true;
fixed_height = true;
key = "ddvp_image";
width = 55;
height = 5;
color = 0;
is_tab_stop = false;
}
  
     : popup_list {
key = "mylist2";
label = "Center of Hole to Face:";
alignment = right;
//fixed_width_font = true;
width = 10;
value = 0;
}
: edit_box {    
  key = "eb1";    
  label = "Distance from Top of Pole:";   
  width = 26;
  fixed_width = true;    
  value = "";
  alignment = centered;   
}    

   : radio_row {
: spacer { 
 width = 1; 
 height = 0.5; 
}
: radio_button {
label = "Single Sided";
key = "B1";
alignment = centered;
}
: radio_button {
label = "Double Sided";
key = "B2";
value = "1";
alignment = centered;
}
      }
     }
   : boxed_column {
: row {
: button {
label = "OK";
key = "Next";
width = 16;
fixed_width = true;
mnemonic = "O";
is_default = true;
alignment = right;
}
: button {
label = "Next";
key = "next";
width = 16;
fixed_width = true;
mnemonic = "N";
is_default = true;
alignment = right;
}
: button {
label = "Cancel";
key = "cancel";
width = 16;
fixed_width = true;
mnemonic = "C";
is_cancel = true;
alignment = left;
  }}
}
: text_part {    
label = "_________________________________";
alignment = centered;
} 
}
// DCL CODE ENDS HERE 

;; LISP CODE STARTS HERE
(defun C:LAD()
     (setq myList1(list "RV01-RV02" "RV03-RV04" "RV05-RV06" "RV07-RV08" "RV09-RV10" "RV11-RV12" "RV13-RV14" "RV15-RV16" "RV17-RV18" "RV19-RV20"  "RV21-RV22" "RV23-RV24" "RV25-RV26" "RV27-RV28")) 
  (setq myList2(list "3in." "3 1/2in." "4in." "4 1/2in." "5in." "5 1/2in." "6in." "6 1/2in." "7in." "7 1/2in." "8in."))

 (if(not(setq dcl_id (load_dialog "LAD.dcl")))
   (progn
     (alert "The DCL file could not be loaded!")
     (exit)
   )
   (progn
     (if (not(new_dialog "LAD" dcl_id))
       (progn
       (alert "The LAD.DCL file could not be loaded!")
         (exit)
       )
   
    (progn  
         (start_list "mylist1" 3)
         (mapcar 'add_list myList1)
         (end_list)
         (start_list "mylist2" 3)
         (mapcar 'add_list myList2)
         (end_list)
(fwtlogo)
         (action_tile "accept" "(saveVars)(done_dialog 2)")
         (action_tile "cancel" "(done_dialog 1)")
         (setq ddiag(start_dialog))
         (unload_dialog dcl_id)
         (if(= ddiag 1)
           (princ "\n LAD cancelled!")
         )
         (if(= ddiag 2)
           (progn
             (princ "\n The user pressed Okay!")
           )
         )
       )
     )
   )
 )
 (princ)
)
;; LISP CODE ENDS HERE

For some reason my slide file says invalid, but here's the dwg file that a slide could be made out of.

 

 

Thanks in advance for your help, and thanks for being patient!

LAD DCL.PNG

RV01-RV02.dwg

Edited by SLW210
added code tags
Posted (edited)

Ok, sorry, I've learned what Code Tags are, I must not be doing something right, I can't get them to work. I removed the logo on purpose, forgot to remove the call from lisp. Thanks for the tips.

Edited by LosGirk
Code Tags aren't working
Posted
I removed the logo on purpose, forgot to remove the call from lisp..

 

Its odd that you removed that sub as we are here to help you with that part of the code .:?

Posted

Ok pBe and Tharwat, Sorry guys, I'm off to a bad start here. I've been out of the business for thirteen years, a lot of its come back to me, but there's a lot of new stuff to learn too. Thanks again for your patience. I've done my research and I think I'm ready to try this again. That having been said:

Here's the original code including the logo function and the corresponding DCL. It's not the logo that gives me problems, because I know how to display vector. My problem is I don't know how to get a slide to display. I know this is stupid, but I can't figure it out! I always get the error: no function definition: UPDATEIMAGE. What I'd like to achieve in the end is to have the slide image change to reflect whatever vang type the user chooses in the pulldown above [ATTACH]46002[/ATTACH]the image area (fig. 1). I hope I've given everything you need, you guys are cool to help me, thanks.

LAD : dialog {
aspect_ratio = 0;
label = "VANG DETAIL CREATOR";
fixed_height = true;
fixed_width = true;
 : boxed_column {

: text_part {
label = "--- SELECT DETAILS FOR VANG ---";
alignment = centered;
}

: popup_list {
key = "mylist1";
label = "Type of Vang:";
alignment = right;
//fixed_width_font = true;
width = 13;
value = 0;
}
fixed_width = true;
fixed_height = true;
: image_button {
alignment = top;
fixed_width = true;
fixed_height = true;
key = "ddvp_image";
width = 55;
height = 5;
color = 0;
is_tab_stop = false;
}
  
     : popup_list {
key = "mylist2";
label = "Center of Hole to Face:";
alignment = right;
//fixed_width_font = true;
width = 10;
value = 0;
}
: edit_box {    
  key = "eb1";    
  label = "Distance from Top of Pole:";   
  width = 26;
  fixed_width = true;    
  value = "";
  alignment = centered;   
}    

   : radio_row {
: spacer { 
 width = 1; 
 height = 0.5; 
}
: radio_button {
label = "Single Sided";
key = "B1";
alignment = centered;
}
: radio_button {
label = "Double Sided";
key = "B2";
value = "1";
alignment = centered;
}
      }
     }
   : boxed_column {
: row {
: button {
label = "OK";
key = "Next";
width = 16;
fixed_width = true;
mnemonic = "O";
is_default = true;
alignment = right;
}
: button {
label = "Next";
key = "next";
width = 16;
fixed_width = true;
mnemonic = "N";
is_default = true;
alignment = right;
}

: button {
label = "Cancel";
key = "cancel";
width = 16;
//fixed_width = true;
is_cancel = true;
//alignment = center;
  }}


     : column {
  // : row {     
   //: boxed_column {
: text_part {    
label = "_________________________________";
alignment = centered;
}
: spacer { 
width = 8; 
height = 0.0; 
}
: image {
key = "FWTlogo";
width = 11.00;// X = 42
height = 2.46;// Y = 03
fixed_width = true;
fixed_height = true;
aspect_ratio = 1;
color = 135;
alignment = centered;
   }
}    
      }}

;-------------------------------------------------------------------------------
; FWTlogo - FWT logo image definition for dialogs
;-------------------------------------------------------------------------------
(defun FWTlogo ( )
 (start_image "FWTlogo")
 (mapcar 'vector_image; F
   (list   0   0   1   2   3   4   5   7   7   8   8   8   9   9  10  10   4)
   (list  22  21  21  21  21  21  21  15  14  13  12  11   7   6   5   4   3)
   (list   5   4   5   6   7   8   9  13  13  14  14  14  17  17  18  18  18)
   (list  22   4   4   4   4   4   4  15  14  13  12  11   7   6   5   4   3)
   (list 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
 );mapcar
 (mapcar 'vector_image; W
   (list  20  20  20  21  22  23  24  18  18  18  25  26  26  26  26  31  31  31  32  33  34  36  32  33  34  35  36)
   (list  22  21  20  20  20  20  20   5   4   3  15  15  17  18  20  15  13  16  14  11   8  13  22  22  22  22  22)
   (list  24  24  18  19  20  21  22  22  22  22  30  31  32  32  33  34  35  31  32  33  34  40  41  42  43  44  45)
   (list  22  21   6   6   6   6   6   5   4   3   3   3   3   3   3   6  14  17  20  18  16   4   3   3   3   3   3)
   (list 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
 );mapcar
 (mapcar 'vector_image; T
   (list  47  47  48  49  50  51  52  46  46  45  45  44)
   (list  22  21  21  21  21  21  21   3   4   5   6   7)
   (list  52  51  52  53  54  55  56  61  61  61  60  60)
   (list  22   4   4   4   4   4   4   3   4   5   6   7)
   (list 0 0 0 0 0 0 0 0 0 0 0 0)
 );mapcar
 (vector_image 61 3 32 21 1); /
 (end_image)
);defun FWTlogo
;-----------------------------------------------------------------------------
; MAIN
;-----------------------------------------------------------------------------
(defun C:LAD()
     (setq myList1(list "RV01-RV02" "RV03-RV04" "RV05-RV06" "RV07-RV08" "RV09-RV10"
       "RV11-RV12" "RV13-RV14" "RV15-RV16" "RV17-RV18" "RV19-RV20"
       "RV21-RV22" "RV23-RV24" "RV25-RV26" "RV27-RV28")) 
  (setq myList2(list "3in." "3 1/2in." "4in." "4 1/2in." "5in." "5 1/2in." "6in." "6 1/2in." "7in." "7 1/2in." "8in."))

 (if(not(setq dcl_id (load_dialog "LAD.dcl")))
   (progn
     (alert "The DCL file could not be loaded!")
     (exit)
   )
   (progn
     (if (not(new_dialog "LAD" dcl_id))
       (progn
       (alert "The LAD.DCL file could not be loaded!")
         (exit)
       )
   
    (progn  
         (start_list "mylist1" 3)
         (mapcar 'add_list myList1)
         (end_list)
         (start_list "mylist2" 3)
         (mapcar 'add_list myList2)
         (end_list)
(fwtlogo)
         (action_tile "accept" "(saveVars)(done_dialog 2)")
         (action_tile "cancel" "(done_dialog 1)")
         (setq ddiag(start_dialog))
         (unload_dialog dcl_id)
         (if(= ddiag 1)
           (princ "\n LAD cancelled!")
         )
         (if(= ddiag 2)
           (progn
             (princ "\n The user pressed Okay!")
           )
         )
       )
     )
   )
 )
 (princ)
)

LAD DCL.jpg

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...