PDA

View Full Version : Adding color to faces


Thom Ivancso
09-23-2004, 08:44 AM
Hello All,

I am creating a lisp routine that creates a pocket or boss or hole on a plate from user inputs. Now all works fine, except now I want to color code those newly created faces, but I am unsure if this can be done during the geometry creation.

Has anyone tried to do this?


Cheers
Thom

Wolfgang
09-26-2004, 06:52 AM
No I did not try.

But I'm also sometimes dreaming about a function like
(sd-get-last-created-elements :since model-checkpoint-X :type :faces :in-part Z)
Would be a nice enhancement.

Same is valid for loading.. If you load e.g. a package file. you don't know what you have loaded (assembly, parts, etc). At least I don't know a good function to do so.

Harry
09-26-2004, 11:21 PM
I made some routines to get a list of parts. The list is a result of a substraction of one list of parts made before manipulation and one list after manipulation. (for example load or copy action) Something similair could be made for elements in a part.


best regards,
Harry


(defun harry-part-tree-in-list (&key start)
;function: collect parts and place in list
;date : 03-05-2004
;----------------------------------------------------------------------
;input : :start [string] , start position
;output: [list] all parts found from start

(progn
;local vars
(let (a_obj_tree a_part_list a_partname_list)

(setf a_part_list (harry-inq-obj-tree-list (sd-pathname-to-obj start) ))
(setf a_part_list
(remove-if
#'(lambda (obj)
(not (equal (sel_item-type obj) *sd-part-seltype*))
);lamba
a_part_list)
)

(dolist (a_part a_part_list)
(progn
(push (sd-inq-obj-pathname a_part) a_partname_list)
);progn
);dolist

;return code
a_partname_list

);let
);prog
);defun



(defun harry-inq-obj-tree-list (obj)
(cons obj
(apply #'nconc (mapcar #'harry-inq-obj-tree-list (sd-inq-obj-children obj)) )
);cons
);defun





(defun harry-substract-string-lists (&key list1 list2 )
;function: substract list2 from list1
;date : 05-05-2004
;----------------------------------------------------------------------
;input : :list1 [string]
; : :list2 [string]
;output: [list] result of (- list1 list2)

(progn
;local vars
(let (a_element a_result_list)

(dolist (a_element list2)
(progn

;check if element excists in list1
(if (not(member a_element list1 :test #'sd-string=))
(push a_element a_result_list)
);if
);progn
);dolist

;return code
a_result_list

);let
);prog
);defun

dorothea
09-27-2004, 01:26 AM
Hello,

I made some routines to get a list of parts. The list is a result of a substraction of one list of parts made before manipulation and one list after manipulation. (for example load or copy action) Something similair could be made for elements in a part.

This mechanism ony works for parts and not in general for all types of elements . The parts are stored by the parcel path name. But elements usually don't have names. Therefore one has to store the sel_items of the elements and later access these sel_items - after the operation. But at this point in time it's NOT ALLOWED to access the sel_items anymore. They might have changed within the operation!

Therefore it's only allowed to do such handling with named objects because the names in general stay unchanged.

Dorothea