|
推定所要時間
|
||
|---|---|---|
|
SimpleModelGeometryCheck ジョブの最初のバージョンを作成する
|
説明:
|
5 分
|
|
演習:
|
15 分
|
|
<?xml version="1.0" encoding="UTF-8"?>
<Job type="modeling.simplegeometrycheck" has_result_data="true">
<DisplayName>Simple Model Geometry Check</DisplayName>
<Exporter java_class="com.osm.automation.ModelingJobExporter">
<StartScriptTemplate>SimpleModelGeometryCheckTemplate.lsp</StartScriptTemplate>
<ModelLoadRule catalog="model" msg_num="728">Highest Revisions</ModelLoadRule>
</Exporter>
<ResultHandler java_class="com.osm.automation.SaveToFileSystemJobResultHandler">
<TargetDirectory>C:\taskagent</TargetDirectory>
</ResultHandler>
</Job>
|
|
ジョブタイププレフィックス drafting で、ジョブ実行のターゲットとして Creo Elements/Direct Drafting を定義します。
|
|
|
データベースに保管されているジョブスケジュール (タスク) は、ジョブタイプを使用して対応するジョブ設定を探します。XML 設定ファイル内のジョブタイプを変更すると、前のジョブタイプで以前に作成されたジョブスケジュールは失敗します。
|
(in-package :frame2)
;;-------------------------
;; utilities
;;-------------------------
(load "JobUtilities.lsp")
;;------------------------------------------------------------------------------
;; This is the routine that is called by the automation framework in Modeling.
;; When this routine is called, the current directory of Modeling is the one
;; where the input data can be found.
;;
;; parameter : <ouptput-directory> directory for output data
;; return : <error-message> return value 'nil' ==> success
;;------------------------------------------------------------------------------
(defun run-job (output-directory)
(let* (
;; parameters provided by the job
(check-type :minimal_check)
;; the item to check
(part-to-check nil)
;; variables for XML serialization
(results-element (xml:xml-list-create-element "results"))
(xml-file (create-path output-directory "index.xml"))
;; variables for writing the output file
(file-zipname "model.pkg") ;; the real name of the result file in the ZIP archive
(file-path (create-path output-directory file-zipname)) ;; the path of the result file
(file-name file-zipname)
)
;;---------------------------------------------
;; load input & call the part checker
;;---------------------------------------------
(load-job-data "%ModelFile%")
(setf part-to-check (oli:sd-inq-obj-children (get-all-at-top)))
(k2-ui::check_part :objects part-to-check check-type :labels :on :keep_labels :on)
(collect-check-results (frame2:getres) results-element)
;; -------------------
;; write result data
;; -------------------
;; write the annotated model
(frame2::save-all-in-package file-path)
;; and make a corresponding entry in the index.xml
(xml:xml-list-add-child results-element (make-result-file-element "PKG" :file file-zipname :name file-name))
;;------------------------------------------------------------------------
;; write the index.xml
;; write-xml-to-list serializes the list into XML (see JobUtilities.lsp)
;;------------------------------------------------------------------------
(write-xml-list-to-file results-element xml-file)
;;------------------------------
;; return = nil means 'no error'
;;------------------------------
(get-automation-error)
) ; let
)
(defun collect-check-results (part-check-result results-element)
(let* (
(error-entries (cdr (assoc k2-ui::*body-check-error-string* part-check-result)))
(model-state (if (> (length error-entries) 0) "model_corrupt" "model_ok"))
)
(xml:xml-list-add-attribute results-element "modelcheck" model-state)
)
)
|
|
ModelingJobExporter では C:\Program Files\PTC\Creo Elements\Direct Manager Server 20.9\taskagent\modeling ディレクトリに LISP スクリプトを置く必要があります。また、DrawingJobExporter では C:\Program Files\PTC\Creo Elements\Direct Manager Server 20.9\taskagent\drafting ディレクトリにマクロを置く必要があります。
|