|
Time Estimates for Completion
|
||
|---|---|---|
|
Create the initial version of the SimpleModelGeometryCheck job.
|
Description:
|
5 minutes
|
|
Lab exercise:
|
15 minutes
|
|
<?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>
|
|
The job type prefix drafting defines Creo Elements/Direct Drafting as the target for job execution.
|
|
|
Job schedules (tasks) stored in the database use the job type to find the corresponding job configuration. Changing the job type in the XML configuration file causes previously created job schedules with the former job type to fail!
|
(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 expects LISP scripts in the C:\Program Files\PTC\Creo Elements\Direct Manager Server 20.8\taskagent\modeling directory, DrawingJobExporter expects macros in the C:\Program Files\PTC\Creo Elements\Direct Manager Server 20.8\taskagent\drafting directory.
|