Jump to content

Recommended Posts

Posted

I have setup (with help) a number of lisps to create drainage lines on drawings. Each lisp has a different dialog dcl file. When I load them all and run them they all load the one dcl even though I Have checked that they all refer to their respective dcl's.

 

Has anyone come across this before? Any ideas??

Posted

I checked it out and it's like the dialog dcl file isn't being cleared when the next lisp starts. I include a lisp and dcl file. Can I unload or purge the dcl before loading one or what?

 

I would appreciate help on this.

 

Ta.

Posted

Make Sure The Variables In The Lisp Files Are Localized

Like (defun C:x ( / Var1 Var2.....)

This Will Kill Them So They Are Not Effecting Other Lisp

Posted

Thanks John M,

Can you look at this and tell me how I get around the problem of the variables all being localised. I tried to sort but got errors.

 

Thanks.

 

 
;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:BLINS ()
 (BLINS_MF)
 (princ)
)
(princ "\nBLINS.lsp Loaded....")
(princ "\nType BLINS to start program.")
;
;//////////////////////////////////////////////////////////////////////////
;
; Choose List Items Function
;
(defun BLINS_CLI (lst items)
 (mapcar '(lambda (i) (nth i lst)) items)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Update Type List Function
;
(defun BLINS_UTL (D:PIP)
 (setq ST_list '("Type A" "Type B" "Type C" "Type D" "Type 1" "Type 2" "Type 3" "Type 4" ""))
 (cond
   ((= D:PIP "DP01")(mode_tile "ST" 1)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '()))      (end_list))
   ((= D:PIP "DP02")(mode_tile "ST" 1)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '()))      (end_list))
   ((= D:PIP "DP03")(mode_tile "ST" 1)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '()))      (end_list))
   ((= D:PIP "DP04")(mode_tile "ST" 1)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '()))      (end_list))
   ((= D:PIP "DP05")(mode_tile "ST" 0)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list))
   ((= D:PIP "DP06")(mode_tile "ST" 1)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '()))      (end_list))
   ((= D:PIP "DP07")(mode_tile "ST" 0)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list))
   ((= D:PIP "DP08")(mode_tile "ST" 0)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list))
   ((= D:PIP "DP09")(mode_tile "ST" 0)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list))
   ((= D:PIP "DP10")(mode_tile "ST" 0)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(0 1 2 3))))(end_list))
   ((= D:PIP "DP11")(mode_tile "ST" 0)(start_list "ST" 3)(mapcar 'add_list (setq ST_list (BLINS_CLI ST_list '(4 5 6 7))))(end_list))
 )
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun BLINS_MF (/ DPIP$ DPIP STYP$ STYP SUCL SUCR outp INTP)
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))
 (setq dcl_id (load_dialog "BLINS.dcl"))
 (if (not (new_dialog "BLINS" dcl_id))
   (progn (ALERT "Can not find your dcl file")(exit)))
 (or D:PIP (setq D:PIP "DP01"))
 (set_tile D:PIP "1")
 (BLINS_UTL D:PIP)
 (action_tile "DP01" "(BLINS_UTL (setq D:PIP \"DP01\"))")
 (action_tile "DP02" "(BLINS_UTL (setq D:PIP \"DP02\"))")
 (action_tile "DP03" "(BLINS_UTL (setq D:PIP \"DP03\"))")
 (action_tile "DP04" "(BLINS_UTL (setq D:PIP \"DP04\"))")
 (action_tile "DP05" "(BLINS_UTL (setq D:PIP \"DP05\"))")
 (action_tile "DP06" "(BLINS_UTL (setq D:PIP \"DP06\"))")
 (action_tile "DP07" "(BLINS_UTL (setq D:PIP \"DP07\"))")
 (action_tile "DP08" "(BLINS_UTL (setq D:PIP \"DP08\"))")
 (action_tile "DP09" "(BLINS_UTL (setq D:PIP \"DP09\"))")
 (action_tile "DP10" "(BLINS_UTL (setq D:PIP \"DP10\"))")
 (action_tile "DP11" "(BLINS_UTL (setq D:PIP \"DP11\"))")
 (if STYP:DEF (set_tile "ST" (itoa STYP:DEF)))
 (action_tile "accept"
   (strcat "(progn (setq S:TYP (atoi (get_tile \"ST\")) STYP:DEF S:TYP)"
           "(done_dialog)(setq userclick T))"))
 (action_tile "cancel" "(done_dialog)(setq userclick nil)")
 (start_dialog)(unload_dialog dcl_id)
 (if userclick
   (BLINS_VF))
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Variable Function
;
(defun BLINS_VF ()
 (setq DPIP$ D:PIP)
 (cond
   ((= DPIP$ "DP01")(setq DPIP "Existing Filter Drains"))
   ((= DPIP$ "DP02")(setq DPIP "Existing Filter Drains to be Removed"))
   ((= DPIP$ "DP03")(setq DPIP "Existing Foul Sewer"))
   ((= DPIP$ "DP04")(setq DPIP "Existing Foul Sewer to be Removed"))
   ((= DPIP$ "DP05")(setq DPIP "Existing PVC Storm Sewer to be Replaced with Concrete"))
   ((= DPIP$ "DP06")(setq DPIP "Existing Storm Sewer"))
   ((= DPIP$ "DP07")(setq DPIP "Existing Storm Sewer to be Relaid")) 
   ((= DPIP$ "DP08")(setq DPIP "Proposed Concrete Class H Piped Culvert"))
   ((= DPIP$ "DP09")(setq DPIP "Proposed Ductile Iron Storm Sewer"))
   ((= DPIP$ "DP10")(setq DPIP "Proposed Filter Drain RCD 500 1 Geotextile"))
   ((= DPIP$ "DP11")(setq DPIP "Proposed Thermoplastic Integrally Socketed Carrier Drain"))
 )
 (progn
   (setq S:TYP (fix S:TYP))
   (setq S:TYP (nth S:TYP ST_list))
   (setq STYP$ S:TYP)
   (cond
     ((= STYP$ "Type A")(setq STYP "Type A")) 
     ((= STYP$ "Type B")(setq STYP "Type B")) 
     ((= STYP$ "Type C")(setq STYP "Type C")) 
     ((= STYP$ "Type D")(setq STYP "Type D")) 
     ((= STYP$ "Type 1")(setq STYP "Type 1")) 
     ((= STYP$ "Type 2")(setq STYP "Type 2")) 
     ((= STYP$ "Type 3")(setq STYP "Type 3")) 
     ((= STYP$ "Type 4")(setq STYP "Type 4")) 
     ((= STYP$ "")      (setq STYP "")) 
   )
 )
 (BLINS_OF)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Output Function
;
(defun BLINS_OF ()
 (BLINS_ML "CCC_TITLE_Legend" "7" "")
 (setq outp (strcat DPIP " " STYP))
 (setq INPT (getpoint "\Get insertion point:"))
 (command "_-color"  "bylayer")
 (command "_.insert" outp INPT "1" "1" "0")
 (setvar "clayer"  SUCL)
 (setvar "cecolor" SUCR)
 (princ)
)
;
;//////////////////////////////////////////////////////////////////////////
;
; Make Layer Function
;
(defun BLINS_ML (NLAY CLR LT / LAY FRZ)
 (setq LAY (tblsearch "layer" NLAY))
 (if (not LAY)
   (command "_.layer" "m" NLAY "c" CLR "" "lt" LT "" "")
   (progn
     (setq FRZ (cdr (assoc 70 LAY)))
     (if (= FRZ 65)
       (progn
         (command "_.layer" "t" NLAY "")
         (command "_.layer" "s" NLAY ""))
       (command "_.layer" "s" NLAY ""))))
)
;
;//////////////////////////////////////////////////////////////////////////

Posted

Do I have to go through each file and set the variables or is there another way I can stop the dialog cross over????

Posted
Do I have to go through each file and set the variables or is there another way I can stop the dialog cross over????

 

woodman78,

 

Try adding dcl_id to your list of localized variables and see what happens.

Posted

I tried that but no joy Buzzard. I have made all the variables local. I also tried making one .dcl file with all the dialog codes but no joy there either.

 

Any other ideas?

Posted
I tried that but no joy Buzzard. I have made all the variables local. I also tried making one .dcl file with all the dialog codes but no joy there either.

 

Any other ideas?

I cannot see this happening if each dcl and program have a different name. Can you post the programs and dcls that are doing this?

 

Not sure, But it seems to me you are not explaining the whole problem. You are leaving a key clue out. Did you make an additional program to load and run all these programs?

Posted

woodman78,

 

I loaded all programs from past threads you started pertaining to dialogs and linetypes. Each program loads its own dcl without a hitch and all programs were loaded in the same session. Unless something was changed from those points I would start looking there. I could not see anything wrong with the programs completed from those sessions.

 

If you would post the programs and dcls you are referring to with this problem, Then we can get this resolved. You are asking for answers off the top of peoples heads. Nothing will get accomplished this way.

Posted

Sorry Buzzard,

 

I didn't mean to sound demanding. I am very grateful for the help I get on CADTutor. Anyway, I have included some of the lisp's i use. The thing is that the ones that I was helped it here I have duplicated many times to create different versions because we have so many different options for drainage.

When I load all the lisps, the blins dialog is fine in that it will always load correctly but with all the drainage ones (ESS, EFS, EFDAT....) only the last loaded dialog seems to load repeatedly.

Hope this helps..

Posted

Sorry Buzzard,

 

I didn't mean to sound demanding. I am very grateful for the help I get on CADTutor. Anyway, I have included some of the lisp's i use. The thing is that the ones that I was helped it here I have duplicated many times to create different versions because we have so many different options for drainage.

When I load all the lisps, the blins dialog is fine in that it will always load correctly but with all the drainage ones (ESS, EFS, EFDAT....) only the last loaded dialog seems to load repeatedly.

Hope this helps..

EFDAT.dcl

EFDAT.lsp

EFS.dcl

EFS.lsp

EFSTBR.dcl

EFSTBR.lsp

blins.dcl

blins.lsp

Posted
Sorry Buzzard,

 

I didn't mean to sound demanding. I am very grateful for the help I get on CADTutor. Anyway, I have included some of the lisp's i use. The thing is that the ones that I was helped it here I have duplicated many times to create different versions because we have so many different options for drainage.

When I load all the lisps, the blins dialog is fine in that it will always load correctly but with all the drainage ones (ESS, EFS, EFDAT....) only the last loaded dialog seems to load repeatedly.

Hope this helps..

 

Please do not misinterpret me. In order to resolve your problem it must be duplicated for others to see. Then you will be able to get an accurate answer. Otherwise all we are doing is guessing at this.

I will take a look at what you have.

Posted

Ok,

 

Now I know what the problem is.

All the functions between the different programs are named the same.

They all have POPUP_MF function for example.

 

Try this:

 

For each program you have, Take its name for example EFDAT and call the function instead of POPUP_MF, Call it EFDAT_MF.

Do the same for the rest of the functions in the entire program as you have duplicated them all. VARIABLE, OUTPUT and so on.

When you get to the next program, Use its name in the same manner as you did with the previous.

This will resolve the problem.

See how easy that was.

 

The names used at the time of the examples were only meant as an example for that program at that time.

Posted

Thanks Buzzard. that did the job. I thought it was only the first function in the lisp that had to be unique.

Posted
Thanks Buzzard. that did the job. I thought it was only the first function in the lisp that had to be unique.

 

Even though these are local functions, You still need to have them unique. Functions such as degrees to radians for example will always perform the same exact function and you can get away with it there.

When functions perform a different task it pays to name them in a way as not to interfere with the operation of another program. Using the method I explained to you will make it easier to name functions as they will always pertain to the program name and you know what would happen if you had two programs of the same name. It kind of works in a sort of way for the same reason you localize variables so that they will not interfere with programs using the same variable name.

 

I hope you understood all that.

Glad you got it working,

The Buzzard

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...