Author Topic: HELP WITH A PROGRAM FOR CAD..PLEASE.  (Read 21921 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #15 on: December 06, 2004, 08:08:07 AM »
Very good explination Mark.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #16 on: December 06, 2004, 10:14:01 AM »
WOW...lot to reply to on a Monday morning....

Let me get on the questions above from cab an dwork my way down....

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #17 on: December 06, 2004, 11:20:24 AM »
ok here is the example of the rack.

http://www.theswamp.org/screens/AVCAD/RACK.jpg

Hope it is good enough if not I will post more.

This was an 85" rack. It has 45 Panel spaces.

They are 1.75" in height each (1 unit high) and they are 19" in length.

Text should be in all CAP'S. For now let the Charaters rest at the max. The Tags that will be in these shold be nothing more then...

DVD
AMP
VCR/DVD
CATV
SERVER

so I dont think it will be a problem.

Here is an example with the Side Panels and Rack Scales attached.

http://www.theswamp.org/screens/AVCAD/RACK1.jpg

******************

Side panels are not Split or even panels that reside inside the rack. They are actually a peice of equipment attached to the side of the rack to allow for ventalation and cable paths.

It would actually be a seperate vlock that gets attached to the rack. (see picture)

********************

Scale agian is seperate block attached to the rack. This block is for ease of counting Units heights. (see Picture)

********************

So those two yes/no options would be for the entire block. Selecting yes would attach those two or one block when you hit ok. Or I would like it to atleast.

If that doesnt clear that up I will try again.

****************************

I was mistaken in my post.

Quote

HEIGHT OF PANEL SELECTIONS:
1 TO 30
1 TO 9 - 2 WAY SPLIT
1 TO 9 - 3 WAY SPLIT


Should read:

HEIGHT OF PANEL SELECTIONS:
1 TO 12 - ALL HAVE FULL IN ADDITION TO FOLLOWING
1 TO 10 - 2 WAY SPLIT
1 TO 10 - 3 WAY SPLIT
11 TO 12 - ARE ONLY FULL NO SPLITS

***********************

So Height of Panel can go up to 12 ( 1 2 3 4 5 6 7 8 9 10 11 12 )

Within the Height of Panel Drop down it should have Multiple selections

1 - Full
1 - 2 way split
1 - 3 way split

2 - Full
2 - Full - 2 Line of text
2 - 2 way split
2 - 2 way split - 2 line of text
2 - 3 way split
2 - 3 way split - 2 line of text

3 - Full
3 - Full - 2 Line of text
3 - Full - 3 Line of text
3 - 2 way split
3 - 2 way split - 2 line of text
3 - 2 way split - 3 line of text
3 - 3 way split
3 - 3 way split - 2 line of text
3 - 3 way split - 3 line of text

(3 thru 12 will be the same)

I think we get the point there will be a lot of selections.

**************************

OK....Now when...lets say

3 - 2 way split - 3 line of text  ....... is selected

This would mean that there would be a:

Left and Right Text area availble with 3 line of text each

If

3 - Full - 3 Line of text  ....... is selected

this would mean that there would be:

1 text area availble with 3 lines of text

***************************************

Hope this helps.

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #18 on: December 06, 2004, 11:48:01 AM »
I changed the LSP file to this:

Code: [Select]

(defun popup_rack (/ rack_h_lst dcl_id hght click)

  ; the list the user sees
  (setq rack_h_lst
    (list
      "25 Unit Rack"
      "30 Unit Rack"
      "35 Unit Rack"
      "40 Unit Rack"
      "45 Unit Rack"
      )
    )

  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "rack_h") (mapcar 'add_list rack_h_lst) (end_list)

  (action_tile "accept"

               (strcat
                 "(progn
                    (setq hght (get_tile \"rack_h\"))"
                    "(done_dialog) (setq click T)
                    )"
                 );strcat
               );action tile

  (action_tile "cancel"

           "(done_dialog)
           (setq click nil)"  
           );action_tile

  (start_dialog)(unload_dialog dcl_id)

  (if click
      (setq hght (nth (atoi hght) rack_h_lst))
    ; else
    (exit)
    );if userclick

  ;;-------------------dcl stuff--------------------------------
  )


Only reason being I think I would be more clear to but the Rack units instead of the Height of rack.

Also added this to the DCL file....

Code: [Select]

dialog_p : dialog
{
label = "Equipment Rack Creation Center";
: popup_list {
             label = "Rack Height:";
             key = "rack_h";          // what the user selected
             value = "0" ;            // initial value
             edit_width = 30;         // fix the width (optional)
             }
ok_cancel;
}


By they way this is great!!!

I didnt go to school to learn LSP or anything so doing it like this is awsome. I get to see the code be built and I can understand what is happening.

You might want to set thius up as a Tutorial or something after we are done.

Thanks alot for you help on this I really do appreciate it.

I will let Santa know to leave you a doughnut, maybe two!

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #19 on: December 06, 2004, 11:49:08 AM »
oh ya...

I set my directories up the same way.

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #20 on: December 06, 2004, 01:10:35 PM »
OK..I did some work to try to understand what is going on..so here goes..

Code: [Select]

(defun popup_rack (/ rack_h_lst dcl_id hght click)

  ; the list the user sees
  (setq rack_h_lst
    (list
      "25 Unit Rack"
      "30 Unit Rack"
      "35 Unit Rack"
      "40 Unit Rack"
      "45 Unit Rack"
      )
    )

  ; the list the user sees
  (setq caster_h_lst
    (list
      "Yes"
      "No"
      )
    )
 
  ; the list the user sees
  (setq sidepanels_h_lst
    (list
      "Yes"
      "No"
      )
    )
 
  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "rack_h") (mapcar 'add_list rack_h_lst) (end_list)

  (action_tile "accept"

               (strcat
                 "(progn
                    (setq hght (get_tile \"rack_h\"))"
                    "(done_dialog) (setq click T)
                    )"
                 );strcat
               );action tile

  (action_tile "cancel"

           "(done_dialog)
           (setq click nil)"  
           );action_tile

  (start_dialog)(unload_dialog dcl_id)

  (if click
      (setq hght (nth (atoi hght) rack_h_lst))
    ; else
    (exit)
    );if userclick

  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "caster_h") (mapcar 'add_list caster_h_lst) (end_list)

  (action_tile "accept"

               (strcat
                 "(progn
                    (setq hght (get_tile \"caster_h\"))"
                    "(done_dialog) (setq click T)
                    )"
                 );strcat
               );action tile

  (action_tile "cancel"

           "(done_dialog)
           (setq click nil)"  
           );action_tile

  (start_dialog)(unload_dialog dcl_id)

  (if click
      (setq hght (nth (atoi hght) rack_h_lst))
    ; else
    (exit)
    );if userclick

  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "sidepanels_h") (mapcar 'add_list sidepanels_h_lst) (end_list)

  (action_tile "accept"

               (strcat
                 "(progn
                    (setq hght (get_tile \"sidepanels_h\"))"
                    "(done_dialog) (setq click T)
                    )"
                 );strcat
               );action tile

  (action_tile "cancel"

           "(done_dialog)
           (setq click nil)"  
           );action_tile

  (start_dialog)(unload_dialog dcl_id)

  (if click
      (setq hght (nth (atoi hght) caster_h_lst))
    ; else
    (exit)
    );if userclick
 
  ;;-------------------dcl stuff--------------------------------
  )



Code: [Select]

dialog_p : dialog
{
label = "Equipment Rack Creation Center";
: popup_list {
             label = "Rack Height:";
             key = "rack_h";          // what the user selected
             value = "0" ;            // initial value
             edit_width = 30;         // fix the width (optional)
             }
: popup_list {
             label = "Casters:";
             key = "caster_h";        // what the user selected
             value = "1" ;            // initial value
             edit_width = 30;         // fix the width (optional)
             }
: popup_list {
             label = "Side Panels:";
             key = "sidepanels_h";    // what the user selected
             value = "1" ;            // initial value
             edit_width = 30;         // fix the width (optional)
             }            
ok_cancel;
}


OK those are the 2 new files I have worked with.

They work but I have to hit OK to go to the next step. Is there a way to just like has and AUTO OK when the drop down in selected?

for this top section atleast?

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #21 on: December 06, 2004, 01:46:04 PM »
You're getting there. :D
try this out.
Code: [Select]


(defun popup_rack (/ rack_h_lst dcl_id hght click)

  ; the list the user sees
  (setq rack_h_lst
        (list
          "25 Unit Rack"
          "30 Unit Rack"
          "35 Unit Rack"
          "40 Unit Rack"
          "45 Unit Rack"
          )
        )

  ; the list the user sees
  (setq caster_h_lst
        (list
          "Yes"
          "No"
          )
        )

  (setq sidepanels_h_lst
        (list
          "Yes"
          "No"
          )
        )

  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "rack_h") (mapcar 'add_list rack_h_lst) (end_list)
  (start_list "caster_h") (mapcar 'add_list caster_h_lst) (end_list)
  (start_list "sidepanels_h") (mapcar 'add_list sidepanels_h_lst) (end_list)

  (action_tile "accept"

               (strcat
                 "(progn
                    (setq hght (get_tile \"rack_h\")
                          caster (get_tile \"caster_h\")
                          side_p (get_tile \"sidepanels_h\")
                          )"
                    "(done_dialog) (setq click T)
                 )"
               );strcat
  );action tile

(action_tile "cancel"

             "(done_dialog)
             (setq click nil)"
             );action_tile

(start_dialog)(unload_dialog dcl_id)

(if click
  (setq ans_lst
        (list
          (nth (atoi hght) rack_h_lst)
          (nth (atoi caster) caster_h_lst)
          (nth (atoi side_p) sidepanels_h_lst)
          )
        )
  ; else
  (exit)
  );if userclick
)
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #22 on: December 06, 2004, 02:45:36 PM »
AVCAD
have you considered chack boxes for the Yes/No Items? Like This:
Code: [Select]
dialog_p : dialog
{
label = "Equipment Rack Creation Center";
: popup_list {
             label = "Rack Height:";
             key = "rack_h";          // what the user selected
             value = "0" ;            // initial value
             edit_width = 30;         // fix the width (optional)
             }
: toggle {
             label = "Casters:";
             key = "caster_h";        // what the user selected
             value = "1" ;            // initial value
             fixed_width = true;
             }
: toggle {
             label = "Side Panels:";
             key = "sidepanels_h";    // what the user selected
             value = "1" ;            // initial value
             fixed_width = true;
             }              
ok_cancel;
}


Code: [Select]
(defun c:test() (popup_rack))
(defun popup_rack (/ rack_h_lst dcl_id hght click)

  ; the list the user sees
  (setq rack_h_lst
        (list
          "25 Unit Rack"
          "30 Unit Rack"
          "35 Unit Rack"
          "40 Unit Rack"
          "45 Unit Rack"
          )
        )

 
  (setq caster_h "1") ; "1" = YES
  (setq sidepanels_h "1")

  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "rack_h") (mapcar 'add_list rack_h_lst) (end_list)
  (action_tile "caster_h" "(setq caster_h $value)" )
  (action_tile  "sidepanels_h" "(setq sidepanels_h $value)" )

  (action_tile "accept"

               (strcat
                 "(progn
                    (setq hght (get_tile \"rack_h\")
                          caster (get_tile \"caster_h\")
                          side_p (get_tile \"sidepanels_h\")
                          )"
                    "(done_dialog) (setq click T)
                 )"
               );strcat
  );action tile

(action_tile "cancel"

             "(done_dialog)
             (setq click nil)"
             );action_tile

(start_dialog)(unload_dialog dcl_id)

(if click
  (setq ans_lst
        (list
          (nth (atoi hght) rack_h_lst)
          )
        )
  ; else
  (exit)
  );if userclick
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #23 on: December 06, 2004, 04:41:18 PM »
Alright, I took both your advises.

I didnt think about check boxes at first but seems like a good idea.

here is what I did.

Basically I used the code that Mark so gracefully shortened for me. Thanks!

and used CAB's check box code and out them together where I thought and it actually worked!

use this to run it:
Code: [Select]

(setq return (popup_rack))


lsp:
Code: [Select]

  (defun popup_rack (/ rack_h_lst dcl_id hght click)

  ; the list the user sees
  (setq rack_h_lst
        (list
          "25 Unit Rack"
          "30 Unit Rack"
          "35 Unit Rack"
          "40 Unit Rack"
          "45 Unit Rack"
          )
        )

  ; the list the user sees
  (setq caster_h "0") ; "1" = YES
  (setq sidepanels_h "0")

  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "rack_h") (mapcar 'add_list rack_h_lst) (end_list)
  (start_list "caster_h") (mapcar 'add_list caster_h_lst) (end_list)
  (start_list "sidepanels_h") (mapcar 'add_list sidepanels_h_lst) (end_list)

  (action_tile "accept"

               (strcat
                 "(progn
                    (setq hght (get_tile \"rack_h\")
                          caster (get_tile \"caster_h\")
                          side_p (get_tile \"sidepanels_h\")
                          )"
                    "(done_dialog) (setq click T)
                 )"
               );strcat
  );action tile

(action_tile "cancel"

             "(done_dialog)
             (setq click nil)"
             );action_tile

(start_dialog)(unload_dialog dcl_id)

(if click
  (setq ans_lst
        (list
          (nth (atoi hght) rack_h_lst)
          (nth (atoi caster) caster_h_lst)
          (nth (atoi side_p) sidepanels_h_lst)
          )
        )
  ; else
  (exit)
  );if userclick
)


DCL:
Code: [Select]

dialog_p : dialog
{
label = "Equipment Rack Creation Center";
: popup_list {
             label = "Rack Height:";
             key = "rack_h";          // what the user selected
             value = "0" ;            // initial value
             edit_width = 30;         // fix the width (optional)
             }
: toggle {
             label = "Casters:";
             key = "caster_h";        // what the user selected
             value = "1" ;            // initial value
             fixed_width = true;
             }
: toggle {
             label = "Side Panels:";
             key = "sidepanels_h";    // what the user selected
             value = "1" ;            // initial value
             fixed_width = true;
             }              
ok_cancel;
}


I will add some more on to these but I want to post it jsut in case there was something I missed.

OH ya...is there away to have the Check box on the right side not the left. so that the Text lines up with each other?

Thanks again guys.

had to edit the code above for some reason the copy and paste didnt take everything....

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #24 on: December 06, 2004, 05:08:24 PM »
OK after further review....

I notice if the box IS checked it returns a "NO"

IF it is checked should it not return a "YES"

Meaning yes i do want it?

How do you change this? The code looks right to me. "0" is false which is usually "NO"

and "1" should be true usually "YES" right?

This is going to take while.

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #25 on: December 06, 2004, 05:54:29 PM »
Look it up in the docs, what do they say about the check box.
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #26 on: December 07, 2004, 07:33:45 AM »
Study this for a bit.

Code: [Select]

(defun popup_rack (/ rack_h_lst dcl_id hght click)

  ; the list the user sees
  (setq rack_h_lst
(list
 "25 Unit Rack"
 "30 Unit Rack"
 "35 Unit Rack"
 "40 Unit Rack"
 "45 Unit Rack"
 )
)

  ;;----------------------dcl stuff-----------------------------
  ;load dialog
  (setq dcl_id (load_dialog "dialog_p.dcl"))

  ;test for dialog
  (if (not (new_dialog "dialog_p" dcl_id))
    (exit)
    );if

  (start_list "rack_h") (mapcar 'add_list rack_h_lst) (end_list)

  ;(setq caster_h "0")
  (set_tile "caster_h" "0"); sets the initial value of the check box

  ;(setq sidepanels_h "1"); can also be done like this, using a variable
  (set_tile "sidepanels_h" "1"); sets the initial value of the check box

  (action_tile "accept"

      (strcat
"(progn
   (setq hght (get_tile \"rack_h\")
 caster (get_tile \"caster_h\")
 side_p (get_tile \"sidepanels_h\")
 )"
   "(done_dialog) (setq click T)
)"
      );strcat
  );action tile

(action_tile "cancel"

    "(done_dialog)
    (setq click nil)"
    );action_tile

(start_dialog)(unload_dialog dcl_id)

(if click
  (setq ans_lst
(list
 (nth (atoi hght) rack_h_lst)
 caster
 side_p
 )
)
  ; else
  (exit)
  );if userclick
)


Code: [Select]

dialog_p : dialog
{
label = "Equipment Rack Creation Center";
: popup_list {
             label = "Rack Height:";
             key = "rack_h";          // what the user selected
             value = "0" ;            // initial value
             edit_width = 30;         // fix the width (optional)
             }
:row {
             height = 3;
             label = "Selection";
             
             
: toggle {
             label = "Casters:";
             key = "caster_h";        // what the user selected
             fixed_width = true;
             }
: toggle {
             label = "Side Panels:";
             key = "sidepanels_h";    // what the user selected
             fixed_width = true;
             }
         }
ok_cancel;
}
TheSwamp.org  (serving the CAD community since 2003)

AVCAD

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #27 on: December 08, 2004, 12:17:37 PM »
Havent forgetten about this I have a been a little bussy at work. But I have also been looking at helpfiles and what not trying to understand some of this stuff.

Mainly how to start the next section of buttons and how to link them to the to section. but I havent figured it out yet. I will try to post what I have and maybe we can talk about how the next section will be. And how to accomplish it.

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #28 on: December 08, 2004, 12:28:44 PM »
Sounds good. I'm a little busy myself so if you don't get a quick response don't be surprised.
TheSwamp.org  (serving the CAD community since 2003)

PDJ

  • Guest
HELP WITH A PROGRAM FOR CAD..PLEASE.
« Reply #29 on: December 08, 2004, 12:39:07 PM »
Sorry to jump into this thread so late but, have you by chance checked out http://www.chatsworth.com and looked at the package they offer for free?? It does an excellent job on thier racks and even has where you can put components in the racks with a pull down menu.  All dialogue box driven too.  Might be worth a look, if for nothing else, a really good starting point for modification purposes..