Jump to content

Airduct; calculation ,drawing.


turgaygirgin

Recommended Posts

Hello everyone,

 

I'm a conditioning-cooling technician. I've been trying to learn autolisp and write an autolisp program for about two years. My program is about air duct calculation and drawing. I draw the air duct route as a single line. I write the air flow rate on the airdiffizor places. The program calculates the air flow rate in each part, resizes it according to the equal friction method, and draws the model space. I want the user to be able to select some parameters for the drawing. I created a DCL for this. Part number (toogle), layer (popup_list) color (popup_list) text height (edit_box) . The user should be able to set the attributes (layer, color, text height) of the text he wants to print from here. What I want to do is:

 

 1- The layer popup list should be the list of layers in the active drawing.

 

 2- The color popup list should be like the popup in the properties toolbar.

 

I would be grateful to anyone who can help. Thank you.

my code for dcl:

Cizparam : dialog {
           label ="Çizim Parametreleri";
           width = 30;
          height = 20 ;
         : boxed_column {
           label ="Yazdırma Seçenekleri";
           :row {
           : column {
	   : row { : toggle { key = "Pndim_tog"; label = "Parça Numarası " ; alignment = centered ;}}
	   : row { : toggle { key = "Kndim_tog"; label = "Kanal Ebadı    " ; alignment = centered ;}}
	   : row { : toggle { key = "AFdim_tog"; label = "Hava Debisi    " ; alignment = centered ;}}
	   : row { : toggle { key = "Padim_tog"; label = "Basınc Kaybı   " ; alignment = centered ;}}
	   : row { : toggle { key = "Vldim_tog"; label = "Hava Hızı      " ; alignment = centered ;}}
	   : row { : toggle { key = "Ftdim_tog"; label = "Fittings Adı   " ; alignment = centered ;}}
	   	    }
	   : column {	    
	   : row { : popup_list { label = "Layer:" ;  key = "PnoLay_lst";  alignment = centered ; value = "1" ;}}
	   : row { : popup_list { label = "Layer:" ;  key = "KnELay_lst";  alignment = centered ; value = "0" ;}}
	   : row { : popup_list { label = "Layer:" ;  key = "AflLay_lst";  alignment = centered ; value = "0" ;}}
	   : row { : popup_list { label = "Layer:" ;  key = "PamLay_lst";  alignment = centered ; value = "0" ;}}
	   : row { : popup_list { label = "Layer:" ;  key = "VelLay_lst";  alignment = centered ; value = "0" ;}}
	   : row { : popup_list { label = "Layer:" ;  key = "FttLay_lst";  alignment = centered ; value = "0" ;}}
	   	    }
	   : column {	    
	   : row { : popup_list { label = "Color:" ;  key = "PnoClr_lst";  alignment = centered ; value = "8" ;}}
	   : row { : popup_list { label = "Color:" ;  key = "KnEClr_lst";  alignment = centered ; value = "8" ;}}
	   : row { : popup_list { label = "Color:" ;  key = "AflClr_lst";  alignment = centered ; value = "8" ;}}
	   : row { : popup_list { label = "Color:" ;  key = "PamClr_lst";  alignment = centered ; value = "8" ;}}
	   : row { : popup_list { label = "Color:" ;  key = "VelClr_lst";  alignment = centered ; value = "8" ;}}
	   : row { : popup_list { label = "Color:" ;  key = "FttClr_lst";  alignment = centered ; value = "8" ;}}
	   	    }
	   : column {
	   : row { : edit_box { key = "Pno_eb";  label = "Yazı Yüksekliği :" ; edit_width = 3; fixed_width = true; allow_accept = false; alignment = centered ;}}
	   : row { : edit_box { key = "KnE_eb";  label = "Yazı Yüksekliği :" ; edit_width = 3; fixed_width = true; allow_accept = false; alignment = centered ;}}
	   : row { : edit_box { key = "Afl_eb";  label = "Yazı Yüksekliği :" ; edit_width = 3; fixed_width = true; allow_accept = false; alignment = centered ;}}
	   : row { : edit_box { key = "Pam_eb";  label = "Yazı Yüksekliği :" ; edit_width = 3; fixed_width = true; allow_accept = false; alignment = centered ;}}
	   : row { : edit_box { key = "Vel_eb";  label = "Yazı Yüksekliği :" ; edit_width = 3; fixed_width = true; allow_accept = false; alignment = centered ;}}
	   : row { : edit_box { key = "Ftt_eb";  label = "Yazı Yüksekliği :" ; edit_width = 3; fixed_width = true; allow_accept = false; alignment = centered ;}}
		    }
	       }
         : row {  width = 50; fixed_width = true; alignment = centered ;
           : button { key = "Accept"; label = "Tamam"; width = 15; fixed_width = true; alignment = left; is_default = true; is_cancel = false; mnemonic = "T"; }
           : button { key = "Cancel"; label = "Iptal"; width = 15; fixed_width = true; alignment = left; is_default = false; is_cancel = true; mnemonic = "I"; }
           : button { key = "Hlp"; label = "Yardım"; width = 15; fixed_width = true; alignment = left; is_default = false; mnemonic = "Y"; }
               }
                         }
         } // dialog end.

And lsp:

(defun c:Cpr ( / LayL ClrL Dclid_Cp CzPar)

  (setq LayL (list "MK-HV Kanal SUPPLY" "MK-HV Kanal FRESH" "MK-HV Kanal RETURN" "MK-HV Kanal EGZOST" "MK-HV Kanal YAZI")
	ClrL (list "ByLayer" "ByBlock" "1 Red" "2 Yellow" "3 Green" "4 Cyan" "5 Blue" "6 Magenta" "7 White" "Select Color..."))
	
  (setq Dclid_Cp (load_dialog "DrwParam.DCL"))
   (if (not (new_dialog "Cizparam" Dclid_Cp))(exit)
    (progn
      (start_list "PnoLay_lst")(mapcar 'add_list LayL)(end_list)  ; Parça numarası yazısı layeri ( Part Number Text Layer)
      (start_list "PnoClr_lst")(mapcar 'add_list ClrL)(end_list)  ; Parça numarası yazı rengi ( Part number text layer color)
      (start_list "KnELay_lst")(mapcar 'add_list LayL)(end_list)  ; Parça Ebadı yazısı ( Part Dimension Text Layer)
      (start_list "KnEClr_lst")(mapcar 'add_list ClrL)(end_list)  ; Parça Ebadı yazı rengi ( Part Dimension text layer color)
      (start_list "AflLay_lst")(mapcar 'add_list LayL)(end_list)  ; Hava debisi yazısı ( Airvolume Text Layer)
      (start_list "AflClr_lst")(mapcar 'add_list ClrL)(end_list)  ; Hava debisi yazı rengi ( Airvolume text layer color)
      (start_list "PamLay_lst")(mapcar 'add_list LayL)(end_list)  ; Basınc kaybı yazısı ( Pressure lose Text Layer)
      (start_list "PamClr_lst")(mapcar 'add_list ClrL)(end_list)  ; Basınc kaybı yazı rengi ( Pressure lose text layer color)
      (start_list "VelLay_lst")(mapcar 'add_list LayL)(end_list)  ; Hava hızı yazısı ( AirVelocity Text Layer)
      (start_list "VelClr_lst")(mapcar 'add_list ClrL)(end_list)  ; Hava hızı yazı rengi ( AirVelocity text layer color)
      (start_list "FttLay_lst")(mapcar 'add_list LayL)(end_list)  ; Fitingsno yazısı ( Fittings Number Text Layer)
      (start_list "FttClr_lst")(mapcar 'add_list ClrL)(end_list)  ; Fitingsno yazı rengi ( Fittings Number text layer color)
            
      (action_tile "Accept" "(done_dialog 1)")
      (action_tile "Cancel" "(done_dialog 0)")
      (setq CzPar (start_dialog))
      (unload_dialog Dclid_Cp)
       (if (= CzPar 1) (alert "Çizim Parametreleri Kaydedildi.!!"))
       (if (= CzPar 0) (alert "Çizim Parametreleri Kaydedilmedi.!!"))
    )
   )
)

 

  • Like 1
Link to comment
Share on other sites

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