Wednesday, September 24, 2008

LSP and DCL

Good morning Bloggers!

I have taken on a task that is challenging to me. I have never created LSP or DCL codes before.
We have a huge need to create a pop-up dialog box that warns people that they are opening an R14 dwg inside of the 07 product. We have had too many projects get overwritten into 07 and the saving down/exporting/converting...you name it, there is no sufficient fix. We want them to stop doing it altogether.

If any of you can comment/contact me if you have suggestions and/or answers to my questions this would just rock!

My questions are this:
1. How do I add a .bmp image (that is stored on a network drive) to show up in the dialog box? (It is stored here: F:\HBEDT2K7\Setup\WarnImage.bmp)

2. How do I change the font of the text that appears in the dialog box? I would like to make the font larger, bolder, and perhaps a different font style altogether.

3. How do I change the color of the font? How do I change the color of the "buttons"? How do I change the color of the background of the dialog box? Basically what are all the ways to manipulate colors in the dialog box.

4. How do I get my dialog box to print out the "acadv" variable? I want it to state something along the lines of: Warning you have just opened a "acadv" dwg.... Is this possible?


Here is my current LSP file

;;;;
;;;;Beginning of the AutoLISP routine
;;;

(setq dwgfile (strcat (getvar "dwgprefix")(getvar "dwgname")))
(setq rfile (open dwgfile "r"))
(setq dwgver (substr (read-line rfile) 1 6))
(close rfile)

(cond

((= dwgver "AC1021")
(close)
)
((= dwgver "AC1014")
(setq acadv "AutoCAD R14")
)
((= dwgver "AC1012")
(setq acadv "AutoCAD R13")
)
((= dwgver "AC1009")
(setq acadv "AutoCAD R11 or R12")
)
((= dwgver "AC1006")
(setq acadv "AutoCAD R10")
)
((= dwgver "AC1004")
(setq acadv "AutoCAD R9")
)
((= dwgver "AC1002")
(setq acadv "AutoCAD R2.6")
)
((= dwgver "AC1.50")
(setq acadv "AutoCAD R2.05")
)
((= dwgver "AC1015")
(setq acadv "AutoCAD 2000")
)
((= dwgver "AC1016")
(setq acadv "AutoCAD 2000i")
)
((= dwgver "AC1017")
(setq acadv "AutoCAD 2002")
)
((= dwgver "AC1018")
(setq acadv "AutoCAD 2004")
)
((= dwgver "AC1019")
(setq acadv "AutoCAD 2005")
)
((= dwgver "AC1020")
(setq acadv "AutoCAD 2006")
)
;;;; ((= dwgver "AC1022")
;;;; (setq acadv "AutoCAD 2008")
;;;; )
;;;; ((= dwgver "AC1023")
;;;; (setq acadv "AutoCAD 2009")
;;;; )
)

(setq dclid (load_dialog "warnr14.dcl"))
(new_dialog "warnr14" dclid)
(defun edit_action1 (val)
(setq NT val)
)

(action_tile "accept" "(unload_dialog)")
(action_tile "cancel" "(done_dialog)")

(start_dialog)

(done_dialog)
(command "_.close")
(command "y")


(unload_dialog dclid)

)

;;;;
;;;;End of the AutoLISP routine


Here is my DCL code:

warnr14 : dialog {

label = "WARNING!!! WARNING!!!";

: image {
key = "im";
height = 1.0;
width = 1.0;
}

: paragraph {
: text_part {
label = "YOU JUST OPENED AN R14 DWG IN 2007.";
}
: text_part {
label = "Verify this file is Read-only before clicking 'Open' (Check the header).";
}
: text_part {
label = "If you ignore this warning and end up saving this as a 2007 dwg, YOU WILL REPAIR THIS FILE ON YOUR OWN TIME!!";
}
}

: image {
key = "im2";
height = 1.0;
width = 1.0;
}

: row {

: button {
label = "CANCEL";
key = "cancel";
mnemonic = "C";
alignment = centered;
width = 0.5;
height = 3;
is_default = true;
}

: button {
fixed_width = true;
fixed_height = true;
label = "Open";
key = "accept";
mnemonic = "O";
}
}
}

No comments: