#1
|
||||
|
||||
Lisp - select all unique models in session??
Hi,
I know 2 tricks for "doing something with all parts and assy's in session": - take the top assy and run through all children with this famous piece of Lisp code: Code:
(defun jb-inq-obj-tree-list (obj) (cons obj (apply #'nconc (mapcar #'jb-inq-obj-tree-list (sd-inq-obj-children obj) ) ) ) ) Code:
(setf tot (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :allow_wire_part :allow_face_part :allow_graphics_only (list :part :assembly) :select :recursive :all_at_top))) Does a trick like that exist??? Thanks! Jaap |
#2
|
||||
|
||||
Re: Lisp - select all unique models in session??
Rough idea: Walk the tree and insert part/assemblies into a hash table, using their contents data as the key. The resulting hash table would then contain only unique parts/assemblies.
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ |
#3
|
||||
|
||||
Re: Lisp - select all unique models in session??
Thanks Claus,
We'll take a dive into the hashtable manual :-) Jaap |
#4
|
||||
|
||||
Re: Lisp - select all unique models in session??
Untested sketch of how to insert a part/assy object into a hash table which uses the contents ID as the key:
(setf (gethash (sd-inq-obj-contents-sysid object) hash-table) object)
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ |
#5
|
|||
|
|||
Re: Lisp - select all unique models in session??
Quote:
Good luck! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#6
|
||||
|
||||
Re: Lisp - select all unique models in session??
Great, thanks for the suggestions!!
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|