;; The purpouse of this file is to create a generic functions for the PTC functions that have changed in other versions ;; so that we don't have to constantly have to search the codes and change them there. ;; ;; Supported Versions: 18.1, 19, 20 ;; ;; ~Chris ;;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% (in-package :custom) (use-package :oli) ;;;; ============================================================================================================================= ;;;; Get the current version of the modeling program ;;;; ============================================================================================================================= (defvar *Model_Version* nil) ;;;; ============================================================================================================================= (defun sd_find_modeling_version () ;;;; ============================================================================================================================= ;;sort out the string (setq *Model_Version* (cond ((equal (sd-inq-version-string) "SolidDesigner 18.1B 29-Sep-2012") 18 ) ((equal (sd-inq-version-string) "SolidDesigner 19.0 09-May-2014") 19 ) ((equal (sd-inq-version-string) "SolidDesigner 20.0AP0401 12-May-2017") 20 ) );cond );setq );defun (sd_find_modeling_version) ;;;; ============================================================================================================================= (defun sd_generic_general_sweep (Option BPart Wire Control &optional CType Listing SideOnOff) ;;;; ============================================================================================================================= ;;logit (print "Using 'sd_Generic_General_Sweep") ;;Go ahead and gather all the spline geometry from the part (print " >>Collecting the spline") (setf Spline (sd-call-cmds (get_selection :focus_type *sd-edge-3d-seltype* :select :in_part Wire :all_3d) :failure Wire; if it's already a list );sd-call-cmds );setf ;;Check for contols (if (equal Control T)(progn (print " >>Collecting control information") (setq Cntrl (cond ((= CType 1) :curve) ((= CType 2) :const) ((= CType 3) :face_list Listing (sd-read-from-string(format nil ":~A" SideOnOff)) ) (t nil) ));setq ));if ;;Employ a trace function (print(format nil " >>The Modeling verions being used = ~A" *Model_Version*)) (cond ((= *Model_Version* 18)(trace elan-ui::general_sweep_add)) ((= *Model_Version* 19)(trace elan-ui::general_sweep_dia)) ((= *Model_Version* 20)(trace elan-ui::general_sweep_dia)) );cond ;;Sort out by versions first then options (cond ((= *Model_Version* 18)(cond ((= Option 1)(cond ;;If there's no Control ((equal Control nil)(sd-call-cmds(elan-ui::general_sweep_add :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :check :on )));1-nil ;;If there is Control ((equal Control T)(sd-call-cmds(elan-ui::general_sweep_add :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :control Cntrl :check :on )));1-T ));1-cond ((= Option 2)(cond ;;If there's no Control ((equal Control nil)(sd-call-cmds(elan-ui::general_sweep_rem :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :check :on )));2-nil ;;If there is Control ((equal Control T)(sd-call-cmds(elan-ui::general_sweep_rem :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :control Cntrl :check :on )));2-T ));cond ));18 ((or(= *Model_Version* 19)(= *Model_Version* 20))(cond ((= Option 1)(cond ;;If there's no Control ((equal Control nil)(sd-call-cmds(elan-ui::general_sweep_dia :add_material T :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :check :on )));1-nil ;;If there is Control ((equal Control T)(sd-call-cmds(elan-ui::general_sweep_dia :add_material T :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :control Cntrl :check :on )));1-T ));1-cond ((= Option 2)(cond ;;If there's no Control ((equal Control nil)(sd-call-cmds(elan-ui::general_sweep_dia :remove_material T :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :check :on )));2-nil ;;If there is Control ((equal Control T)(sd-call-cmds(elan-ui::general_sweep_dia :remove_material T :blank_part BPart :wp (sd-inq-curr-wp) :spine Spline :control Cntrl :check :on )));2-T ));cond ));19 );cond );defun ;;;; ============================================================================================================================= (defun sd_generic_helix (Option BPart Axis Pitch Turns &optional Right) ;;;; ============================================================================================================================= ;;logit (print "Using 'Sd_Generic_Helix") ;;create a few variables (setq Dir (cond ((equal Right nil) :on) (t (sd-read-from-string(format nil ":~A" Right))) ) );setq ;;Employ a trace function (print(format nil " >>The Modeling verions being used = ~A" *Model_Version*)) (cond ((= *Model_Version* 18)(trace elan-ui::helix_add)) ((= *Model_Version* 19)(trace elan-ui::helix_dia)) ((= *Model_Version* 20)(trace elan-ui::helix_dia)) );cond ;;Sort out by versions first then options (cond ((= *Model_Version* 18)(cond ((= Option 1) (sd-call-cmds(elan-ui::helix_add ;:add_material :blank_part BPart :wp (sd-inq-curr-wp) :axis Axis :pitch Pitch :turns Turns :right Dir :check :off )) );1 ((= Option 2) (sd-call-cmds(elan-ui::helix_rem ;:remove_material :blank_part BPart :wp (sd-inq-curr-wp) :axis Axis :pitch Pitch :turns Turns :right Dir :check :off )) );2 ));18 ((or(= *Model_Version* 19)(= *Model_Version* 20))(cond ((= Option 1) (sd-call-cmds(elan-ui::helix_dia :add_material T :blank_part BPart :wp (sd-inq-curr-wp) :axis Axis :pitch Pitch :turns Turns :right Dir :check :off )) );;1 ((= Option 2) (sd-call-cmds(elan-ui::helix_dia :remove_material T :blank_part BPart :wp (sd-inq-curr-wp) :axis Axis :pitch Pitch :turns Turns :right Dir :check :off )) );;2 ));19 );cond );defun