Разработка программы – генератора параметрических моделей и чертежей, страница 5

               "1:1" ;plot scale

               "0,0" ;plot offset

               "Y" ;plot with plotting styles?

               "monochrome.ctb" ;plot style table

               "Y" ;plot with lineweights?

               "N" ;scale lineweights with plot scale?

               "N" ;plot paper space first?

               "N" ;hide paper space objects?

               "N" ;write the plot to a file?

               "Y" ;save changes to page setup?

               "N" ;proceed with plot?

  )

  (vl-cmdf "_-layout" "_set" "layout1") ; set current layout

  (vl-cmdf "_erase" "_l" "") ;erase default viewport in "layout1"

  (write_script)

  (vl-cmdf "_script" "Z:\projection.scr")

)

(defun dome ()

  (setq rad 50 ang 60 sides (/ 8 2))

  (if (< (setq dlgDomeID (load_dialog "lisp03_Cb.dcl")) 0) (exit))

  (print (strcat "dlgDomeID = " (itoa dlgDomeID) "  "))

  (if (not (new_dialog "dome_par" dlgDomeID)) (exit))

  (action_tile "r1" "(setq rad (atof $value))")

  (action_tile "a1" "(setq ang (atof $value))")

  (action_tile "s1" "(setq sides (/ (atoi $value) 2))")

  (setq dlgExitCode (start_dialog))

  (unload_dialog dlgDomeID)

  (print (strcat "dlgExitCode = " (itoa dlgExitcode) "  "))

  (print radius)

             ;(exit)

  (vl-cmdf "_-layout" "_set" "Model") ; set Model layout

  (profile)

  (command "_extrude" "0,0" "" 200 "") ; extrusion of dome profile

  (command "_ucs" "move" "0,0,100") ; movement of user coordinate system

  (command "_ucs" "new" "x" -90) ; rotation of user coordinate system

  (command "_-array" "0,0" "" "p" "0,0" sides (* (/ 180 sides)

               (1- sides))

               "") ; creation of polar array of extruded profiles

  (command "_intersect" "all" "") ; creation the dome as an intersection of dome profiles

  (command "_shademode" "_2d") ; switching to 2D wireframe mode

  (vl-cmdf "_ucs" "_p") ; restore the previous UCS

  (vl-cmdf "plan" "")  ; plan view for the first UCS

  (projection)

)


Листинг 2.2 Файл описания диалогового окна lisp03_Cb.dcl, вызываемый основной программой. 

dome_par: dialog{label="Dome parameters";

:edit_box{label="Radius:"; fixed_width="true"; key="r1";

          edit_width=12; edit_limit=24; value="50";}

:edit_box{label="Angle:"; fixed_width="true"; key="a1";

          edit_width=12; edit_limit=24; value="60";}

:edit_box{label="Number of sides:"; fixed_width="true"; key="s1";

          edit_width=12; edit_limit=24; value="8";}

ok_button;

:errtile{label="No errors";}

}


Листинг 2.3 Файл сценария projection.scr, который создается в процессе выполнения основной программы и из нее же вызывается на исполнение.

_PSPACE

_SOLVIEW

_u

0.5

120,240

90,280

150,200

main

_o

120,280

120,140

90,170

150,110

top

_SOLDRAW

90,280

_SOLDRAW

90,170

mview

90,90

150,30

_MSPACE

_-view

_neiso

_SOLPROF

_l

Y

Y

Y

_-layer

_set

main-VIS

_freeze

0

_freeze

main-HID

_freeze

top-HID

_freeze

PH*

_PSPACE